* [bug#40601] [PATCH 02/28] guix-install.sh: Add xz to requirements.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
@ 2020-05-17 17:16 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 03/28] guix-install.sh: Fix systemctl not found error message at probe Vincent Legoll
` (26 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:16 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
* etc/guix-install.sh (REQUIRE): Add xz to requirements list.
---
etc/guix-install.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 4909d3f162..dbc038a0ab 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -48,6 +48,7 @@ REQUIRE=(
"groupadd"
"tail"
"tr"
+ "xz"
)
PAS=$'[ \033[32;1mPASS\033[0m ] '
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 03/28] guix-install.sh: Fix systemctl not found error message at probe.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
2020-05-17 17:16 ` [bug#40601] [PATCH 02/28] guix-install.sh: Add xz to requirements Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 04/28] guix-install.sh: Handle local binary tarball file Vincent Legoll
` (25 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
* etc/guix-install.sh (chk_init_sys)[systemctl]: Redirect errors to /dev/null.
---
etc/guix-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index dbc038a0ab..4fa9664cf5 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -142,7 +142,7 @@ chk_init_sys()
_msg "${INF}init system is: upstart"
INIT_SYS="upstart"
return 0
- elif [[ $(systemctl) =~ -\.mount ]]; then
+ elif [[ $(systemctl 2>/dev/null) =~ -\.mount ]]; then
_msg "${INF}init system is: systemd"
INIT_SYS="systemd"
return 0
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 04/28] guix-install.sh: Handle local binary tarball file.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
2020-05-17 17:16 ` [bug#40601] [PATCH 02/28] guix-install.sh: Add xz to requirements Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 03/28] guix-install.sh: Fix systemctl not found error message at probe Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-23 13:42 ` Tobias Geerinckx-Rice via Guix-patches via
2020-05-17 17:17 ` [bug#40601] [PATCH 05/28] guix-install.sh, guix-binary tarball: Handle runit-based foreign distributions Vincent Legoll
` (24 subsequent siblings)
27 siblings, 1 reply; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
* etc/guix-install.sh (REQUIRE): add realpath.
(main): Handle local binary tarball file path passed as first arg.
---
etc/guix-install.sh | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 4fa9664cf5..7b9a729570 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -4,6 +4,7 @@
# Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
# Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
# Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+# Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
#
# This file is part of GNU Guix.
#
@@ -47,6 +48,7 @@ REQUIRE=(
"uname"
"groupadd"
"tail"
+ "realpath"
"tr"
"xz"
)
@@ -482,10 +484,14 @@ main()
umask 0022
tmp_path="$(mktemp -t -d guix.XXX)"
- guix_get_bin_list "${GNU_URL}"
- guix_get_bin "${GNU_URL}" "${BIN_VER}" "$tmp_path"
-
- sys_create_store "${BIN_VER}.tar.xz" "${tmp_path}"
+ if [ -z "$1" ]; then
+ guix_get_bin_list "${GNU_URL}"
+ guix_get_bin "${GNU_URL}" "${BIN_VER}" "${tmp_path}"
+ TARBALL="${BIN_VER}.tar.xz"
+ else
+ TARBALL="$(realpath $1)"
+ fi
+ sys_create_store "${TARBALL}" "${tmp_path}"
sys_create_build_user
sys_enable_guix_daemon
sys_authorize_build_farms
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 04/28] guix-install.sh: Handle local binary tarball file.
2020-05-17 17:17 ` [bug#40601] [PATCH 04/28] guix-install.sh: Handle local binary tarball file Vincent Legoll
@ 2020-05-23 13:42 ` Tobias Geerinckx-Rice via Guix-patches via
2020-05-23 21:37 ` Vincent Legoll
0 siblings, 1 reply; 64+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-05-23 13:42 UTC (permalink / raw)
To: Vincent Legoll; +Cc: 40601
[-- Attachment #1: Type: text/plain, Size: 663 bytes --]
Vincent,
I've pushed the first three patches with some commit message
tweaks.
Vincent Legoll 写道:
> * etc/guix-install.sh (REQUIRE): add realpath.
> (main): Handle local binary tarball file path passed as first
> arg.
‘file name’, ‘argument’.
I'm OK with this change in general but it needs to be documented
*somewhere*: in (guix)Binary Installation and/or a (new) --help
message and/or an ‘Invocation:’ comment at the top of the script.
I notice you ran out of commit message energy halfway through the
series :-) While I've come to love Guix's discipline, I
sympathise, but what's the plan?
Thanks,
T G-R
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 04/28] guix-install.sh: Handle local binary tarball file.
2020-05-23 13:42 ` Tobias Geerinckx-Rice via Guix-patches via
@ 2020-05-23 21:37 ` Vincent Legoll
0 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-23 21:37 UTC (permalink / raw)
To: Tobias Geerinckx-Rice; +Cc: 40601
On 23/05/2020 15:42, Tobias Geerinckx-Rice wrote:
> Vincent,
>
> I've pushed the first three patches with some commit message tweaks.
Thanks & thanks
> Vincent Legoll 写道:
>> * etc/guix-install.sh (REQUIRE): add realpath.
>> (main): Handle local binary tarball file path passed as first arg.
>
> ‘file name’, ‘argument’.
>
> I'm OK with this change in general but it needs to be documented
> *somewhere*: in (guix)Binary Installation and/or a (new) --help message
> and/or an ‘Invocation:’ comment at the top of the script.
>
> I notice you ran out of commit message energy halfway through the series
> :-) While I've come to love Guix's discipline, I sympathise, but what's
> the plan?
I was off duty at dayjob cause of covid partial unemployment last week,
that's why I got more time to work on guix. I have resumed work this
week so it explains the slowdown ;-)
The plan is that I'll continue working on this series to polish the
commit messages that need to be. I just wanted to send the series to
have the ACKs that it will not be lost work, before continuing.
I've got ACKs, so I'll work on finishing the pending patches, before
embarking on more TODO items. And doc is one item from that TODO list.
I'll put it on top.
But even if dev speed is lower, I'm committed to finish this.
--
Vincent Legoll
^ permalink raw reply [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 05/28] guix-install.sh, guix-binary tarball: Handle runit-based foreign distributions.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (2 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 04/28] guix-install.sh: Handle local binary tarball file Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 06/28] guix-install.sh: trivial whitespace fix Vincent Legoll
` (23 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
* .gitignore: Add /etc/runit/run.
* etc/guix-install.sh (chk_init_sys): Add case to detect runit.
(sys_enable_guix_daemon): Add case to setup guix-daemon within runit.
* etc/runit/run.in: New file.
* nix/local.mk (etc/runit/run): Add target to generate etc/runit/run from
etc/runit/run.in. (nodist_runitservice_DATA): New variable... (CLEANFILES):
... add it here. (runitservicedir): New variable. (EXTRA_DIST): Add
etc/runit/run.in.
---
.gitignore | 1 +
etc/guix-install.sh | 11 +++++++++++
etc/runit/run.in | 15 +++++++++++++++
nix/local.mk | 14 ++++++++++++++
4 files changed, 41 insertions(+)
create mode 100644 etc/runit/run.in
diff --git a/.gitignore b/.gitignore
index fd2cf56098..89a2c89e1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -72,6 +72,7 @@
/etc/guix-publish.conf
/etc/guix-publish.service
/etc/init.d/guix-daemon
+/etc/runit/run
/guix-daemon
/guix/config.scm
/libformat.a
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 7b9a729570..6eff82c444 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -152,6 +152,10 @@ chk_init_sys()
_msg "${INF}init system is: sysv-init"
INIT_SYS="sysv-init"
return 0
+ elif [[ -d /etc/sv ]]; then
+ _msg "${INF}init system is: runit"
+ INIT_SYS="runit"
+ return 0
else
INIT_SYS="NA"
_err "${ERR}Init system could not be detected."
@@ -364,6 +368,13 @@ sys_enable_guix_daemon()
systemctl enable guix-daemon; } &&
_msg "${PAS}enabled Guix daemon via systemd"
;;
+ runit)
+ { cp -r "${ROOT_HOME}/.config/guix/current/lib/runit/guix-daemon" \
+ /etc/sv;
+ chmod 755 /etc/sv/guix-daemon/run;
+ ln -s /etc/sv/guix-daemon /etc/runit/runsvdir/default/; } &&
+ _msg "${PAS}enabled Guix daemon via runit"
+ ;;
sysv-init)
{ mkdir -p /etc/init.d;
cp "${ROOT_HOME}/.config/guix/current/etc/init.d/guix-daemon" \
diff --git a/etc/runit/run.in b/etc/runit/run.in
new file mode 100644
index 0000000000..e57ef597bc
--- /dev/null
+++ b/etc/runit/run.in
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# This is a "run script" for the runit init system to launch
+# 'guix-daemon'. Drop it in /etc/sv/guix-daemon and add a symlink to
+# it like the following to have 'guix-daemon' automatically started.
+# ln -s /etc/sv/guix-daemon /etc/runit/runsvdir/default/
+
+GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale
+LC_ALL=en_US.utf8
+
+export GUIX_LOCPATH LC_ALL
+
+exec @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \
+ --build-users-group=guixbuild
+
diff --git a/nix/local.mk b/nix/local.mk
index 412d89ba3d..582ff16168 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -1,6 +1,7 @@
# GNU Guix --- Functional package management for GNU
# Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
+# Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
#
# This file is part of GNU Guix.
#
@@ -175,6 +176,17 @@ etc/init.d/guix-daemon: etc/init.d/guix-daemon.in \
"$<" > "$@.tmp"; \
mv "$@.tmp" "$@"
+# The service run script for runit.
+runitservicedir = $(libdir)/runit/guix-daemon
+nodist_runitservice_DATA = etc/runit/run
+
+etc/runit/run: etc/runit/run.in \
+ $(top_builddir)/config.status
+ $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
+ $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \
+ "$<" > "$@.tmp"; \
+ mv "$@.tmp" "$@"
+
# The '.conf' jobs for Upstart.
upstartjobdir = $(libdir)/upstart/system
nodist_upstartjob_DATA = etc/guix-daemon.conf etc/guix-publish.conf
@@ -189,6 +201,7 @@ etc/guix-%.conf: etc/guix-%.conf.in \
CLEANFILES += \
$(nodist_systemdservice_DATA) \
$(nodist_upstartjob_DATA) \
+ $(nodist_runitservice_DATA) \
$(nodist_sysvinitservice_DATA)
EXTRA_DIST += \
@@ -198,6 +211,7 @@ EXTRA_DIST += \
etc/guix-daemon.conf.in \
etc/guix-publish.service.in \
etc/guix-publish.conf.in \
+ etc/runit/run.in \
etc/init.d/guix-daemon.in
if CAN_RUN_TESTS
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 06/28] guix-install.sh: trivial whitespace fix.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (3 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 05/28] guix-install.sh, guix-binary tarball: Handle runit-based foreign distributions Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 07/28] guix-install.sh: Move code in a new function Vincent Legoll
` (22 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
Almost the entire file is indented with spaces, a few tabs slipped in, clean
them up.
Checked triviality with git diff -b.
* etc/guix-install.sh(chk_sys_arch): Replace tabs with spaces.
(sys_enable_guix_daemon): Likewise.
---
etc/guix-install.sh | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 6eff82c444..078aa4a781 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -180,9 +180,9 @@ chk_sys_arch()
aarch64)
local arch=aarch64
;;
- armv7l)
- local arch=armhf
- ;;
+ armv7l)
+ local arch=armhf
+ ;;
*)
_err "${ERR}Unsupported CPU type: ${arch}"
exit 1
@@ -353,15 +353,15 @@ sys_enable_guix_daemon()
/etc/systemd/system/;
chmod 664 /etc/systemd/system/guix-daemon.service;
- # Work around <https://bugs.gnu.org/36074>, present in 1.0.1.
- sed -i /etc/systemd/system/guix-daemon.service \
- -e "s/GUIX_LOCPATH='/'GUIX_LOCPATH=/";
+ # Work around <https://bugs.gnu.org/36074>, present in 1.0.1.
+ sed -i /etc/systemd/system/guix-daemon.service \
+ -e "s/GUIX_LOCPATH='/'GUIX_LOCPATH=/";
- # Work around <https://bugs.gnu.org/35671>, present in 1.0.1.
- if ! grep en_US /etc/systemd/system/guix-daemon.service >/dev/null;
- then sed -i /etc/systemd/system/guix-daemon.service \
- -e 's/^Environment=\(.*\)$/Environment=\1 LC_ALL=en_US.UTF-8';
- fi;
+ # Work around <https://bugs.gnu.org/35671>, present in 1.0.1.
+ if ! grep en_US /etc/systemd/system/guix-daemon.service >/dev/null;
+ then sed -i /etc/systemd/system/guix-daemon.service \
+ -e 's/^Environment=\(.*\)$/Environment=\1 LC_ALL=en_US.UTF-8';
+ fi;
systemctl daemon-reload &&
systemctl start guix-daemon &&
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 07/28] guix-install.sh: Move code in a new function.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (4 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 06/28] guix-install.sh: trivial whitespace fix Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 08/28] guix-install.sh: Use getent for both user & group presence checking Vincent Legoll
` (21 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
* etc/guix-install.sh (sys_enable_guix_daemon): Move code from here...
(sys_make_guix_available): ...to this new function, fixing whitespace...
(main): ...and call it here.
---
etc/guix-install.sh | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 078aa4a781..225cf532b8 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -330,16 +330,8 @@ sys_create_build_user()
sys_enable_guix_daemon()
{ # Run the daemon, and set it to automatically start on boot.
- local info_path
- local local_bin
- local var_guix
-
_debug "--- [ $FUNCNAME ] ---"
- info_path="/usr/local/share/info"
- local_bin="/usr/local/bin"
- var_guix="/var/guix/profiles/per-user/root/current-guix"
-
case "$INIT_SYS" in
upstart)
{ initctl reload-configuration;
@@ -391,11 +383,25 @@ sys_enable_guix_daemon()
echo " ${ROOT_HOME}/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild"
;;
esac
+}
+
+sys_make_guix_available()
+{ # add guix into PATH
+
+ local info_path
+ local local_bin
+ local var_guix
+
+ _debug "--- [ $FUNCNAME ] ---"
+
+ info_path="/usr/local/share/info"
+ local_bin="/usr/local/bin"
+ var_guix="/var/guix/profiles/per-user/root/current-guix"
_msg "${INF}making the guix command available to other users"
[ -e "$local_bin" ] || mkdir -p "$local_bin"
- ln -sf "${var_guix}/bin/guix" "$local_bin"
+ ln -sf "${var_guix}/bin/guix" "$local_bin"
[ -e "$info_path" ] || mkdir -p "$info_path"
for i in ${var_guix}/share/info/*; do
@@ -505,6 +511,7 @@ main()
sys_create_store "${TARBALL}" "${tmp_path}"
sys_create_build_user
sys_enable_guix_daemon
+ sys_make_guix_available
sys_authorize_build_farms
sys_create_init_profile
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 08/28] guix-install.sh: Use getent for both user & group presence checking.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (5 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 07/28] guix-install.sh: Move code in a new function Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 09/28] guix-install.sh: Fix requirements Vincent Legoll
` (20 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
* etc/guix-install.sh (sys_create_build_user): Use getent instead of id to check
presence of users, use bare getent call with output redirection for group check.
---
etc/guix-install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 225cf532b8..a56e0ec7b2 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -303,7 +303,7 @@ sys_create_build_user()
_debug "--- [ $FUNCNAME ] ---"
- if [ $(getent group guixbuild) ]; then
+ if getent group guixbuild >/dev/null 2>&1; then
_msg "${INF}group guixbuild exists"
else
groupadd --system guixbuild
@@ -311,7 +311,7 @@ sys_create_build_user()
fi
for i in $(seq -w 1 10); do
- if id "guixbuilder${i}" &>/dev/null; then
+ if getent passwd "guixbuilder${i}" >/dev/null 2>&1; then
_msg "${INF}user is already in the system, reset"
usermod -g guixbuild -G guixbuild \
-d /var/empty -s "$(which nologin)" \
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 09/28] guix-install.sh: Fix requirements.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (6 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 08/28] guix-install.sh: Use getent for both user & group presence checking Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 10/28] guix-install.sh: Replace subshell-inducing command grouping Vincent Legoll
` (19 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
There's no usage of "tr" in the script, whereas tar is used.
* etc/guix-install.sh (REQUIRE): Change tr to tar, add ln, remove
readlink & dirname.
---
etc/guix-install.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index a56e0ec7b2..19883b89ae 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -33,8 +33,6 @@ set -e
[ "$UID" -eq 0 ] || { echo "This script must be run as root."; exit 1; }
REQUIRE=(
- "dirname"
- "readlink"
"wget"
"gpg"
"grep"
@@ -42,6 +40,7 @@ REQUIRE=(
"sed"
"sort"
"getent"
+ "ln"
"mktemp"
"rm"
"chmod"
@@ -49,7 +48,7 @@ REQUIRE=(
"groupadd"
"tail"
"realpath"
- "tr"
+ "tar"
"xz"
)
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 10/28] guix-install.sh: Replace subshell-inducing command grouping.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (7 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 09/28] guix-install.sh: Fix requirements Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 11/28] guix-install.sh: Use a variable for GPG key URL Vincent Legoll
` (18 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
* etc/guix-install.sh (chk_gpg_keyring): Replace () command grouping by {}.
---
etc/guix-install.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 19883b89ae..d2e44e98b2 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -110,11 +110,11 @@ chk_gpg_keyring()
# Without --dry-run this command will create a ~/.gnupg owned by root on
# systems where gpg has never been used, causing errors and confusion.
- gpg --dry-run --list-keys ${OPENPGP_SIGNING_KEY_ID} >/dev/null 2>&1 || (
- _err "${ERR}Missing OpenPGP public key. Fetch it with this command:"
- echo " wget https://sv.gnu.org/people/viewgpg.php?user_id=15145 -qO - | gpg --import -"
- exit 1
- )
+ gpg --dry-run --list-keys ${OPENPGP_SIGNING_KEY_ID} >/dev/null 2>&1 || {
+ _err "${ERR}Missing OpenPGP public key. Fetch it with this command:";
+ echo " wget https://sv.gnu.org/people/viewgpg.php?user_id=15145 -qO - | gpg --import -";
+ exit 1;
+ }
}
chk_term()
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 11/28] guix-install.sh: Use a variable for GPG key URL.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (8 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 10/28] guix-install.sh: Replace subshell-inducing command grouping Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 12/28] guix-install.sh: Rework user & group handling, adding busybox support Vincent Legoll
` (17 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
* etc/guix-install.sh (OPENPGP_SIGNING_KEY_URL): Add new variable.
(chk_gpg_keyring): Use it here.
---
etc/guix-install.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index d2e44e98b2..043357d9c4 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -59,6 +59,7 @@ INF="[ INFO ] "
DEBUG=0
GNU_URL="https://ftp.gnu.org/gnu/guix/"
OPENPGP_SIGNING_KEY_ID="3CE464558A84FDC69DB40CFB090B11993D9AEBB5"
+OPENPGP_SIGNING_KEY_URL="https://sv.gnu.org/people/viewgpg.php?user_id=15145"
# This script needs to know where root's home directory is. However, we
# cannot simply use the HOME environment variable, since there is no guarantee
@@ -112,7 +113,7 @@ chk_gpg_keyring()
# systems where gpg has never been used, causing errors and confusion.
gpg --dry-run --list-keys ${OPENPGP_SIGNING_KEY_ID} >/dev/null 2>&1 || {
_err "${ERR}Missing OpenPGP public key. Fetch it with this command:";
- echo " wget https://sv.gnu.org/people/viewgpg.php?user_id=15145 -qO - | gpg --import -";
+ echo " wget ${OPENPGP_SIGNING_KEY_URL} -qO - | gpg --import -";
exit 1;
}
}
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 12/28] guix-install.sh: Rework user & group handling, adding busybox support.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (9 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 11/28] guix-install.sh: Use a variable for GPG key URL Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 13/28] guix-install.sh: Make grep & mktemp usage compatible with busybox Vincent Legoll
` (16 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
* etc/guix-install.sh (REQUIRE): Remove groupadd, add comment.
(sys_create_build_user): Add adduser handling.
(sys_create_build_group): New function, add addgroup handling...
(main): ...call it here.
---
etc/guix-install.sh | 57 +++++++++++++++++++++++++++++++++------------
1 file changed, 42 insertions(+), 15 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 043357d9c4..d6966f851a 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -32,6 +32,8 @@ set -e
[ "$UID" -eq 0 ] || { echo "This script must be run as root."; exit 1; }
+# groupadd, useradd, usermod, adduser, addgroup are handled in:
+# sys_create_build_user & sys_create_build_group functions.
REQUIRE=(
"wget"
"gpg"
@@ -45,7 +47,6 @@ REQUIRE=(
"rm"
"chmod"
"uname"
- "groupadd"
"tail"
"realpath"
"tar"
@@ -298,31 +299,56 @@ sys_create_store()
_msg "${PAS}activated root profile at ${ROOT_HOME}/.config/guix/current"
}
-sys_create_build_user()
-{ # Create the group and user accounts for build users.
+sys_create_build_group()
+{ # Create the group for build users.
_debug "--- [ $FUNCNAME ] ---"
if getent group guixbuild >/dev/null 2>&1; then
- _msg "${INF}group guixbuild exists"
- else
+ _msg "${INF}group guixbuild already exists"
+ elif command -v groupadd &>/dev/null; then
groupadd --system guixbuild
_msg "${PAS}group <guixbuild> created"
+ elif command -v addgroup &>/dev/null; then
+ addgroup -S guixbuild
+ _msg "${PAS}group <guixbuild> created"
+ else
+ _err "${ERR}cannot add group for guix build users"
+ exit 1
fi
+}
+
+sys_create_build_user()
+{ # Create the user accounts for build users.
+
+ _debug "--- [ $FUNCNAME ] ---"
for i in $(seq -w 1 10); do
if getent passwd "guixbuilder${i}" >/dev/null 2>&1; then
- _msg "${INF}user is already in the system, reset"
- usermod -g guixbuild -G guixbuild \
- -d /var/empty -s "$(which nologin)" \
- -c "Guix build user $i" \
- "guixbuilder${i}";
+ if command -v usermod &>/dev/null; then
+ _msg "${INF}user is already in the system, resetting"
+ usermod -g guixbuild -G guixbuild \
+ -d /var/empty -s "$(which nologin)" \
+ -c "Guix build user $i" \
+ "guixbuilder${i}"
+ else
+ _msg "${ERR}cannot reset user environment, doing nothing"
+ fi
else
- useradd -g guixbuild -G guixbuild \
- -d /var/empty -s "$(which nologin)" \
- -c "Guix build user $i" --system \
- "guixbuilder${i}";
- _msg "${PAS}user added <guixbuilder${i}>"
+ if command -v useradd &>/dev/null; then
+ useradd -g guixbuild -G guixbuild \
+ -d /var/empty -s "$(which nologin)" \
+ -c "Guix build user $i" --system \
+ "guixbuilder${i}"
+ _msg "${PAS}user added <guixbuilder${i}>"
+ elif command -v adduser &>/dev/null; then
+ adduser -G guixbuild -h /var/empty -s "$(which nologin)" \
+ -H -S "guixbuilder${i}"
+ _msg "${PAS}user added <guixbuilder${i}>"
+ else
+ _msg "${ERR}cannot add user: <guixbuilder${i}>"
+ exit 1
+ fi
fi
done
}
@@ -509,6 +535,7 @@ main()
TARBALL="$(realpath $1)"
fi
sys_create_store "${TARBALL}" "${tmp_path}"
+ sys_create_build_group
sys_create_build_user
sys_enable_guix_daemon
sys_make_guix_available
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 13/28] guix-install.sh: Make grep & mktemp usage compatible with busybox.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (10 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 12/28] guix-install.sh: Rework user & group handling, adding busybox support Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 14/28] guix-install.sh: Make tar " Vincent Legoll
` (15 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
The regex is not using pcre-specific syntax.
Busybox requires the mktemp template to end with 6 "X". The longer template is
harmless for other systems.
* etc/guix-install.sh (guix_get_bin_list): Use grep -E instead of pcre.
(main): Use template that is accepted by busybox mktemp.
---
etc/guix-install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index d6966f851a..770ecfaf3f 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -219,7 +219,7 @@ guix_get_bin_list()
| sort -Vu)")
latest_ver="$(echo "$bin_ver_ls" \
- | grep -oP "([0-9]{1,2}\.){2}[0-9]{1,2}" \
+ | grep -oE "([0-9]{1,2}\.){2}[0-9]{1,2}" \
| tail -n1)"
default_ver="guix-binary-${latest_ver}.${ARCH_OS}"
@@ -525,7 +525,7 @@ main()
_msg "${INF}system is ${ARCH_OS}"
umask 0022
- tmp_path="$(mktemp -t -d guix.XXX)"
+ tmp_path="$(mktemp -t -d guix.XXXXXX)"
if [ -z "$1" ]; then
guix_get_bin_list "${GNU_URL}"
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 14/28] guix-install.sh: Make tar usage compatible with busybox.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (11 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 13/28] guix-install.sh: Make grep & mktemp usage compatible with busybox Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 15/28] guix-install.sh, guix-binary tarball: Handle openrc-based foreign distributions Vincent Legoll
` (14 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
The --warning option is not suported by busybox tar, but it does not emit missing
timestamps warnings anyways.
* etc/guix-install.sh (sys_create_store): Add --warning tar option only when
supported.
---
etc/guix-install.sh | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 770ecfaf3f..b5e8416610 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -274,10 +274,13 @@ sys_create_store()
_debug "--- [ $FUNCNAME ] ---"
- cd "$tmp_path"
- tar --warning=no-timestamp \
- --extract \
- --file "$pkg" &&
+ # Do not use the --warning option with busybox tar
+ TAROPTS=("-C" "${tmp_path}")
+ if tar c --warning=no-timestamp -f /dev/null /dev/null >&/dev/null; then
+ TAROPTS+=("--warning=no-timestamp")
+ fi
+
+ tar x -f "${pkg}" "${TAROPTS[@]}" &&
_msg "${PAS}unpacked archive"
if [[ -e "/var/guix" || -e "/gnu" ]]; then
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 15/28] guix-install.sh, guix-binary tarball: Handle openrc-based foreign distributions.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (12 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 14/28] guix-install.sh: Make tar " Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 16/28] non-interactive mode, usage Vincent Legoll
` (13 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
* .gitignore: Add etc/openrc/guix-daemon.in.
* etc/guix-install.sh (chk_init_sys): Add case to detect openrc.
(sys_enable_guix_daemon): Add case to setup guix-daemon within openrc.
* etc/openrc/guix-daemon.in: New file...
* nix/local.mk (etc/openrc/guix-daemon): Add target to generate
etc/openrc/guix-daemon from etc/openrc/guix-daemon.in.
(CLEANFILES): ...add it here. (nodist_openrcservice_DATA): New variable...
(openrcservicedir): New variable. (EXTRA_DIST): Add etc/openrc/guix-daemon.in.
---
.gitignore | 1 +
etc/guix-install.sh | 14 ++++++++++++++
etc/openrc/guix-daemon.in | 14 ++++++++++++++
nix/local.mk | 13 +++++++++++++
4 files changed, 42 insertions(+)
create mode 100644 etc/openrc/guix-daemon.in
diff --git a/.gitignore b/.gitignore
index 89a2c89e1e..6cd9fb4f17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -72,6 +72,7 @@
/etc/guix-publish.conf
/etc/guix-publish.service
/etc/init.d/guix-daemon
+/etc/openrc/guix-daemon
/etc/runit/run
/guix-daemon
/guix/config.scm
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index b5e8416610..1c22ae95ee 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -149,6 +149,10 @@ chk_init_sys()
_msg "${INF}init system is: systemd"
INIT_SYS="systemd"
return 0
+ elif [[ $(rc -V 2>/dev/null) =~ OpenRC ]]; then
+ _msg "${INF}init system is: openrc"
+ INIT_SYS="openrc"
+ return 0
elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then
_msg "${INF}init system is: sysv-init"
INIT_SYS="sysv-init"
@@ -396,6 +400,16 @@ sys_enable_guix_daemon()
ln -s /etc/sv/guix-daemon /etc/runit/runsvdir/default/; } &&
_msg "${PAS}enabled Guix daemon via runit"
;;
+ openrc)
+ { mkdir -p /etc/init.d;
+ cp "${ROOT_HOME}/.config/guix/current/lib/openrc/guix-daemon/guix-daemon" \
+ /etc/init.d/guix-daemon;
+ chmod 755 /etc/init.d/guix-daemon;
+
+ rc-update add guix-daemon default &&
+ rc-service guix-daemon start; } &&
+ _msg "${PAS}enabled Guix daemon via openrc"
+ ;;
sysv-init)
{ mkdir -p /etc/init.d;
cp "${ROOT_HOME}/.config/guix/current/etc/init.d/guix-daemon" \
diff --git a/etc/openrc/guix-daemon.in b/etc/openrc/guix-daemon.in
new file mode 100644
index 0000000000..9641dcfad6
--- /dev/null
+++ b/etc/openrc/guix-daemon.in
@@ -0,0 +1,14 @@
+#!/sbin/openrc-run
+
+# This is a service script file for the openrc init system to launch
+# 'guix-daemon'. Copy it as /etc/init.d/guix-daemon to have 'guix-daemon'
+# automatically started.
+
+command=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon
+command_args=--build-users-group=guixbuild
+command_background=true
+pidfile=/run/guix-daemon.pid
+
+GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale
+LC_ALL=en_US.utf8
+
diff --git a/nix/local.mk b/nix/local.mk
index 582ff16168..9d6f92ebc8 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -187,6 +187,17 @@ etc/runit/run: etc/runit/run.in \
"$<" > "$@.tmp"; \
mv "$@.tmp" "$@"
+# The service script for openrc.
+openrcservicedir = $(libdir)/openrc/guix-daemon
+nodist_openrcservice_DATA = etc/openrc/guix-daemon
+
+etc/openrc/guix-daemon: etc/openrc/guix-daemon.in \
+ $(top_builddir)/config.status
+ $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
+ $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \
+ "$<" > "$@.tmp"; \
+ mv "$@.tmp" "$@"
+
# The '.conf' jobs for Upstart.
upstartjobdir = $(libdir)/upstart/system
nodist_upstartjob_DATA = etc/guix-daemon.conf etc/guix-publish.conf
@@ -202,6 +213,7 @@ CLEANFILES += \
$(nodist_systemdservice_DATA) \
$(nodist_upstartjob_DATA) \
$(nodist_runitservice_DATA) \
+ $(nodist_openrcservice_DATA) \
$(nodist_sysvinitservice_DATA)
EXTRA_DIST += \
@@ -212,6 +224,7 @@ EXTRA_DIST += \
etc/guix-publish.service.in \
etc/guix-publish.conf.in \
etc/runit/run.in \
+ etc/openrc/guix-daemon.in \
etc/init.d/guix-daemon.in
if CAN_RUN_TESTS
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 16/28] non-interactive mode, usage
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (13 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 15/28] guix-install.sh, guix-binary tarball: Handle openrc-based foreign distributions Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 17/28] fix variable quoting in sys_make_guix_available Vincent Legoll
` (12 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 68 +++++++++++++++++++++++++++++++++------------
1 file changed, 51 insertions(+), 17 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 1c22ae95ee..7fb9332e97 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -48,7 +48,6 @@ REQUIRE=(
"chmod"
"uname"
"tail"
- "realpath"
"tar"
"xz"
)
@@ -454,17 +453,23 @@ sys_make_guix_available()
sys_authorize_build_farms()
{ # authorize the public key of the build farm
- while true; do
- read -p "Permit downloading pre-built package binaries from the project's build farm? (yes/no) " yn
- case $yn in
- [Yy]*) guix archive --authorize < "${ROOT_HOME}/.config/guix/current/share/guix/ci.guix.gnu.org.pub" &&
- _msg "${PAS}Authorized public key for ci.guix.gnu.org";
- break;;
- [Nn]*) _msg "${INF}Skipped authorizing build farm public keys"
- break;;
- *) _msg "Please answer yes or no.";
- esac
- done
+ _AUTHORIZE_BUILD_FARM=1
+ if [ "$1" -eq 1 ]; then
+ while true; do
+ read -p "Permit downloading pre-built package binaries from the project's build farm? (yes/no) " yn
+ case "$yn" in
+ [Yy]*) _AUTHORIZE_BUILD_FARM=1; break;;
+ [Nn]*) _AUTHORIZE_BUILD_FARM=0; break;;
+ *) _msg "Please answer yes or no.";;
+ esac
+ done
+ fi
+ if [ "$_AUTHORIZE_BUILD_FARM" -eq 1 ]; then
+ guix archive --authorize < "${ROOT_HOME}/.config/guix/current/share/guix/ci.guix.gnu.org.pub" &&
+ _msg "${PAS}Authorized public key for ci.guix.gnu.org";
+ else
+ _msg "${INF}Skipped authorizing build farm public keys"
+ fi
}
sys_create_init_profile()
@@ -526,10 +531,41 @@ EOF
read -r ANSWER
}
+# Do not change the tabs in the HERE-DOCUMENT
+usage()
+{
+ cat <<-EOF
+ $0: Wrong arguments:
+ $0 [-h|--help] [-n|--non-interactive] [LOCAL_GUIX_BIN_TARBALL]
+
+ -h|--help Show this help
+ -n|--non-interactive Avoid asing interactive question, run unattended
+ automatically allow substitutes from guix build farm
+
+ LOCAL_GUIX_BIN_TARBALL Use the given guix binary tarball file instead of
+ downloading latest released one
+EOF
+}
+
+handle_args()
+{
+ _INTERACTIVE=1
+ while [ "$#" -gt 0 ]; do
+ case "$1" in
+ -h|--help) usage; exit 0;;
+ -n|--non-interactive) _INTERACTIVE=0; shift 1;;
+
+ -*) echo "unknown option: $1" >&2; echo; usage; exit 1;;
+ *) TARBALL="$1"; shift 1;;
+ esac
+ done
+}
+
main()
{
local tmp_path
- welcome
+ handle_args "$@"
+ [ "${_INTERACTIVE}" -eq 1 ] && welcome
_msg "Starting installation ($(date))"
@@ -544,19 +580,17 @@ main()
umask 0022
tmp_path="$(mktemp -t -d guix.XXXXXX)"
- if [ -z "$1" ]; then
+ if [ -z "${TARBALL}" ]; then
guix_get_bin_list "${GNU_URL}"
guix_get_bin "${GNU_URL}" "${BIN_VER}" "${tmp_path}"
TARBALL="${BIN_VER}.tar.xz"
- else
- TARBALL="$(realpath $1)"
fi
sys_create_store "${TARBALL}" "${tmp_path}"
sys_create_build_group
sys_create_build_user
sys_enable_guix_daemon
sys_make_guix_available
- sys_authorize_build_farms
+ sys_authorize_build_farms "${_INTERACTIVE}"
sys_create_init_profile
_msg "${INF}cleaning up ${tmp_path}"
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 17/28] fix variable quoting in sys_make_guix_available
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (14 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 16/28] non-interactive mode, usage Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 18/28] Replace the use of "which" by "command -v" Vincent Legoll
` (11 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 7fb9332e97..e350fdb052 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -446,7 +446,7 @@ sys_make_guix_available()
ln -sf "${var_guix}/bin/guix" "$local_bin"
[ -e "$info_path" ] || mkdir -p "$info_path"
- for i in ${var_guix}/share/info/*; do
+ for i in "${var_guix}"/share/info/*; do
ln -sf "$i" "$info_path"
done
}
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 18/28] Replace the use of "which" by "command -v"
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (15 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 17/28] fix variable quoting in sys_make_guix_available Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 19/28] Remove &> and >& bashisms Vincent Legoll
` (10 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index e350fdb052..596ceb5b39 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -38,7 +38,6 @@ REQUIRE=(
"wget"
"gpg"
"grep"
- "which"
"sed"
"sort"
"getent"
@@ -329,12 +328,13 @@ sys_create_build_user()
_debug "--- [ $FUNCNAME ] ---"
+ NOLOGIN_SHELL="$(command -v nologin)"
for i in $(seq -w 1 10); do
if getent passwd "guixbuilder${i}" >/dev/null 2>&1; then
if command -v usermod &>/dev/null; then
_msg "${INF}user is already in the system, resetting"
usermod -g guixbuild -G guixbuild \
- -d /var/empty -s "$(which nologin)" \
+ -d /var/empty -s "${NOLOGIN_SHELL}" \
-c "Guix build user $i" \
"guixbuilder${i}"
else
@@ -343,12 +343,12 @@ sys_create_build_user()
else
if command -v useradd &>/dev/null; then
useradd -g guixbuild -G guixbuild \
- -d /var/empty -s "$(which nologin)" \
+ -d /var/empty -s "${NOLOGIN_SHELL}" \
-c "Guix build user $i" --system \
"guixbuilder${i}"
_msg "${PAS}user added <guixbuilder${i}>"
elif command -v adduser &>/dev/null; then
- adduser -G guixbuild -h /var/empty -s "$(which nologin)" \
+ adduser -G guixbuild -h /var/empty -s "${NOLOGIN_SHELL}" \
-H -S "guixbuilder${i}"
_msg "${PAS}user added <guixbuilder${i}>"
else
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 19/28] Remove &> and >& bashisms
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (16 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 18/28] Replace the use of "which" by "command -v" Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 20/28] Add missing variable quoting & curly-bracketing for dl_path Vincent Legoll
` (9 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 596ceb5b39..5b82999bc5 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -94,7 +94,7 @@ chk_require()
_debug "--- [ $FUNCNAME ] ---"
for c in "$@"; do
- command -v "$c" &>/dev/null || warn+=("$c")
+ command -v "$c" >/dev/null 2>&1 || warn+=("$c")
done
[ "${#warn}" -ne 0 ] &&
@@ -278,7 +278,7 @@ sys_create_store()
# Do not use the --warning option with busybox tar
TAROPTS=("-C" "${tmp_path}")
- if tar c --warning=no-timestamp -f /dev/null /dev/null >&/dev/null; then
+ if tar c --warning=no-timestamp -f /dev/null /dev/null >/dev/null 2>&1; then
TAROPTS+=("--warning=no-timestamp")
fi
@@ -311,10 +311,10 @@ sys_create_build_group()
if getent group guixbuild >/dev/null 2>&1; then
_msg "${INF}group guixbuild already exists"
- elif command -v groupadd &>/dev/null; then
+ elif command -v groupadd >/dev/null 2>&1; then
groupadd --system guixbuild
_msg "${PAS}group <guixbuild> created"
- elif command -v addgroup &>/dev/null; then
+ elif command -v addgroup >/dev/null 2>&1; then
addgroup -S guixbuild
_msg "${PAS}group <guixbuild> created"
else
@@ -331,7 +331,7 @@ sys_create_build_user()
NOLOGIN_SHELL="$(command -v nologin)"
for i in $(seq -w 1 10); do
if getent passwd "guixbuilder${i}" >/dev/null 2>&1; then
- if command -v usermod &>/dev/null; then
+ if command -v usermod >/dev/null 2>&1; then
_msg "${INF}user is already in the system, resetting"
usermod -g guixbuild -G guixbuild \
-d /var/empty -s "${NOLOGIN_SHELL}" \
@@ -341,13 +341,13 @@ sys_create_build_user()
_msg "${ERR}cannot reset user environment, doing nothing"
fi
else
- if command -v useradd &>/dev/null; then
+ if command -v useradd >/dev/null 2>&1; then
useradd -g guixbuild -G guixbuild \
-d /var/empty -s "${NOLOGIN_SHELL}" \
-c "Guix build user $i" --system \
"guixbuilder${i}"
_msg "${PAS}user added <guixbuilder${i}>"
- elif command -v adduser &>/dev/null; then
+ elif command -v adduser >/dev/null 2>&1; then
adduser -G guixbuild -h /var/empty -s "${NOLOGIN_SHELL}" \
-H -S "guixbuilder${i}"
_msg "${PAS}user added <guixbuilder${i}>"
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 20/28] Add missing variable quoting & curly-bracketing for dl_path
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (17 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 19/28] Remove &> and >& bashisms Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 21/28] Remove unused variable Vincent Legoll
` (8 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 5b82999bc5..7616f3b82f 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -249,7 +249,7 @@ guix_get_bin()
wget --help | grep -q '\--show-progress' && \
_PROGRESS_OPT="-q --show-progress" || _PROGRESS_OPT=""
- wget $_PROGRESS_OPT -P "$dl_path" "${url}/${bin_ver}.tar.xz" "${url}/${bin_ver}.tar.xz.sig"
+ wget $_PROGRESS_OPT -P "${dl_path}" "${url}/${bin_ver}.tar.xz" "${url}/${bin_ver}.tar.xz.sig"
if [[ "$?" -eq 0 ]]; then
_msg "${PAS}download completed."
@@ -258,7 +258,7 @@ guix_get_bin()
exit 1
fi
- pushd $dl_path >/dev/null
+ pushd "${dl_path}" >/dev/null
gpg --verify "${bin_ver}.tar.xz.sig" >/dev/null 2>&1
if [[ "$?" -eq 0 ]]; then
_msg "${PAS}Signature is valid."
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 21/28] Remove unused variable
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (18 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 20/28] Add missing variable quoting & curly-bracketing for dl_path Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 22/28] Remove local bashisms Vincent Legoll
` (7 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 4 ----
1 file changed, 4 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 7616f3b82f..078081c08a 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -119,16 +119,12 @@ chk_gpg_keyring()
chk_term()
{ # Check for ANSI terminal for color printing.
- local ansi_term
-
if [ -t 2 ]; then
if [ "${TERM+set}" = 'set' ]; then
case "$TERM" in
xterm*|rxvt*|urxvt*|linux*|vt*|eterm*|screen*)
- ansi_term=true
;;
*)
- ansi_term=false
ERR="[ FAIL ] "
PAS="[ PASS ] "
;;
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 22/28] Remove local bashisms
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (19 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 21/28] Remove unused variable Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 23/28] Remove $UID bashism Vincent Legoll
` (6 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 33 +++++++++++----------------------
1 file changed, 11 insertions(+), 22 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 078081c08a..c7144288c9 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -89,7 +89,6 @@ _debug()
chk_require()
{ # Check that every required command is available.
declare -a warn
- local c
_debug "--- [ $FUNCNAME ] ---"
@@ -163,24 +162,22 @@ chk_init_sys()
chk_sys_arch()
{ # Check for operating system and architecture type.
- local os
- local arch
os="$(uname -s)"
arch="$(uname -m)"
case "$arch" in
i386 | i486 | i686 | i786 | x86)
- local arch=i686
+ arch=i686
;;
x86_64 | x86-64 | x64 | amd64)
- local arch=x86_64
+ arch=x86_64
;;
aarch64)
- local arch=aarch64
+ arch=aarch64
;;
armv7l)
- local arch=armhf
+ arch=armhf
;;
*)
_err "${ERR}Unsupported CPU type: ${arch}"
@@ -189,7 +186,7 @@ chk_sys_arch()
case "$os" in
Linux | linux)
- local os=linux
+ os=linux
;;
*)
_err "${ERR}Your operation system (${os}) is not supported."
@@ -204,10 +201,7 @@ chk_sys_arch()
guix_get_bin_list()
{ # Scan GNU archive and save list of binaries
- local gnu_url="$1"
- local -a bin_ver_ls
- local latest_ver
- local default_ver
+ gnu_url="$1"
_debug "--- [ $FUNCNAME ] ---"
@@ -235,9 +229,9 @@ guix_get_bin_list()
guix_get_bin()
{ # Download and verify binary package.
- local url="$1"
- local bin_ver="$2"
- local dl_path="$3"
+ url="$1"
+ bin_ver="$2"
+ dl_path="$3"
_debug "--- [ $FUNCNAME ] ---"
@@ -267,8 +261,8 @@ guix_get_bin()
sys_create_store()
{ # Unpack and install /gnu/store and /var/guix
- local pkg="$1"
- local tmp_path="$2"
+ pkg="$1"
+ tmp_path="$2"
_debug "--- [ $FUNCNAME ] ---"
@@ -426,10 +420,6 @@ sys_enable_guix_daemon()
sys_make_guix_available()
{ # add guix into PATH
- local info_path
- local local_bin
- local var_guix
-
_debug "--- [ $FUNCNAME ] ---"
info_path="/usr/local/share/info"
@@ -559,7 +549,6 @@ handle_args()
main()
{
- local tmp_path
handle_args "$@"
[ "${_INTERACTIVE}" -eq 1 ] && welcome
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 23/28] Remove $UID bashism
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (20 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 22/28] Remove local bashisms Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 24/28] Remove some "[[" bashisms Vincent Legoll
` (5 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index c7144288c9..431790709a 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -30,7 +30,7 @@ fi
set -e
-[ "$UID" -eq 0 ] || { echo "This script must be run as root."; exit 1; }
+[ "$(id -u)" -eq 0 ] || { echo "This script must be run as root."; exit 1; }
# groupadd, useradd, usermod, adduser, addgroup are handled in:
# sys_create_build_user & sys_create_build_group functions.
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 24/28] Remove some "[[" bashisms
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (21 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 23/28] Remove $UID bashism Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 25/28] Remove unused variable set by "read" Vincent Legoll
` (4 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 431790709a..cd33bf55bf 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -216,7 +216,7 @@ guix_get_bin_list()
default_ver="guix-binary-${latest_ver}.${ARCH_OS}"
- if [[ "${#bin_ver_ls}" -ne "0" ]]; then
+ if [ "${#bin_ver_ls}" -ne 0 ]; then
_msg "${PAS}Release for your system: ${default_ver}"
else
_err "${ERR}Could not obtain list of Guix releases."
@@ -241,7 +241,7 @@ guix_get_bin()
_PROGRESS_OPT="-q --show-progress" || _PROGRESS_OPT=""
wget $_PROGRESS_OPT -P "${dl_path}" "${url}/${bin_ver}.tar.xz" "${url}/${bin_ver}.tar.xz.sig"
- if [[ "$?" -eq 0 ]]; then
+ if [ "$?" -eq 0 ]; then
_msg "${PAS}download completed."
else
_err "${ERR}could not download ${url}/${bin_ver}.tar.xz."
@@ -250,7 +250,7 @@ guix_get_bin()
pushd "${dl_path}" >/dev/null
gpg --verify "${bin_ver}.tar.xz.sig" >/dev/null 2>&1
- if [[ "$?" -eq 0 ]]; then
+ if [ "$?" -eq 0 ]; then
_msg "${PAS}Signature is valid."
popd >/dev/null
else
@@ -275,7 +275,7 @@ sys_create_store()
tar x -f "${pkg}" "${TAROPTS[@]}" &&
_msg "${PAS}unpacked archive"
- if [[ -e "/var/guix" || -e "/gnu" ]]; then
+ if [ -e "/var/guix" ] || [ -e "/gnu" ]; then
_err "${ERR}A previous Guix installation was found. Refusing to overwrite."
exit 1
else
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 25/28] Remove unused variable set by "read"
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (22 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 24/28] Remove some "[[" bashisms Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 26/28] Add _debug_func() helper function Vincent Legoll
` (3 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index cd33bf55bf..38f61de2f7 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -514,7 +514,7 @@ This script installs GNU Guix on your system
https://www.gnu.org/software/guix/
EOF
echo -n "Press return to continue..."
- read -r ANSWER
+ read -r
}
# Do not change the tabs in the HERE-DOCUMENT
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 26/28] Add _debug_func() helper function
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (23 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 25/28] Remove unused variable set by "read" Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 27/28] Fix variable use in guix_get_bin_list() Vincent Legoll
` (2 subsequent siblings)
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 38f61de2f7..4ee350a155 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -85,12 +85,17 @@ _debug()
fi
}
+_debug_func()
+{
+ # Display _debug_func() caller's function name
+ _debug "--- [ ${FUNCNAME[1]} ] ---"
+}
chk_require()
{ # Check that every required command is available.
declare -a warn
- _debug "--- [ $FUNCNAME ] ---"
+ _debug_func
for c in "$@"; do
command -v "$c" >/dev/null 2>&1 || warn+=("$c")
@@ -105,7 +110,7 @@ chk_require()
chk_gpg_keyring()
{ # Check whether the Guix release signing public key is present.
- _debug "--- [ $FUNCNAME ] ---"
+ _debug_func
# Without --dry-run this command will create a ~/.gnupg owned by root on
# systems where gpg has never been used, causing errors and confusion.
@@ -203,7 +208,7 @@ guix_get_bin_list()
{ # Scan GNU archive and save list of binaries
gnu_url="$1"
- _debug "--- [ $FUNCNAME ] ---"
+ _debug_func
# Filter only version and architecture
bin_ver_ls=("$(wget -qO- "$gnu_url" \
@@ -233,7 +238,7 @@ guix_get_bin()
bin_ver="$2"
dl_path="$3"
- _debug "--- [ $FUNCNAME ] ---"
+ _debug_func
_msg "${INF}Downloading Guix release archive"
@@ -264,7 +269,7 @@ sys_create_store()
pkg="$1"
tmp_path="$2"
- _debug "--- [ $FUNCNAME ] ---"
+ _debug_func
# Do not use the --warning option with busybox tar
TAROPTS=("-C" "${tmp_path}")
@@ -297,7 +302,7 @@ sys_create_store()
sys_create_build_group()
{ # Create the group for build users.
- _debug "--- [ $FUNCNAME ] ---"
+ _debug_func
if getent group guixbuild >/dev/null 2>&1; then
_msg "${INF}group guixbuild already exists"
@@ -316,7 +321,7 @@ sys_create_build_group()
sys_create_build_user()
{ # Create the user accounts for build users.
- _debug "--- [ $FUNCNAME ] ---"
+ _debug_func
NOLOGIN_SHELL="$(command -v nologin)"
for i in $(seq -w 1 10); do
@@ -352,7 +357,7 @@ sys_create_build_user()
sys_enable_guix_daemon()
{ # Run the daemon, and set it to automatically start on boot.
- _debug "--- [ $FUNCNAME ] ---"
+ _debug_func
case "$INIT_SYS" in
upstart)
@@ -420,7 +425,7 @@ sys_enable_guix_daemon()
sys_make_guix_available()
{ # add guix into PATH
- _debug "--- [ $FUNCNAME ] ---"
+ _debug_func
info_path="/usr/local/share/info"
local_bin="/usr/local/bin"
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 27/28] Fix variable use in guix_get_bin_list()
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (24 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 26/28] Add _debug_func() helper function Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-17 17:17 ` [bug#40601] [PATCH 28/28] Remove "[[" bashisms in chk_init_sys() Vincent Legoll
2020-05-23 12:36 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Tobias Geerinckx-Rice via Guix-patches via
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
- Add missing curly-brackets
- Add implicit array zero-indexing
---
etc/guix-install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 4ee350a155..be2fd74905 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -215,7 +215,7 @@ guix_get_bin_list()
| sed -n -e 's/.*guix-binary-\([0-9.]*\)\..*.tar.xz.*/\1/p' \
| sort -Vu)")
- latest_ver="$(echo "$bin_ver_ls" \
+ latest_ver="$(echo "${bin_ver_ls[0]}" \
| grep -oE "([0-9]{1,2}\.){2}[0-9]{1,2}" \
| tail -n1)"
@@ -229,7 +229,7 @@ guix_get_bin_list()
fi
# Use default to download according to the list and local ARCH_OS.
- BIN_VER="$default_ver"
+ BIN_VER="${default_ver}"
}
guix_get_bin()
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 28/28] Remove "[[" bashisms in chk_init_sys()
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (25 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 27/28] Fix variable use in guix_get_bin_list() Vincent Legoll
@ 2020-05-17 17:17 ` Vincent Legoll
2020-05-23 12:36 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Tobias Geerinckx-Rice via Guix-patches via
27 siblings, 0 replies; 64+ messages in thread
From: Vincent Legoll @ 2020-05-17 17:17 UTC (permalink / raw)
To: 40601; +Cc: Vincent Legoll
---
etc/guix-install.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index be2fd74905..45b4c4b720 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -139,23 +139,23 @@ chk_term()
chk_init_sys()
{ # Return init system type name.
- if [[ $(/sbin/init --version 2>/dev/null) =~ upstart ]]; then
+ if /sbin/init --version 2>/dev/null | grep -q upstart; then
_msg "${INF}init system is: upstart"
INIT_SYS="upstart"
return 0
- elif [[ $(systemctl 2>/dev/null) =~ -\.mount ]]; then
+ elif systemctl 2>/dev/null | grep -q -- -\.mount; then
_msg "${INF}init system is: systemd"
INIT_SYS="systemd"
return 0
- elif [[ $(rc -V 2>/dev/null) =~ OpenRC ]]; then
+ elif rc -V 2>/dev/null | grep -q OpenRC; then
_msg "${INF}init system is: openrc"
INIT_SYS="openrc"
return 0
- elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then
+ elif [ -f /etc/init.d/cron ] && [ ! -h /etc/init.d/cron ]; then
_msg "${INF}init system is: sysv-init"
INIT_SYS="sysv-init"
return 0
- elif [[ -d /etc/sv ]]; then
+ elif [ -d /etc/sv ]; then
_msg "${INF}init system is: runit"
INIT_SYS="runit"
return 0
--
2.26.2
^ permalink raw reply related [flat|nested] 64+ messages in thread
* [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section.
2020-05-17 17:16 ` [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section Vincent Legoll
` (26 preceding siblings ...)
2020-05-17 17:17 ` [bug#40601] [PATCH 28/28] Remove "[[" bashisms in chk_init_sys() Vincent Legoll
@ 2020-05-23 12:36 ` Tobias Geerinckx-Rice via Guix-patches via
27 siblings, 0 replies; 64+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-05-23 12:36 UTC (permalink / raw)
To: Vincent Legoll; +Cc: 40601
[-- Attachment #1: Type: text/plain, Size: 104 bytes --]
Vincent Legoll 写道:
> * nix/local.mk (sysvinit): Add comment.
LGTM.
Kind regards,
T G-R
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 64+ messages in thread