diff options
| author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2021-07-05 16:44:29 -0400 |
|---|---|---|
| committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2021-07-07 23:54:20 -0400 |
| commit | 4cbe0127a668cbcc64087c5d311308b59d39b104 (patch) | |
| tree | dfc1d26a82ff37616ec855423853ba1c2dfe1552 /etc | |
| parent | ac3444968a8a081c17208ee6a9016f46b011167c (diff) | |
guix-install.sh: Prompt for configuring substitutes discovery.
Also ensure prompt_yes_no always print the message with a trailing space,
which is more pleasing to the eye.
* etc/guix-daemon.conf.in <--discover=no>: New guix-daemon option.
* etc/guix-daemon.service.in: Likewise.
* etc/init.d/guix-daemon.in: Likewise.
* etc/openrc/guix-daemon.in: Likewise.
* etc/guix-install.sh (configure_substitute_discovery): New procedure.
(sys_enable_guix_daemon): Ask the user whether automatic substitute discovery
should be enabled. Set the '--discover' argument accordingly.
(prompt_yes_no): Add a trailing space to the message.
(sys_authorize_build_farms): Remove trailing space from the message argument.
* NEWS (Distribution): Add news.
Diffstat (limited to 'etc')
| -rw-r--r-- | etc/guix-daemon.conf.in | 2 | ||||
| -rw-r--r-- | etc/guix-daemon.service.in | 3 | ||||
| -rwxr-xr-x | etc/guix-install.sh | 22 | ||||
| -rw-r--r-- | etc/init.d/guix-daemon.in | 2 | ||||
| -rw-r--r-- | etc/openrc/guix-daemon.in | 2 |
5 files changed, 25 insertions, 6 deletions
diff --git a/etc/guix-daemon.conf.in b/etc/guix-daemon.conf.in index 755192d5556..fb681d1f802 100644 --- a/etc/guix-daemon.conf.in +++ b/etc/guix-daemon.conf.in | |||
| @@ -7,4 +7,4 @@ start on runlevel [2345] | |||
| 7 | 7 | ||
| 8 | stop on runlevel [016] | 8 | stop on runlevel [016] |
| 9 | 9 | ||
| 10 | exec @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild | 10 | exec @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild --discover=no |
diff --git a/etc/guix-daemon.service.in b/etc/guix-daemon.service.in index 407cdd199c8..17b54eaeb06 100644 --- a/etc/guix-daemon.service.in +++ b/etc/guix-daemon.service.in | |||
| @@ -6,7 +6,8 @@ | |||
| 6 | Description=Build daemon for GNU Guix | 6 | Description=Build daemon for GNU Guix |
| 7 | 7 | ||
| 8 | [Service] | 8 | [Service] |
| 9 | ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild | 9 | ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \ |
| 10 | --build-users-group=guixbuild --discover=no | ||
| 10 | Environment='GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale' LC_ALL=en_US.utf8 | 11 | Environment='GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale' LC_ALL=en_US.utf8 |
| 11 | RemainAfterExit=yes | 12 | RemainAfterExit=yes |
| 12 | StandardOutput=syslog | 13 | StandardOutput=syslog |
diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 8ecadea97d2..4d81940eb7f 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh | |||
| @@ -96,7 +96,7 @@ _debug() | |||
| 96 | # $1: The prompt question. | 96 | # $1: The prompt question. |
| 97 | prompt_yes_no() { | 97 | prompt_yes_no() { |
| 98 | while true; do | 98 | while true; do |
| 99 | read -rp "$1" yn | 99 | read -rp "$1 " yn |
| 100 | case $yn in | 100 | case $yn in |
| 101 | [Yy]*) return 0;; | 101 | [Yy]*) return 0;; |
| 102 | [Nn]*) return 1;; | 102 | [Nn]*) return 1;; |
| @@ -249,6 +249,16 @@ chk_sys_nscd() | |||
| 249 | fi | 249 | fi |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | # Configure substitute discovery according to user's preferences. | ||
| 253 | # $1 is the installed service file to edit. | ||
| 254 | configure_substitute_discovery() { | ||
| 255 | if grep -q -- '--discover=no' "$1" && \ | ||
| 256 | prompt_yes_no "Would you like the Guix daemon to automatically \ | ||
| 257 | discover substitute servers on the local network? (yes/no)"; then | ||
| 258 | sed -i 's/--discover=no/--discover=yes/' "$1" | ||
| 259 | fi | ||
| 260 | } | ||
| 261 | |||
| 252 | # ------------------------------------------------------------------------------ | 262 | # ------------------------------------------------------------------------------ |
| 253 | #+MAIN | 263 | #+MAIN |
| 254 | 264 | ||
| @@ -397,6 +407,7 @@ sys_enable_guix_daemon() | |||
| 397 | { initctl reload-configuration; | 407 | { initctl reload-configuration; |
| 398 | cp "~root/.config/guix/current/lib/upstart/system/guix-daemon.conf" \ | 408 | cp "~root/.config/guix/current/lib/upstart/system/guix-daemon.conf" \ |
| 399 | /etc/init/ && | 409 | /etc/init/ && |
| 410 | configure_substitute_discovery /etc/init/guix-daemon.conf && | ||
| 400 | start guix-daemon; } && | 411 | start guix-daemon; } && |
| 401 | _msg "${PAS}enabled Guix daemon via upstart" | 412 | _msg "${PAS}enabled Guix daemon via upstart" |
| 402 | ;; | 413 | ;; |
| @@ -426,6 +437,9 @@ sys_enable_guix_daemon() | |||
| 426 | -e 's/^Environment=\(.*\)$/Environment=\1 LC_ALL=en_US.UTF-8'; | 437 | -e 's/^Environment=\(.*\)$/Environment=\1 LC_ALL=en_US.UTF-8'; |
| 427 | fi; | 438 | fi; |
| 428 | 439 | ||
| 440 | configure_substitute_discovery \ | ||
| 441 | /etc/systemd/system/guix-daemon.service | ||
| 442 | |||
| 429 | systemctl daemon-reload && | 443 | systemctl daemon-reload && |
| 430 | systemctl enable guix-daemon && | 444 | systemctl enable guix-daemon && |
| 431 | systemctl start guix-daemon; } && | 445 | systemctl start guix-daemon; } && |
| @@ -437,6 +451,8 @@ sys_enable_guix_daemon() | |||
| 437 | /etc/init.d/guix-daemon; | 451 | /etc/init.d/guix-daemon; |
| 438 | chmod 775 /etc/init.d/guix-daemon; | 452 | chmod 775 /etc/init.d/guix-daemon; |
| 439 | 453 | ||
| 454 | configure_substitute_discovery /etc/init.d/guix-daemon | ||
| 455 | |||
| 440 | update-rc.d guix-daemon defaults && | 456 | update-rc.d guix-daemon defaults && |
| 441 | update-rc.d guix-daemon enable && | 457 | update-rc.d guix-daemon enable && |
| 442 | service guix-daemon start; } && | 458 | service guix-daemon start; } && |
| @@ -448,6 +464,8 @@ sys_enable_guix_daemon() | |||
| 448 | /etc/init.d/guix-daemon; | 464 | /etc/init.d/guix-daemon; |
| 449 | chmod 775 /etc/init.d/guix-daemon; | 465 | chmod 775 /etc/init.d/guix-daemon; |
| 450 | 466 | ||
| 467 | configure_substitute_discovery /etc/init.d/guix-daemon | ||
| 468 | |||
| 451 | rc-update add guix-daemon default && | 469 | rc-update add guix-daemon default && |
| 452 | rc-service guix-daemon start; } && | 470 | rc-service guix-daemon start; } && |
| 453 | _msg "${PAS}enabled Guix daemon via OpenRC" | 471 | _msg "${PAS}enabled Guix daemon via OpenRC" |
| @@ -472,7 +490,7 @@ sys_enable_guix_daemon() | |||
| 472 | sys_authorize_build_farms() | 490 | sys_authorize_build_farms() |
| 473 | { # authorize the public key of the build farm | 491 | { # authorize the public key of the build farm |
| 474 | if prompt_yes_no "Permit downloading pre-built package binaries from the \ | 492 | if prompt_yes_no "Permit downloading pre-built package binaries from the \ |
| 475 | project's build farm? (yes/no) "; then | 493 | project's build farm? (yes/no)"; then |
| 476 | guix archive --authorize \ | 494 | guix archive --authorize \ |
| 477 | < "~root/.config/guix/current/share/guix/ci.guix.gnu.org.pub" \ | 495 | < "~root/.config/guix/current/share/guix/ci.guix.gnu.org.pub" \ |
| 478 | && _msg "${PAS}Authorized public key for ci.guix.gnu.org" | 496 | && _msg "${PAS}Authorized public key for ci.guix.gnu.org" |
diff --git a/etc/init.d/guix-daemon.in b/etc/init.d/guix-daemon.in index 1cc49fed89c..b7d4bb72bbb 100644 --- a/etc/init.d/guix-daemon.in +++ b/etc/init.d/guix-daemon.in | |||
| @@ -36,7 +36,7 @@ start) | |||
| 36 | -E LC_ALL=en_US.utf8 \ | 36 | -E LC_ALL=en_US.utf8 \ |
| 37 | -p "/var/run/guix-daemon.pid" \ | 37 | -p "/var/run/guix-daemon.pid" \ |
| 38 | @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \ | 38 | @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \ |
| 39 | --build-users-group=guixbuild | 39 | --build-users-group=guixbuild --discover=no |
| 40 | fi | 40 | fi |
| 41 | ;; | 41 | ;; |
| 42 | stop) | 42 | stop) |
diff --git a/etc/openrc/guix-daemon.in b/etc/openrc/guix-daemon.in index 110a58b88d7..eeedc2a840d 100644 --- a/etc/openrc/guix-daemon.in +++ b/etc/openrc/guix-daemon.in | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | export GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale | 20 | export GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale |
| 21 | export LC_ALL=en_US.utf8 | 21 | export LC_ALL=en_US.utf8 |
| 22 | command="@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon" | 22 | command="@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon" |
| 23 | command_args="--build-users-group=guixbuild" | 23 | command_args="--build-users-group=guixbuild --discover=no" |
| 24 | command_background="yes" | 24 | command_background="yes" |
| 25 | pidfile="/var/run/guix-daemon.pid" | 25 | pidfile="/var/run/guix-daemon.pid" |
| 26 | 26 | ||
