diff options
| author | Liam Hupfer <liam@hpfr.net> | 2025-02-05 22:25:04 -0600 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2025-02-21 15:27:11 +0100 |
| commit | 201db94628ea044b720ab4916d19eda022a4d6e7 (patch) | |
| tree | 58321950292db18bbc413862a16bb5ab76667f7d /etc | |
| parent | 754a5ab02f7c101ca474b9b3b75f1e6029f4e592 (diff) | |
guix-install.sh: Add msg helpers and use stderr consistently.
Add helpers to avoid repeated manual concatenation.
_err and _msg "$ERR are used interchangeably with their only difference
being output stream; convert all errors to use _err.
* etc/guix-install.sh: Add msg helpers and consolidate errors to stderr.
Change-Id: I06e97ccc50d108ed9e279ae80c6b2386d7b8c36b
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'etc')
| -rwxr-xr-x | etc/guix-install.sh | 149 |
1 files changed, 82 insertions, 67 deletions
diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 340c3a394f2..7a731962b3f 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh | |||
| @@ -110,7 +110,7 @@ GPG_SIGNING_KEYS[127547]=27D586A4F8900854329FF09F1260E46482E63562 # maxim | |||
| 110 | 110 | ||
| 111 | _err() | 111 | _err() |
| 112 | { # All errors go to stderr. | 112 | { # All errors go to stderr. |
| 113 | printf "[%s]: %s\n" "$(date +%s.%3N)" "$1" | 113 | printf "[%s]: ${ERR}%s\n" "$(date +%s.%3N)" "$1" |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | _msg() | 116 | _msg() |
| @@ -118,6 +118,21 @@ _msg() | |||
| 118 | printf "[%s]: %s\n" "$(date +%s.%3N)" "$1" | 118 | printf "[%s]: %s\n" "$(date +%s.%3N)" "$1" |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | _msg_pass() | ||
| 122 | { | ||
| 123 | _msg "$PAS$1" | ||
| 124 | } | ||
| 125 | |||
| 126 | _msg_warn() | ||
| 127 | { | ||
| 128 | _msg "$WAR$1" | ||
| 129 | } | ||
| 130 | |||
| 131 | _msg_info() | ||
| 132 | { | ||
| 133 | _msg "$INF$1" | ||
| 134 | } | ||
| 135 | |||
| 121 | _debug() | 136 | _debug() |
| 122 | { | 137 | { |
| 123 | if [ "${DEBUG}" = '1' ]; then | 138 | if [ "${DEBUG}" = '1' ]; then |
| @@ -127,7 +142,7 @@ _debug() | |||
| 127 | 142 | ||
| 128 | die() | 143 | die() |
| 129 | { | 144 | { |
| 130 | _err "${ERR}$*" | 145 | _err "$*" |
| 131 | exit 1 | 146 | exit 1 |
| 132 | } | 147 | } |
| 133 | 148 | ||
| @@ -154,7 +169,7 @@ chk_require() | |||
| 154 | 169 | ||
| 155 | [ "${#warn}" -ne 0 ] && die "Missing commands: ${warn[*]}." | 170 | [ "${#warn}" -ne 0 ] && die "Missing commands: ${warn[*]}." |
| 156 | 171 | ||
| 157 | _msg "${PAS}verification of required commands completed" | 172 | _msg_pass "verification of required commands completed" |
| 158 | } | 173 | } |
| 159 | 174 | ||
| 160 | add_init_sys_require() | 175 | add_init_sys_require() |
| @@ -195,7 +210,7 @@ Would you like me to fetch it for you?"; then | |||
| 195 | fi | 210 | fi |
| 196 | # If we reach this point, the key is (still) missing. Report further | 211 | # If we reach this point, the key is (still) missing. Report further |
| 197 | # missing keys, if any, but then abort the installation. | 212 | # missing keys, if any, but then abort the installation. |
| 198 | _err "${ERR}Missing OpenPGP public key ($gpg_key_id). | 213 | _err "Missing OpenPGP public key ($gpg_key_id). |
| 199 | Fetch it with this command: | 214 | Fetch it with this command: |
| 200 | 215 | ||
| 201 | wget \"https://sv.gnu.org/people/viewgpg.php?user_id=$user_id\" -O - | \ | 216 | wget \"https://sv.gnu.org/people/viewgpg.php?user_id=$user_id\" -O - | \ |
| @@ -227,24 +242,24 @@ chk_term() | |||
| 227 | chk_init_sys() | 242 | chk_init_sys() |
| 228 | { # Return init system type name. | 243 | { # Return init system type name. |
| 229 | if [[ $(/sbin/init --version 2>/dev/null) =~ upstart ]]; then | 244 | if [[ $(/sbin/init --version 2>/dev/null) =~ upstart ]]; then |
| 230 | _msg "${INF}init system is: upstart" | 245 | _msg_info "init system is: upstart" |
| 231 | INIT_SYS="upstart" | 246 | INIT_SYS="upstart" |
| 232 | return 0 | 247 | return 0 |
| 233 | elif [[ $(systemctl 2>/dev/null) =~ -\.mount ]]; then | 248 | elif [[ $(systemctl 2>/dev/null) =~ -\.mount ]]; then |
| 234 | _msg "${INF}init system is: systemd" | 249 | _msg_info "init system is: systemd" |
| 235 | INIT_SYS="systemd" | 250 | INIT_SYS="systemd" |
| 236 | return 0 | 251 | return 0 |
| 237 | elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then | 252 | elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then |
| 238 | _msg "${INF}init system is: sysv-init" | 253 | _msg_info "init system is: sysv-init" |
| 239 | INIT_SYS="sysv-init" | 254 | INIT_SYS="sysv-init" |
| 240 | return 0 | 255 | return 0 |
| 241 | elif [[ $(openrc --version 2>/dev/null) =~ \(OpenRC ]]; then | 256 | elif [[ $(openrc --version 2>/dev/null) =~ \(OpenRC ]]; then |
| 242 | _msg "${INF}init system is: OpenRC" | 257 | _msg_info "init system is: OpenRC" |
| 243 | INIT_SYS="openrc" | 258 | INIT_SYS="openrc" |
| 244 | return 0 | 259 | return 0 |
| 245 | else | 260 | else |
| 246 | INIT_SYS="NA" | 261 | INIT_SYS="NA" |
| 247 | _err "${ERR}Init system could not be detected." | 262 | _err "Init system could not be detected." |
| 248 | fi | 263 | fi |
| 249 | } | 264 | } |
| 250 | 265 | ||
| @@ -291,12 +306,12 @@ chk_sys_nscd() | |||
| 291 | { # Check if nscd is up and suggest to start it or install it | 306 | { # Check if nscd is up and suggest to start it or install it |
| 292 | if [ "$(type -P pidof)" ]; then | 307 | if [ "$(type -P pidof)" ]; then |
| 293 | if [ ! "$(pidof nscd)" ]; then | 308 | if [ ! "$(pidof nscd)" ]; then |
| 294 | _msg "${WAR}We recommend installing and/or starting your distribution 'nscd' service" | 309 | _msg_warn "We recommend installing and/or starting your distribution 'nscd' service" |
| 295 | _msg "${WAR}Please read 'info guix \"Application Setup\"' about \"Name Service Switch\"" | 310 | _msg_warn "Please read 'info guix \"Application Setup\"' about \"Name Service Switch\"" |
| 296 | fi | 311 | fi |
| 297 | else | 312 | else |
| 298 | _msg "${INF}We cannot determine if your distribution 'nscd' service is running" | 313 | _msg_info "We cannot determine if your distribution 'nscd' service is running" |
| 299 | _msg "${INF}Please read 'info guix \"Application Setup\"' about \"Name Service Switch\"" | 314 | _msg_info "Please read 'info guix \"Application Setup\"' about \"Name Service Switch\"" |
| 300 | fi | 315 | fi |
| 301 | } | 316 | } |
| 302 | 317 | ||
| @@ -334,7 +349,7 @@ guix_get_bin_list() | |||
| 334 | default_ver="guix-binary-${latest_ver}.${ARCH_OS}" | 349 | default_ver="guix-binary-${latest_ver}.${ARCH_OS}" |
| 335 | 350 | ||
| 336 | if [[ "${#bin_ver_ls}" -ne "0" ]]; then | 351 | if [[ "${#bin_ver_ls}" -ne "0" ]]; then |
| 337 | _msg "${PAS}Release for your system: ${default_ver}" | 352 | _msg_pass "Release for your system: ${default_ver}" |
| 338 | else | 353 | else |
| 339 | die "Could not obtain list of Guix releases." | 354 | die "Could not obtain list of Guix releases." |
| 340 | fi | 355 | fi |
| @@ -352,21 +367,21 @@ guix_get_bin() | |||
| 352 | 367 | ||
| 353 | _debug "--- [ ${FUNCNAME[0]} ] ---" | 368 | _debug "--- [ ${FUNCNAME[0]} ] ---" |
| 354 | 369 | ||
| 355 | _msg "${INF}Downloading Guix release archive" | 370 | _msg_info "Downloading Guix release archive" |
| 356 | 371 | ||
| 357 | wget --help | grep -q '\--show-progress' \ | 372 | wget --help | grep -q '\--show-progress' \ |
| 358 | && wget_args=("--no-verbose" "--show-progress") | 373 | && wget_args=("--no-verbose" "--show-progress") |
| 359 | 374 | ||
| 360 | if wget "${wget_args[@]}" -P "$dl_path" \ | 375 | if wget "${wget_args[@]}" -P "$dl_path" \ |
| 361 | "${url}/${bin_ver}.tar.xz" "${url}/${bin_ver}.tar.xz.sig"; then | 376 | "${url}/${bin_ver}.tar.xz" "${url}/${bin_ver}.tar.xz.sig"; then |
| 362 | _msg "${PAS}download completed." | 377 | _msg_pass "download completed." |
| 363 | else | 378 | else |
| 364 | die "could not download ${url}/${bin_ver}.tar.xz." | 379 | die "could not download ${url}/${bin_ver}.tar.xz." |
| 365 | fi | 380 | fi |
| 366 | 381 | ||
| 367 | pushd "${dl_path}" >/dev/null | 382 | pushd "${dl_path}" >/dev/null |
| 368 | if gpg --verify "${bin_ver}.tar.xz.sig" >/dev/null 2>&1; then | 383 | if gpg --verify "${bin_ver}.tar.xz.sig" >/dev/null 2>&1; then |
| 369 | _msg "${PAS}Signature is valid." | 384 | _msg_pass "Signature is valid." |
| 370 | popd >/dev/null | 385 | popd >/dev/null |
| 371 | else | 386 | else |
| 372 | die "could not verify the signature." | 387 | die "could not verify the signature." |
| @@ -382,18 +397,18 @@ sys_create_store() | |||
| 382 | 397 | ||
| 383 | if [[ -e /var/guix && -e /gnu ]]; then | 398 | if [[ -e /var/guix && -e /gnu ]]; then |
| 384 | if [ -n "$GUIX_ALLOW_OVERWRITE" ]; then | 399 | if [ -n "$GUIX_ALLOW_OVERWRITE" ]; then |
| 385 | _msg "${WAR}Overwriting existing installation!" | 400 | _msg_warn "Overwriting existing installation!" |
| 386 | else | 401 | else |
| 387 | die "A previous Guix installation was found. Refusing to overwrite." | 402 | die "A previous Guix installation was found. Refusing to overwrite." |
| 388 | fi | 403 | fi |
| 389 | fi | 404 | fi |
| 390 | 405 | ||
| 391 | cd "$tmp_path" | 406 | cd "$tmp_path" |
| 392 | _msg "${INF}Installing /var/guix and /gnu..." | 407 | _msg_info "Installing /var/guix and /gnu..." |
| 393 | # Strip (skip) the leading ‘.’ component, which fails on read-only ‘/’. | 408 | # Strip (skip) the leading ‘.’ component, which fails on read-only ‘/’. |
| 394 | tar --extract --strip-components=1 --file "$pkg" -C / | 409 | tar --extract --strip-components=1 --file "$pkg" -C / |
| 395 | 410 | ||
| 396 | _msg "${INF}Linking the root user's profile" | 411 | _msg_info "Linking the root user's profile" |
| 397 | mkdir -p ~root/.config/guix | 412 | mkdir -p ~root/.config/guix |
| 398 | ln -sf /var/guix/profiles/per-user/root/current-guix \ | 413 | ln -sf /var/guix/profiles/per-user/root/current-guix \ |
| 399 | ~root/.config/guix/current | 414 | ~root/.config/guix/current |
| @@ -403,18 +418,18 @@ sys_create_store() | |||
| 403 | # effective linting. | 418 | # effective linting. |
| 404 | # shellcheck disable=SC1091 | 419 | # shellcheck disable=SC1091 |
| 405 | source "${GUIX_PROFILE}/etc/profile" | 420 | source "${GUIX_PROFILE}/etc/profile" |
| 406 | _msg "${PAS}activated root profile at ${GUIX_PROFILE}" | 421 | _msg_pass "activated root profile at ${GUIX_PROFILE}" |
| 407 | } | 422 | } |
| 408 | 423 | ||
| 409 | sys_delete_store() | 424 | sys_delete_store() |
| 410 | { | 425 | { |
| 411 | _msg "${INF}removing /var/guix" | 426 | _msg_info "removing /var/guix" |
| 412 | rm -rf /var/guix | 427 | rm -rf /var/guix |
| 413 | 428 | ||
| 414 | _msg "${INF}removing /gnu" | 429 | _msg_info "removing /gnu" |
| 415 | rm -rf /gnu | 430 | rm -rf /gnu |
| 416 | 431 | ||
| 417 | _msg "${INF}removing ~root/.config/guix" | 432 | _msg_info "removing ~root/.config/guix" |
| 418 | rm -rf ~root/.config/guix | 433 | rm -rf ~root/.config/guix |
| 419 | } | 434 | } |
| 420 | 435 | ||
| @@ -424,20 +439,20 @@ sys_create_build_user() | |||
| 424 | _debug "--- [ ${FUNCNAME[0]} ] ---" | 439 | _debug "--- [ ${FUNCNAME[0]} ] ---" |
| 425 | 440 | ||
| 426 | if getent group guixbuild > /dev/null; then | 441 | if getent group guixbuild > /dev/null; then |
| 427 | _msg "${INF}group guixbuild exists" | 442 | _msg_info "group guixbuild exists" |
| 428 | else | 443 | else |
| 429 | groupadd --system guixbuild | 444 | groupadd --system guixbuild |
| 430 | _msg "${PAS}group <guixbuild> created" | 445 | _msg_pass "group <guixbuild> created" |
| 431 | fi | 446 | fi |
| 432 | 447 | ||
| 433 | if getent group kvm > /dev/null; then | 448 | if getent group kvm > /dev/null; then |
| 434 | _msg "${INF}group kvm exists and build users will be added to it" | 449 | _msg_info "group kvm exists and build users will be added to it" |
| 435 | local KVMGROUP=,kvm | 450 | local KVMGROUP=,kvm |
| 436 | fi | 451 | fi |
| 437 | 452 | ||
| 438 | for i in $(seq -w 1 10); do | 453 | for i in $(seq -w 1 10); do |
| 439 | if id "guixbuilder${i}" &>/dev/null; then | 454 | if id "guixbuilder${i}" &>/dev/null; then |
| 440 | _msg "${INF}user is already in the system, reset" | 455 | _msg_info "user is already in the system, reset" |
| 441 | usermod -g guixbuild -G guixbuild"$KVMGROUP" \ | 456 | usermod -g guixbuild -G guixbuild"$KVMGROUP" \ |
| 442 | -d /var/empty -s "$(which nologin)" \ | 457 | -d /var/empty -s "$(which nologin)" \ |
| 443 | -c "Guix build user $i" \ | 458 | -c "Guix build user $i" \ |
| @@ -447,7 +462,7 @@ sys_create_build_user() | |||
| 447 | -d /var/empty -s "$(which nologin)" \ | 462 | -d /var/empty -s "$(which nologin)" \ |
| 448 | -c "Guix build user $i" --system \ | 463 | -c "Guix build user $i" --system \ |
| 449 | "guixbuilder${i}"; | 464 | "guixbuilder${i}"; |
| 450 | _msg "${PAS}user added <guixbuilder${i}>" | 465 | _msg_pass "user added <guixbuilder${i}>" |
| 451 | fi | 466 | fi |
| 452 | done | 467 | done |
| 453 | } | 468 | } |
| @@ -460,7 +475,7 @@ sys_delete_build_user() | |||
| 460 | fi | 475 | fi |
| 461 | done | 476 | done |
| 462 | 477 | ||
| 463 | _msg "${INF}delete group guixbuild" | 478 | _msg_info "delete group guixbuild" |
| 464 | if getent group guixbuild &>/dev/null; then | 479 | if getent group guixbuild &>/dev/null; then |
| 465 | groupdel -f guixbuild | 480 | groupdel -f guixbuild |
| 466 | fi | 481 | fi |
| @@ -486,7 +501,7 @@ sys_enable_guix_daemon() | |||
| 486 | /etc/init/ && | 501 | /etc/init/ && |
| 487 | configure_substitute_discovery /etc/init/guix-daemon.conf && | 502 | configure_substitute_discovery /etc/init/guix-daemon.conf && |
| 488 | start guix-daemon; } && | 503 | start guix-daemon; } && |
| 489 | _msg "${PAS}enabled Guix daemon via upstart" | 504 | _msg_pass "enabled Guix daemon via upstart" |
| 490 | ;; | 505 | ;; |
| 491 | systemd) | 506 | systemd) |
| 492 | { install_unit() | 507 | { install_unit() |
| @@ -511,7 +526,7 @@ sys_enable_guix_daemon() | |||
| 511 | 526 | ||
| 512 | systemctl daemon-reload && | 527 | systemctl daemon-reload && |
| 513 | systemctl start guix-daemon; } && | 528 | systemctl start guix-daemon; } && |
| 514 | _msg "${PAS}enabled Guix daemon via systemd" | 529 | _msg_pass "enabled Guix daemon via systemd" |
| 515 | ;; | 530 | ;; |
| 516 | sysv-init) | 531 | sysv-init) |
| 517 | { mkdir -p /etc/init.d; | 532 | { mkdir -p /etc/init.d; |
| @@ -524,7 +539,7 @@ sys_enable_guix_daemon() | |||
| 524 | update-rc.d guix-daemon defaults && | 539 | update-rc.d guix-daemon defaults && |
| 525 | update-rc.d guix-daemon enable && | 540 | update-rc.d guix-daemon enable && |
| 526 | service guix-daemon start; } && | 541 | service guix-daemon start; } && |
| 527 | _msg "${PAS}enabled Guix daemon via sysv" | 542 | _msg_pass "enabled Guix daemon via sysv" |
| 528 | ;; | 543 | ;; |
| 529 | openrc) | 544 | openrc) |
| 530 | { mkdir -p /etc/init.d; | 545 | { mkdir -p /etc/init.d; |
| @@ -536,15 +551,15 @@ sys_enable_guix_daemon() | |||
| 536 | 551 | ||
| 537 | rc-update add guix-daemon default && | 552 | rc-update add guix-daemon default && |
| 538 | rc-service guix-daemon start; } && | 553 | rc-service guix-daemon start; } && |
| 539 | _msg "${PAS}enabled Guix daemon via OpenRC" | 554 | _msg_pass "enabled Guix daemon via OpenRC" |
| 540 | ;; | 555 | ;; |
| 541 | NA|*) | 556 | NA|*) |
| 542 | _msg "${ERR}unsupported init system; run the daemon manually:" | 557 | _err "unsupported init system; run the daemon manually:" |
| 543 | echo " ~root/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild" | 558 | echo " ~root/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild" |
| 544 | ;; | 559 | ;; |
| 545 | esac | 560 | esac |
| 546 | 561 | ||
| 547 | _msg "${INF}making the guix command available to other users" | 562 | _msg_info "making the guix command available to other users" |
| 548 | 563 | ||
| 549 | [ -e "$local_bin" ] || mkdir -p "$local_bin" | 564 | [ -e "$local_bin" ] || mkdir -p "$local_bin" |
| 550 | ln -sf "${var_guix}/bin/guix" "$local_bin" | 565 | ln -sf "${var_guix}/bin/guix" "$local_bin" |
| @@ -570,28 +585,28 @@ sys_delete_guix_daemon() | |||
| 570 | 585 | ||
| 571 | case "$INIT_SYS" in | 586 | case "$INIT_SYS" in |
| 572 | upstart) | 587 | upstart) |
| 573 | _msg "${INF}stopping guix-daemon" | 588 | _msg_info "stopping guix-daemon" |
| 574 | stop guix-daemon | 589 | stop guix-daemon |
| 575 | _msg "${INF}removing guix-daemon" | 590 | _msg_info "removing guix-daemon" |
| 576 | rm /etc/init/guix-daemon.conf | 591 | rm /etc/init/guix-daemon.conf |
| 577 | ;; | 592 | ;; |
| 578 | 593 | ||
| 579 | systemd) | 594 | systemd) |
| 580 | if [ -f /etc/systemd/system/guix-daemon.service ]; then | 595 | if [ -f /etc/systemd/system/guix-daemon.service ]; then |
| 581 | _msg "${INF}disabling guix-daemon" | 596 | _msg_info "disabling guix-daemon" |
| 582 | systemctl disable guix-daemon | 597 | systemctl disable guix-daemon |
| 583 | _msg "${INF}stopping guix-daemon" | 598 | _msg_info "stopping guix-daemon" |
| 584 | systemctl stop guix-daemon | 599 | systemctl stop guix-daemon |
| 585 | _msg "${INF}removing guix-daemon" | 600 | _msg_info "removing guix-daemon" |
| 586 | rm -f /etc/systemd/system/guix-daemon.service | 601 | rm -f /etc/systemd/system/guix-daemon.service |
| 587 | fi | 602 | fi |
| 588 | 603 | ||
| 589 | if [ -f /etc/systemd/system/gnu-store.mount ]; then | 604 | if [ -f /etc/systemd/system/gnu-store.mount ]; then |
| 590 | _msg "${INF}disabling gnu-store.mount" | 605 | _msg_info "disabling gnu-store.mount" |
| 591 | systemctl disable gnu-store.mount | 606 | systemctl disable gnu-store.mount |
| 592 | _msg "${INF}stopping gnu-store.mount" | 607 | _msg_info "stopping gnu-store.mount" |
| 593 | systemctl stop gnu-store.mount | 608 | systemctl stop gnu-store.mount |
| 594 | _msg "${INF}removing gnu-store.mount" | 609 | _msg_info "removing gnu-store.mount" |
| 595 | rm -f /etc/systemd/system/gnu-store.mount | 610 | rm -f /etc/systemd/system/gnu-store.mount |
| 596 | fi | 611 | fi |
| 597 | systemctl daemon-reload | 612 | systemctl daemon-reload |
| @@ -603,16 +618,16 @@ sys_delete_guix_daemon() | |||
| 603 | rm -rf /etc/init.d/guix-daemon | 618 | rm -rf /etc/init.d/guix-daemon |
| 604 | ;; | 619 | ;; |
| 605 | NA|*) | 620 | NA|*) |
| 606 | _msg "${ERR}unsupported init system; disable, stop and remove the daemon manually:" | 621 | _err "unsupported init system; disable, stop and remove the daemon manually:" |
| 607 | echo " ~root/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild" | 622 | echo " ~root/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild" |
| 608 | ;; | 623 | ;; |
| 609 | esac | 624 | esac |
| 610 | 625 | ||
| 611 | 626 | ||
| 612 | _msg "${INF}removing $local_bin/guix" | 627 | _msg_info "removing $local_bin/guix" |
| 613 | rm -f "$local_bin"/guix | 628 | rm -f "$local_bin"/guix |
| 614 | 629 | ||
| 615 | _msg "${INF}removing $info_path/guix*" | 630 | _msg_info "removing $info_path/guix*" |
| 616 | rm -f "$info_path"/guix* | 631 | rm -f "$info_path"/guix* |
| 617 | } | 632 | } |
| 618 | 633 | ||
| @@ -629,10 +644,10 @@ project's build farms?"; then | |||
| 629 | local key=~root/.config/guix/current/share/guix/$host.pub | 644 | local key=~root/.config/guix/current/share/guix/$host.pub |
| 630 | [ -f "$key" ] \ | 645 | [ -f "$key" ] \ |
| 631 | && guix archive --authorize < "$key" \ | 646 | && guix archive --authorize < "$key" \ |
| 632 | && _msg "${PAS}Authorized public key for $host" | 647 | && _msg_pass "Authorized public key for $host" |
| 633 | done | 648 | done |
| 634 | else | 649 | else |
| 635 | _msg "${INF}Skipped authorizing build farm public keys" | 650 | _msg_info "Skipped authorizing build farm public keys" |
| 636 | fi | 651 | fi |
| 637 | } | 652 | } |
| 638 | 653 | ||
| @@ -715,7 +730,7 @@ sys_create_shell_completion() | |||
| 715 | ln -sf ${var_guix}/etc/bash_completion.d/guix-daemon "$bash_completion"; | 730 | ln -sf ${var_guix}/etc/bash_completion.d/guix-daemon "$bash_completion"; |
| 716 | ln -sf ${var_guix}/share/zsh/site-functions/_guix "$zsh_completion"; | 731 | ln -sf ${var_guix}/share/zsh/site-functions/_guix "$zsh_completion"; |
| 717 | ln -sf ${var_guix}/share/fish/vendor_completions.d/guix.fish "$fish_completion"; } && | 732 | ln -sf ${var_guix}/share/fish/vendor_completions.d/guix.fish "$fish_completion"; } && |
| 718 | _msg "${PAS}installed shell completion" | 733 | _msg_pass "installed shell completion" |
| 719 | } | 734 | } |
| 720 | 735 | ||
| 721 | sys_delete_shell_completion() | 736 | sys_delete_shell_completion() |
| @@ -726,7 +741,7 @@ sys_delete_shell_completion() | |||
| 726 | zsh_completion=/usr/share/zsh/site-functions | 741 | zsh_completion=/usr/share/zsh/site-functions |
| 727 | fish_completion=/usr/share/fish/vendor_completions.d | 742 | fish_completion=/usr/share/fish/vendor_completions.d |
| 728 | 743 | ||
| 729 | _msg "${INF}removing shell completion" | 744 | _msg_info "removing shell completion" |
| 730 | 745 | ||
| 731 | rm -f "$bash_completion"/guix; | 746 | rm -f "$bash_completion"/guix; |
| 732 | rm -f "$bash_completion"/guix-daemon; | 747 | rm -f "$bash_completion"/guix-daemon; |
| @@ -753,7 +768,7 @@ if [ -n "$GUIX_ENVIRONMENT" ]; then | |||
| 753 | fi | 768 | fi |
| 754 | ' >> "$bashrc" | 769 | ' >> "$bashrc" |
| 755 | done | 770 | done |
| 756 | _msg "${PAS}Bash shell prompt successfully customized for Guix" | 771 | _msg_pass "Bash shell prompt successfully customized for Guix" |
| 757 | } | 772 | } |
| 758 | 773 | ||
| 759 | sys_maybe_setup_selinux() | 774 | sys_maybe_setup_selinux() |
| @@ -782,17 +797,17 @@ sys_maybe_setup_selinux() | |||
| 782 | 797 | ||
| 783 | sys_delete_init_profile() | 798 | sys_delete_init_profile() |
| 784 | { | 799 | { |
| 785 | _msg "${INF}removing /etc/profile.d/guix.sh" | 800 | _msg_info "removing /etc/profile.d/guix.sh" |
| 786 | rm -f /etc/profile.d/guix.sh | 801 | rm -f /etc/profile.d/guix.sh |
| 787 | } | 802 | } |
| 788 | 803 | ||
| 789 | sys_delete_user_profiles() | 804 | sys_delete_user_profiles() |
| 790 | { | 805 | { |
| 791 | _msg "${INF}removing ~root/.guix-profile" | 806 | _msg_info "removing ~root/.guix-profile" |
| 792 | rm -f ~root/.guix-profile | 807 | rm -f ~root/.guix-profile |
| 793 | rm -rf ~root/.cache/guix | 808 | rm -rf ~root/.cache/guix |
| 794 | 809 | ||
| 795 | _msg "${INF}removing .guix-profile, .cache/guix and .config/guix of all /home users" | 810 | _msg_info "removing .guix-profile, .cache/guix and .config/guix of all /home users" |
| 796 | rm -rf /home/*/{.guix-profile,{.cache,.config}/guix} | 811 | rm -rf /home/*/{.guix-profile,{.cache,.config}/guix} |
| 797 | } | 812 | } |
| 798 | 813 | ||
| @@ -841,8 +856,8 @@ EOF | |||
| 841 | if [ "$char" ]; then | 856 | if [ "$char" ]; then |
| 842 | echo | 857 | echo |
| 843 | echo "...that ($char) was not a return!" | 858 | echo "...that ($char) was not a return!" |
| 844 | _msg "${WAR}Use newlines to automate installation, e.g.: yes '' | ${0##*/}" | 859 | _msg_warn "Use newlines to automate installation, e.g.: yes '' | ${0##*/}" |
| 845 | _msg "${WAR}Any other method is unsupported and likely to break in future." | 860 | _msg_warn "Any other method is unsupported and likely to break in future." |
| 846 | fi | 861 | fi |
| 847 | } | 862 | } |
| 848 | 863 | ||
| @@ -861,7 +876,7 @@ main_install() | |||
| 861 | chk_sys_arch | 876 | chk_sys_arch |
| 862 | chk_sys_nscd | 877 | chk_sys_nscd |
| 863 | 878 | ||
| 864 | _msg "${INF}system is ${ARCH_OS}" | 879 | _msg_info "system is ${ARCH_OS}" |
| 865 | 880 | ||
| 866 | umask 0022 | 881 | umask 0022 |
| 867 | tmp_path="$(mktemp -t -d guix.XXXXXX)" | 882 | tmp_path="$(mktemp -t -d guix.XXXXXX)" |
| @@ -874,7 +889,7 @@ main_install() | |||
| 874 | if ! [[ $GUIX_BINARY_FILE_NAME =~ $ARCH_OS ]]; then | 889 | if ! [[ $GUIX_BINARY_FILE_NAME =~ $ARCH_OS ]]; then |
| 875 | _err "$ARCH_OS not in ${GUIX_BINARY_FILE_NAME}; aborting" | 890 | _err "$ARCH_OS not in ${GUIX_BINARY_FILE_NAME}; aborting" |
| 876 | fi | 891 | fi |
| 877 | _msg "${INF}Using manually provided binary ${GUIX_BINARY_FILE_NAME}" | 892 | _msg_info "Using manually provided binary ${GUIX_BINARY_FILE_NAME}" |
| 878 | GUIX_BINARY_FILE_NAME=$(realpath "$GUIX_BINARY_FILE_NAME") | 893 | GUIX_BINARY_FILE_NAME=$(realpath "$GUIX_BINARY_FILE_NAME") |
| 879 | fi | 894 | fi |
| 880 | 895 | ||
| @@ -887,14 +902,14 @@ main_install() | |||
| 887 | sys_create_shell_completion | 902 | sys_create_shell_completion |
| 888 | sys_customize_bashrc | 903 | sys_customize_bashrc |
| 889 | 904 | ||
| 890 | _msg "${INF}cleaning up ${tmp_path}" | 905 | _msg_info "cleaning up ${tmp_path}" |
| 891 | rm -r "${tmp_path}" | 906 | rm -r "${tmp_path}" |
| 892 | 907 | ||
| 893 | _msg "${PAS}Guix has successfully been installed!" | 908 | _msg_pass "Guix has successfully been installed!" |
| 894 | _msg "${INF}Run 'info guix' to read the manual." | 909 | _msg_info "Run 'info guix' to read the manual." |
| 895 | 910 | ||
| 896 | # Required to source /etc/profile in desktop environments. | 911 | # Required to source /etc/profile in desktop environments. |
| 897 | _msg "${INF}Please log out and back in to complete the installation." | 912 | _msg_info "Please log out and back in to complete the installation." |
| 898 | } | 913 | } |
| 899 | 914 | ||
| 900 | main_uninstall() | 915 | main_uninstall() |
| @@ -908,7 +923,7 @@ main_uninstall() | |||
| 908 | chk_init_sys | 923 | chk_init_sys |
| 909 | chk_sys_arch | 924 | chk_sys_arch |
| 910 | 925 | ||
| 911 | _msg "${INF}system is ${ARCH_OS}" | 926 | _msg_info "system is ${ARCH_OS}" |
| 912 | 927 | ||
| 913 | # stop the build, package system. | 928 | # stop the build, package system. |
| 914 | sys_delete_guix_daemon | 929 | sys_delete_guix_daemon |
| @@ -922,12 +937,12 @@ main_uninstall() | |||
| 922 | sys_delete_shell_completion | 937 | sys_delete_shell_completion |
| 923 | 938 | ||
| 924 | # these directories are created on the fly during usage. | 939 | # these directories are created on the fly during usage. |
| 925 | _msg "${INF}removing /etc/guix" | 940 | _msg_info "removing /etc/guix" |
| 926 | rm -rf /etc/guix | 941 | rm -rf /etc/guix |
| 927 | _msg "${INF}removing /var/log/guix" | 942 | _msg_info "removing /var/log/guix" |
| 928 | rm -rf /var/log/guix | 943 | rm -rf /var/log/guix |
| 929 | 944 | ||
| 930 | _msg "${PAS}Guix has successfully been uninstalled!" | 945 | _msg_pass "Guix has successfully been uninstalled!" |
| 931 | } | 946 | } |
| 932 | 947 | ||
| 933 | main() | 948 | main() |
