guix-install.sh: port to other distros & init systems

OpenSubmitted by Vincent Legoll.
Details
7 participants
  • jgart
  • Julien Lepiller
  • Leo Famulari
  • Christopher Baines
  • Tobias Geerinckx-Rice
  • Vincent Legoll
  • zimoun
Owner
unassigned
Severity
normal
V
V
Vincent Legoll wrote on 13 Apr 2020 18:04
[PATCH 0/5] Handle runit-based foreign distributions
(address . guix-patches@gnu.org)
58b21d29-f0b0-af8a-8c9e-11f4dd7a317a@gmail.com
And assorted small fixes around the subject.

The first 3 patches are smallish things.

Maybe the REQUIRED array could get other
missing requirements: tar (or maybe the "tr"
item is a typoed tar, I've found no use of tr),
mkdir, ln, usermod, useradd, cp, cat...

The handling of local files for guix-install.sh is to
help testing modified / locally generated binary
tarballs.

One thing that is working as-is, but that I'm not sure
is right: The runit script in the guix-binary tarball is
patched for the shebang to point to /gnu/store/...

This looks wrong even if it is working, the interpreter
for that script should be the one of the foreign distro.

But this is not specific to the runit support, the sysv
scripts also are shebang-patched.

How would I tell guix not to patch these files's shebangs ?

WDYT ?

This series has been tested on void linux i686 in qemu
kvm with:

- upload locally build guix-binary tarball & guix-install.sh
to VM
- run guix-install.sh guix-binary.i686-linux.tar.xz

1) guix search hello
2) guix show hello
3) guix build hello
4) guix gc -D/gnu/store/*hello*
5) guix build --no-substitutes hello (stopped as it was rebuilding the world)
6) guix package -u
7) guix pull
8) guix package -u
9) guix gc


So the download part is not tested, but all ran well.

--
Vincent Legoll
V
V
Vincent Legoll wrote on 13 Apr 2020 18:07
[PATCH 2/5] guix-install.sh: Add xz to requirements.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200413160740.19584-2-vincent.legoll@gmail.com
* etc/guix-install.sh (REQUIRE): Add xz to requirements list.
---
etc/guix-install.sh | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
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.0
V
V
Vincent Legoll wrote on 13 Apr 2020 18:07
[PATCH 3/5] guix-install.sh: Fix systemctl not found error message at probe.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200413160740.19584-3-vincent.legoll@gmail.com
* 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(-)

Toggle diff (15 lines)
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.0
V
V
Vincent Legoll wrote on 13 Apr 2020 18:07
[PATCH 4/5] guix-install.sh: Handle local binary tarball file.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200413160740.19584-4-vincent.legoll@gmail.com
* 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(-)

Toggle diff (41 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 4fa9664cf5..0d15a05cb4 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.0
V
V
Vincent Legoll wrote on 13 Apr 2020 18:07
[PATCH 1/5] nix/local.mk: Add missing comment to sysvinit section.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200413160740.19584-1-vincent.legoll@gmail.com
* nix/local.mk (sysvinit): Add comment.
---
nix/local.mk | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
diff --git a/nix/local.mk b/nix/local.mk
index a64bdd2137..412d89ba3d 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -164,6 +164,7 @@ etc/guix-%.service: etc/guix-%.service.in	\
 	       "$<" > "$@.tmp";		\
 	mv "$@.tmp" "$@"
 
+# The service script for sysvinit.
 sysvinitservicedir = $(sysconfdir)/init.d
 nodist_sysvinitservice_DATA = etc/init.d/guix-daemon
 
-- 
2.26.0
V
V
Vincent Legoll wrote on 13 Apr 2020 18:07
[PATCH 5/5] guix-install.sh, guix-binary tarball: Handle runit-based foreign distributions.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200413160740.19584-5-vincent.legoll@gmail.com
* .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 | 13 +++++++++++++
4 files changed, 40 insertions(+)
create mode 100644 etc/runit/run.in

Toggle diff (102 lines)
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 0d15a05cb4..06590ee97f 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..877ddcc281 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -175,6 +175,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 +200,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 +210,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.0
V
V
Vincent Legoll wrote on 14 Apr 2020 00:22
[PATCH v2] Re: Add how to create a runit service in step 5 of binary installation manual
(name . Foxmean)(address . foxmean@protonmail.com)
46fe93c6-6d19-fab8-8810-37f36d5f1344@gmail.com
Hello,


as I recently worked on the same subject in [1],

I reviewed and amended the documentation patch [2].





--

Vincent Legoll
V
V
Vincent Legoll wrote on 14 Apr 2020 00:29
(name . Foxmean)(address . foxmean@protonmail.com)
712fb208-43c4-6a30-b0c8-04198a51db8f@gmail.com
On 14/04/2020 00:22, Vincent Legoll wrote:
Toggle quote (13 lines)
> Hello,
>
>
> as I recently worked on the same subject in [1],
>
> I reviewed and amended the documentation patch [2].
>
>
> [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40601
>
> [2] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=37624
>

And now with the patch...
From 6b656a54ef7a17fdbd5f82ceaeb98198e2c241af Mon Sep 17 00:00:00 2001
From: Pathompong Kwangtong <foxmean@protonmail.com>
Date: Sun, 13 Oct 2019 01:24:48 +0700
Subject: [PATCH] doc: Add Runit init system in guix installation.

* doc/guix.texi (Binary Installation): Add runit section.
* .mailmap: Add author email adress.

Co-authored-by: Vincent Legoll <vincent.legoll@gmail.com>
---
.mailmap | 1 +
doc/guix.texi | 30 ++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)

Toggle diff (62 lines)
diff --git a/.mailmap b/.mailmap
index 97018775f6..aa5227b91d 100644
--- a/.mailmap
+++ b/.mailmap
@@ -62,6 +62,7 @@ ng0 <ng0@n0.is> <ngillmann@runbox.com>
 ng0 <ng0@n0.is> <niasterisk@grrlz.net>
 ng0 <ng0@n0.is> <ng@niasterisk.space>
 ng0 <ng0@n0.is> <ng0@libertad.pw>
+Pathompong Kwangtong <foxmean@protonmail.com>
 Pierre Neidhardt <mail@ambrevar.xyz>
 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
 Pjotr Prins <pjotr.guix@thebird.nl> <pjotr.public01@thebird.nl>
diff --git a/doc/guix.texi b/doc/guix.texi
index 8bf4ef9b74..94cb89eddf 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -71,6 +71,7 @@ Copyright @copyright{} 2019 Alex Griffin@*
 Copyright @copyright{} 2019 Guillaume Le Vaillant@*
 Copyright @copyright{} 2020 Leo Prikler@*
 Copyright @copyright{} 2019, 2020 Simon Tournier@*
+Copyright @copyright{} 2019 Pathompong Kwangtong@*
 Copyright @copyright{} 2020 Wiktor Żelazny@*
 Copyright @copyright{} 2020 Damien Cassou@*
 Copyright @copyright{} 2020 Jakub Kądziołka@*
@@ -664,6 +665,35 @@ If your host distro uses the Upstart init system:
 # start guix-daemon
 @end example
 
+If your host distro use the Runit init system:
+
+@example
+# mkdir /etc/sv/guix-daemon
+@end example
+
+Then create the guix-daemon runit launch script:
+
+@example
+# cat > /etc/sv/guix-daemon/run <<EOF
+#!/bin/sh
+
+GUIX_LOCPATH=/var/guix/profiles/per-user/root/guix-profile/lib/locale
+LC_ALL=en_US.utf8
+
+export GUIX_LOCPATH LC_ALL
+
+exec /var/guix/profiles/per-user/root/current-guix/bin/guix-daemon \
+  --build-users-group=guixbuild
+EOF
+@end example
+
+Now, you can enable and start the guix-daemon service with:
+
+@example
+# ln -s /etc/sv/guix-daemon /etc/runit/runsvdir/default/
+# sv up guix-daemon
+@end example
+
 Otherwise, you can still start the daemon manually with:
 
 @example
-- 
2.20.1
V
V
Vincent Legoll wrote on 14 Apr 2020 12:40
Re: [bug#39329] [PATCH v4 0/2] Start guix-daemon on SysV.
4d13d72e-16ab-a25d-f7a9-263d35cca1a9@gmail.com
Hello,


I now have tested the patch series in #40601

also on latest devuan-sysvinit x86_64.


On 13/04/2020 20:21, Leo Famulari wrote:
Toggle quote (12 lines)
> On Mon, Apr 13, 2020 at 08:08:29PM +0200, Danny Milosavljevic wrote:
>> I don't know whether it actually works.
>>
>> I don't feel great just closing this because of that.
> Okay, feel free to reopen if you want [0]
>
>> I mean SysV is kinda outdated, so I wouldn't even know how to test it myself.
>> Would Devuan work?
>> Or Redhat 6/CentOS 6?
> I'm sure we will get some bug reports if it doesn't work for them.


Here's the first one: ;-)

the sysvinit init.d script relies on "daemonize" which is not

installed by default on devuan.


Would fixing it by checking a second round of REQUIRED_BY_INIT

after checking the init type be the right way ?


Or should I report an issue about that ?


But if daemonize is installed, the sysvinit support works

as expected, and I can run guix commands as for the

other tests I did.


Thanks


--

Vincent Legoll
V
V
Vincent Legoll wrote on 23 Apr 2020 13:55
Re: bug#39023: binary installation manual doesn't work on Alpine Linux
(address . 39023@debbugs.gnu.org)
b041d4ae-0457-02f4-3f31-9a1a1a111e0e@gmail.com
Hello,

as I had been working on the installer lately [1],
I tried to tackle this bug also, I have it mostly
working.

I added support for openrc-based init systems.

I opted to support both adduser & useradd, changed
some tool calls to work on busybox, etc... Then
sprinkled a bit of cleanup & polish over the top.

It's not finished, because I could not test it. I
have a problem building the binary-tarball since I
switched to the 1.1.0 release and I've yet to try
to build on an earlier version.

Stay tuned, patches incoming for review.


--
Vincent Legoll
Z
Z
zimoun wrote on 23 Apr 2020 15:29
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
CAJ3okZ25BEr5vHRgFqjjP6fz4v-kOWiYVxCgyRZE+=+czhR0og@mail.gmail.com
Hi Vincent,

On Thu, 23 Apr 2020 at 13:55, Vincent Legoll <vincent.legoll@gmail.com> wrote:

Toggle quote (19 lines)
> as I had been working on the installer lately [1],
> I tried to tackle this bug also, I have it mostly
> working.
>
> I added support for openrc-based init systems.
>
> I opted to support both adduser & useradd, changed
> some tool calls to work on busybox, etc... Then
> sprinkled a bit of cleanup & polish over the top.
>
> It's not finished, because I could not test it. I
> have a problem building the binary-tarball since I
> switched to the 1.1.0 release and I've yet to try
> to build on an earlier version.
>
> Stay tuned, patches incoming for review.
>
> [1] https://issues.guix.gnu.org/40601

Do you mean that the incoming patches will include an explanation in
the manual about adduser/useradd?
Do you mean that guix-install.sh will now include a conditional test
on the kind of foreign distibution to use adduser or useradd?


Thank you for working on that.

Cheers,
simon
V
V
Vincent Legoll wrote on 17 May 2020 18:55
retitle: guix-install.sh port to other distros
(address . control@debbugs.gnu.org)
59180167-87d6-ee82-2ae8-4d29d7977e5f@gmail.com
retitle 40601 guix-install.sh: port to other distros & init systems
V
V
Vincent Legoll wrote on 17 May 2020 19:15
[RFC, PATCH 0/28] guix-install.sh: port to other distros & init systems
(address . 40601@debbugs.gnu.org)
12af851d-73b6-5865-8950-857c2158d41e@gmail.com
Hello,

Here is a RFC series of patches that add a few things:

- small fixes & cleanups
- removing some (not all) bashisms
- non-interactive mode (useful for (semi-) automated
testing)
- openrc init system support
- runit init system support
- busybox compatibility (for alpine support)
- handle local guix-binary.${ARCH}.tar.xz file (useful
for (semi-) automated testing)
- requirements fixes

It currently has been tested on a range of distros/arches
but the latest patches are still not polished (missing
proper commit messages)

The series is RFC as a few questions remain for me:

- Do we want to support alien (aka foreign++) distros
(different shells, different init systems, etc...)
- To what extent
- Are the patches too fine-grained (I personally like
them smallish)

Future, additionnal work items:
- s6 (adelie / obarun) init support
- handle GPG downloading in non-interactive mode
- being able to cross-build & test them on other
arches again (dunno why it broke)
- documentation
- add missing guix-publish services
- add missing RO remounting the store on other distros
- removing allremaining bashisms (being shellcheck clean
maybe ?)

This is to gather input before investing too much time.

For example, do we want to commit part of this now, with
the rest coming later ?

Any feedback ?
On individual patch(es) or on the whole series goal...

Thanks for reading this far.

--
Vincent Legoll
V
V
Vincent Legoll wrote on 17 May 2020 19:16
[PATCH 02/28] guix-install.sh: Add xz to requirements.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-2-vincent.legoll@gmail.com
* etc/guix-install.sh (REQUIRE): Add xz to requirements list.
---
etc/guix-install.sh | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 03/28] guix-install.sh: Fix systemctl not found error message at probe.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-3-vincent.legoll@gmail.com
* 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(-)

Toggle diff (15 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 04/28] guix-install.sh: Handle local binary tarball file.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-4-vincent.legoll@gmail.com
* 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(-)

Toggle diff (41 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:16
[PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-1-vincent.legoll@gmail.com
* nix/local.mk (sysvinit): Add comment.
---
nix/local.mk | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
diff --git a/nix/local.mk b/nix/local.mk
index a64bdd2137..412d89ba3d 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -164,6 +164,7 @@ etc/guix-%.service: etc/guix-%.service.in	\
 	       "$<" > "$@.tmp";		\
 	mv "$@.tmp" "$@"
 
+# The service script for sysvinit.
 sysvinitservicedir = $(sysconfdir)/init.d
 nodist_sysvinitservice_DATA = etc/init.d/guix-daemon
 
-- 
2.26.2
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 06/28] guix-install.sh: trivial whitespace fix.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-6-vincent.legoll@gmail.com
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(-)

Toggle diff (43 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 07/28] guix-install.sh: Move code in a new function.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-7-vincent.legoll@gmail.com
* 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(-)

Toggle diff (58 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 08/28] guix-install.sh: Use getent for both user & group presence checking.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-8-vincent.legoll@gmail.com
* 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(-)

Toggle diff (24 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 05/28] guix-install.sh, guix-binary tarball: Handle runit-based foreign distributions.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-5-vincent.legoll@gmail.com
* .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

Toggle diff (110 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 10/28] guix-install.sh: Replace subshell-inducing command grouping.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-10-vincent.legoll@gmail.com
* etc/guix-install.sh (chk_gpg_keyring): Replace () command grouping by {}.
---
etc/guix-install.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

Toggle diff (23 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 12/28] guix-install.sh: Rework user & group handling, adding busybox support.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-12-vincent.legoll@gmail.com
* 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(-)

Toggle diff (102 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 09/28] guix-install.sh: Fix requirements.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-9-vincent.legoll@gmail.com
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(-)

Toggle diff (32 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 13/28] guix-install.sh: Make grep & mktemp usage compatible with busybox.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-13-vincent.legoll@gmail.com
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(-)

Toggle diff (24 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 14/28] guix-install.sh: Make tar usage compatible with busybox.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-14-vincent.legoll@gmail.com
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(-)

Toggle diff (24 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 17/28] fix variable quoting in sys_make_guix_available
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-17-vincent.legoll@gmail.com
---
etc/guix-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 18/28] Replace the use of "which" by "command -v"
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-18-vincent.legoll@gmail.com
---
etc/guix-install.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Toggle diff (44 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 15/28] guix-install.sh, guix-binary tarball: Handle openrc-based foreign distributions.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-15-vincent.legoll@gmail.com
* .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

Toggle diff (104 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 19/28] Remove &> and >& bashisms
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-19-vincent.legoll@gmail.com
---
etc/guix-install.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

Toggle diff (62 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 20/28] Add missing variable quoting & curly-bracketing for dl_path
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-20-vincent.legoll@gmail.com
---
etc/guix-install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 16/28] non-interactive mode, usage
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-16-vincent.legoll@gmail.com
---
etc/guix-install.sh | 68 +++++++++++++++++++++++++++++++++------------
1 file changed, 51 insertions(+), 17 deletions(-)

Toggle diff (114 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 21/28] Remove unused variable
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-21-vincent.legoll@gmail.com
---
etc/guix-install.sh | 4 ----
1 file changed, 4 deletions(-)

Toggle diff (23 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 22/28] Remove local bashisms
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-22-vincent.legoll@gmail.com
---
etc/guix-install.sh | 33 +++++++++++----------------------
1 file changed, 11 insertions(+), 22 deletions(-)

Toggle diff (107 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 24/28] Remove some "[[" bashisms
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-24-vincent.legoll@gmail.com
---
etc/guix-install.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Toggle diff (42 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 25/28] Remove unused variable set by "read"
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-25-vincent.legoll@gmail.com
---
etc/guix-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 11/28] guix-install.sh: Use a variable for GPG key URL.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-11-vincent.legoll@gmail.com
* 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(-)

Toggle diff (23 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 23/28] Remove $UID bashism
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-23-vincent.legoll@gmail.com
---
etc/guix-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 26/28] Add _debug_func() helper function
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-26-vincent.legoll@gmail.com
---
etc/guix-install.sh | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)

Toggle diff (97 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 27/28] Fix variable use in guix_get_bin_list()
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-27-vincent.legoll@gmail.com
- Add missing curly-brackets
- Add implicit array zero-indexing
---
etc/guix-install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
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
V
V
Vincent Legoll wrote on 17 May 2020 19:17
[PATCH 28/28] Remove "[[" bashisms in chk_init_sys()
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200517171725.732-28-vincent.legoll@gmail.com
---
etc/guix-install.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

Toggle diff (35 lines)
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
J
J
Julien Lepiller wrote on 17 May 2020 21:26
Re: [bug#40601] [RFC, PATCH 0/28] guix-install.sh: port to other distros & init systems
9B55C53F-93C3-41E1-B092-72EA616D2536@lepiller.eu
Le 17 mai 2020 13:15:46 GMT-04:00, Vincent Legoll <vincent.legoll@gmail.com> a écrit :
Toggle quote (48 lines)
>Hello,
>
>Here is a RFC series of patches that add a few things:
>
>- small fixes & cleanups
>- removing some (not all) bashisms
>- non-interactive mode (useful for (semi-) automated
> testing)
>- openrc init system support
>- runit init system support
>- busybox compatibility (for alpine support)
>- handle local guix-binary.${ARCH}.tar.xz file (useful
> for (semi-) automated testing)
>- requirements fixes
>
>It currently has been tested on a range of distros/arches
>but the latest patches are still not polished (missing
>proper commit messages)
>
>The series is RFC as a few questions remain for me:
>
>- Do we want to support alien (aka foreign++) distros
> (different shells, different init systems, etc...)
>- To what extent
>- Are the patches too fine-grained (I personally like
> them smallish)
>
>Future, additionnal work items:
>- s6 (adelie / obarun) init support
>- handle GPG downloading in non-interactive mode
>- being able to cross-build & test them on other
> arches again (dunno why it broke)
>- documentation
>- add missing guix-publish services
>- add missing RO remounting the store on other distros
>- removing allremaining bashisms (being shellcheck clean
> maybe ?)
>
>This is to gather input before investing too much time.
>
>For example, do we want to commit part of this now, with
>the rest coming later ?
>
>Any feedback ?
>On individual patch(es) or on the whole series goal...
>
>Thanks for reading this far.

Nice series! I think we want to support as many foreign (init, shell, …) distros as possible.

You might want to consider fixing bug #41266. I also found out that daemonize is required on sysv systems.
V
V
Vincent Legoll wrote on 17 May 2020 21:37
16ce2d5b-e12b-ba6e-758c-fb02d689fe81@gmail.com
Toggle quote (3 lines)
> Nice series! I think we want to support as many foreign
> (init, shell, …) distros as possible.

OK that makes at least 3 of us

Toggle quote (2 lines)
> You might want to consider fixing bug #41266.

Ah, nice, that shows that my testing rig is still missing
cases, I only run everything directly as root (for which
I pre-import the key), so the problem slipped through.

Another one for the TODO list.

Toggle quote (2 lines)
> I also found out that daemonize is required on sysv systems.

Yep, I've seen it, but forgot to add it to the TODO list, it's
now.

Thanks, this will end in a ~50-patches series ;-)

--
Vincent Legoll
J
[guix-daemon now working on parabola with openrc]
(address . 40601@debbugs.gnu.org)
103a2055e6e16e307b0d5f3112fa23dc@dismail.de
I have openrc working on parabola with guix-daemon. It successfully registers the following service.

#! /sbin/openrc-run

description="guix build daemon"
command="/var/guix/profiles/per-user/root/current-guix/bin/guix-daemon"
command_args="--build-users-group=guixbuild"
command_background=true
pidfile="/run/guix-daemon.pid"

The above is a modification of Vincent's code in order to make it run for me without using the @localstatedir@ variable.

If anybody has suggestions, corrections, and incites about this it would be greatly appreciated.

I would like to get this working with the packaged version of guix in parabola https://www.parabola.nu/packages/?q=guix

since that PKGBUILD does not support openrc currently.

It also needs to be updated.
L
L
Leo Famulari wrote on 22 May 2020 20:40
(name . jgart--- via Guix-patches via)(address . guix-patches@gnu.org)(address . 40601@debbugs.gnu.org)
20200522184006.GB11419@jasmine.lan
On Fri, May 22, 2020 at 01:44:39PM +0000, jgart--- via Guix-patches via wrote:
Toggle quote (10 lines)
> I have openrc working on parabola with guix-daemon. It successfully registers the following service.
>
> #! /sbin/openrc-run
>
> description="guix build daemon"
> command="/var/guix/profiles/per-user/root/current-guix/bin/guix-daemon"
> command_args="--build-users-group=guixbuild"
> command_background=true
> pidfile="/run/guix-daemon.pid"

Great!

Toggle quote (2 lines)
> The above is a modification of Vincent's code in order to make it run for me without using the @localstatedir@ variable.

Does it still use the "correct" local state directory? Normally that's
'/var/guix' but I'm not sure what Parabola does.

Toggle quote (2 lines)
> I would like to get this working with the packaged version of guix in parabola https://www.parabola.nu/packages/?q=guix

Is it not working now? What remains to be done, aside from updating the
packages?
T
T
Tobias Geerinckx-Rice wrote on 23 May 2020 14:36
Re: [bug#40601] [PATCH 01/28] nix/local.mk: Add missing comment to sysvinit section.
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
874ks6x1xw.fsf@nckx
Vincent Legoll 写道:
Toggle quote (2 lines)
> * nix/local.mk (sysvinit): Add comment.

LGTM.

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQT12iAyS4c9C3o4dnINsP+IT1VteQUCXskY6wAKCRANsP+IT1Vt
eSlVAQDzCE8QDvCiBo5NUlRIo7XYfsKZKGKMWddIzrLJlNgwOgD/TUQL+Q4X9y7p
VGvvHGRGdUCj8GlogqccnJmLVBmDyQQ=
=58iO
-----END PGP SIGNATURE-----

T
T
Tobias Geerinckx-Rice wrote on 23 May 2020 15:42
Re: [bug#40601] [PATCH 04/28] guix-install.sh: Handle local binary tarball file.
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
87zh9yvkz1.fsf@nckx
Vincent,

I've pushed the first three patches with some commit message
tweaks.

Vincent Legoll 写道:
Toggle quote (4 lines)
> * 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
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQT12iAyS4c9C3o4dnINsP+IT1VteQUCXskoLAAKCRANsP+IT1Vt
efgiAQD9JmkZKXK80464HeoqC+xwOoT8jtlbQ70s9hZgyH9grQD/VOcg/HI1WsMn
qjz5g7JD78SXuyb76z6m5ibGbqlPxAU=
=QAHd
-----END PGP SIGNATURE-----

V
V
Vincent Legoll wrote on 23 May 2020 23:37
(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)
5c082fbc-c436-a415-03ea-4f45aa41b861@gmail.com
On 23/05/2020 15:42, Tobias Geerinckx-Rice wrote:
Toggle quote (4 lines)
> Vincent,
>
> I've pushed the first three patches with some commit message tweaks.

Thanks & thanks

Toggle quote (14 lines)
> 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
V
V
Vincent Legoll wrote on 31 May 2020 22:41
New reduced patchset, the easy bits first
00b505a4-0c1a-2f6c-7242-57d7b5eb7d4f@gmail.com
Hello,

The patch series is becoming long. So here is a batch of fairly easy
ones, to lighten it a bit.

--
Vincent Legoll
V
V
Vincent Legoll wrote on 31 May 2020 22:42
[PATCH 1/7] guix-install.sh: Remove "[[" bashisms in chk_init_sys().
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200531204257.18725-1-vincent.legoll@gmail.com
* etc/guix-install.sh (chk_init_sys): Use `if something | grep' instead of "[["
pattern matching.
---
etc/guix-install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (20 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index bf15aede21..455e021684 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -138,11 +138,11 @@ 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
-- 
2.26.2
V
V
Vincent Legoll wrote on 31 May 2020 22:42
[PATCH 3/7] guix-install.sh: Fix requirements.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200531204257.18725-3-vincent.legoll@gmail.com
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(-)

Toggle diff (31 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 0d7a8c8d44..28fcf831c5 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -32,8 +32,6 @@ set -e
 [ "$(id -u)" -eq 0 ] || { echo "This script must be run as root."; exit 1; }
 
 REQUIRE=(
-    "dirname"
-    "readlink"
     "wget"
     "gpg"
     "grep"
@@ -41,13 +39,14 @@ REQUIRE=(
     "sed"
     "sort"
     "getent"
+    "ln"
     "mktemp"
     "rm"
     "chmod"
     "uname"
     "groupadd"
     "tail"
-    "tr"
+    "tar"
     "xz"
 )
 
-- 
2.26.2
V
V
Vincent Legoll wrote on 31 May 2020 22:42
[PATCH 4/7] guix-install.sh: trivial whitespace fix.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200531204257.18725-4-vincent.legoll@gmail.com
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(-)

Toggle diff (43 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 28fcf831c5..14616f790b 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -173,9 +173,9 @@ chk_sys_arch()
         aarch64)
             local arch=aarch64
             ;;
-	armv7l)
-	    local arch=armhf
-	    ;;
+        armv7l)
+            local arch=armhf
+            ;;
         *)
             _err "${ERR}Unsupported CPU type: ${arch}"
             exit 1
@@ -355,15 +355,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  gnu-store.mount guix-daemon &&
-- 
2.26.2
V
V
Vincent Legoll wrote on 31 May 2020 22:42
[PATCH 5/7] guix-install.sh: Add variable quoting in sys_make_guix_available.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200531204257.18725-5-vincent.legoll@gmail.com
* etc/guix-install.sh (sys_make_guix_available): Add variable quoting.
---
etc/guix-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 14616f790b..0e6e6842a1 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -393,7 +393,7 @@ sys_enable_guix_daemon()
     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
V
V
Vincent Legoll wrote on 31 May 2020 22:42
[PATCH 6/7] guix-install.sh: Fix variable uses in guix_get_bin_list().
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200531204257.18725-6-vincent.legoll@gmail.com
* etc/guix-install.sh (guix_get_bin_list)[BIN_VER]: Add missing curly-brackets,
[latest_ver]: Likewise & add explicit array zero-indexing.
---
etc/guix-install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 0e6e6842a1..7d635c2c38 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -210,7 +210,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 -oP "([0-9]{1,2}\.){2}[0-9]{1,2}" \
                        | tail -n1)"
 
@@ -224,7 +224,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
V
V
Vincent Legoll wrote on 31 May 2020 22:42
[PATCH 7/7] guix-install.sh: Add missing variable quoting & curly-bracketing in guix_get_bin().
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200531204257.18725-7-vincent.legoll@gmail.com
* etc/guix-install.sh (guix_get_bin)[dl_path]: Add missing variable quoting and
curly-bracketing, [_PROGRESS_OPT]: Likewise.
---
etc/guix-install.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Toggle diff (25 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 7d635c2c38..f0d4a38838 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -239,7 +239,8 @@ 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."
@@ -248,7 +249,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
V
V
Vincent Legoll wrote on 31 May 2020 22:42
[PATCH 2/7] guix-install.sh: Remove $UID bashism.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200531204257.18725-2-vincent.legoll@gmail.com
* etc/guix-install.sh: Use `id -u' instead of $UID.
---
etc/guix-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 455e021684..0d7a8c8d44 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -29,7 +29,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; }
 
 REQUIRE=(
     "dirname"
-- 
2.26.2
Z
Z
zimoun wrote on 7 Oct 2020 18:09
Re: [bug#40601] [PATCH 0/5] Handle runit-based foreign distributions
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)(address . 40601@debbugs.gnu.org)
87d01u81co.fsf@gmail.com
Dear Vincent,

I am working on Bug #43744 and Path #43769 and I hit these patches set.


Well, I am a bit lost with the different series and I do not know which
are still valid and which are now obsolete.

Could you rebase and resent the patch set? And reroll with v5?

Thank you in advance.

All the best,
simon
C
C
Christopher Baines wrote on 18 Dec 2020 12:37
Re: [bug#40601] [PATCH 7/7] guix-install.sh: Add missing variable quoting & curly-bracketing in guix_get_bin().
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)(address . 40601@debbugs.gnu.org)
87y2hv1h0p.fsf@cbaines.net
Vincent Legoll <vincent.legoll@gmail.com> writes:

Toggle quote (18 lines)
> * etc/guix-install.sh (guix_get_bin)[dl_path]: Add missing variable quoting and
> curly-bracketing, [_PROGRESS_OPT]: Likewise.
> ---
> etc/guix-install.sh | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/etc/guix-install.sh b/etc/guix-install.sh
> index 7d635c2c38..f0d4a38838 100755
> --- a/etc/guix-install.sh
> +++ b/etc/guix-install.sh
> @@ -239,7 +239,8 @@ 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"

I believe the variable quoting here will break the wget command in the
case where _PROGRESS_OPT="-q --show-progress"

→ wget "-q --show-progress" https://guix.gnu.org/
wget: invalid option -- ' '
wget: invalid option -- '-'
wget: invalid option -- '-'
wget: invalid option -- 's'
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.

Toggle quote (11 lines)
> if [[ "$?" -eq 0 ]]; then
> _msg "${PAS}download completed."
> @@ -248,7 +249,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."
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl/clJZfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xe4TQ//Srwr7acXBMAxOAFzJNYuemblqUfvzB81
/zuJidLQ/LSc2Usx8icn5l4CUKnLpY8d1jSWSVQ+kQJykSdAsB7kTbz5/bAzeFpx
r6TYCtxqQZgSIPMIlEsb4H2WKCllQpxXhRkSwSn7/Gp2zGIi8z/GHnqyatgnWMqG
i66lLshZv+3b1v5T6ppNPezkcDQ71sRykNwjanU2LJcizMgIwjfjVnCP/HHMAuxZ
xlYcWsHUoAo9BReZyOewE3eri+Gp/mmF3xyHCUyN0fDJWTZOwFmKZkrpoUelc0dP
mmBXaWZrEFGf7+1t6Hg1Gmf6xZusbDZkVErVg1kh+mnxaAwnoSXzquVa6CiUKo9H
RpQX9ZjtLZXzvF1zR6gnwu3HCzAKAYakz/+rCXjWoZKzLaF5tDKdg05Z1gFFLzB5
aRZaqoXgURX1W+mZ+RO/xw+pST4JmNg5GquWu2Dhe3+eHUxvBf9mkztfsEs1d+HV
nR0rtYQCAfvkc3Kj6RzqWukOAyCX2848yt3Oop0X/frwnExJOOk5qvRmSvHtKyst
yS3bT9tAkGN2sW4npnTn5MdFvOOOpBnBDaDGsRoPoj9jeGCkokMo6+8nHIFVYZLt
8uoLgYhVRtSjjzQUHMHXpOwfRitijGLAq1JGoA3WoGlZtetBj6gAjBlQaObseOnK
4xdb+ZcFX/M=
=afVT
-----END PGP SIGNATURE-----

C
C
Christopher Baines wrote on 18 Dec 2020 13:28
Re: [bug#40601] New reduced patchset, the easy bits first
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)(address . 40601@debbugs.gnu.org)
87v9cz1eo5.fsf@cbaines.net
Vincent Legoll <vincent.legoll@gmail.com> writes:

Toggle quote (5 lines)
> Hello,
>
> The patch series is becoming long. So here is a batch of fairly easy
> ones, to lighten it a bit.

Hi,

Sorry for the delays in reviewing this.

Thanks for sending a smaller set of patches, that makes reviewing
easier. I made some tweaks, and pushed 4 commits to master as
d2532317d136ac063a24baeec6688ea0e0ebe37b.

I'm not sure about the bashisms stuff, given the script seems to depend
on bash (see the exec bash bit at the start), I think using bash
functionality is reasonable. What was your motivation behind these
changes? (sorry if I've missed this earlier in the thread).

Maybe once we've talked about the bashisms stuff, would you be able to
send another set of patches for review?

Thanks,

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl/coHpfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XdYvA//VgwtxneB9ha1QCHSf3luCm3eVT0Q6SAG
atPytqgeRI5kuMB2dAM6PsTWlaXXE9L1LVhgfOfRCaFYFReJBckG9j8gsLtEMh2C
FMoY3662nXOthIHdgrAMfLSF05sXAlvwsDb1ddLxbfW+edeVFsYlr9FRLcS28m64
VCz6Aikcj8H2RuyJNLZgYZm6XBmU6CA8DFFmBX5E5FmWKMPJJ7wxX2L9J6Wvwk7k
WVUfPt7ACsurISKs1IycLmNA/jbNrkP7YlPmmc1qPpQBEMJPiIjt9mB04FXB/SqK
4LcFVNRpbTlkKCYA3pm6PV4z9caHxDes7fuFdnYJNXKQ88kN4XWSA7WZ4Frw/acQ
riLa3tNNKcxe+/9fo80Me3G6U1mdfHKeZ4xWxSmjddcH7ShPdcswIqdWRm1m1JK1
d06Ap0+c/83uE3gLnN8N9jcx2VQh4Alc3kVkgqw7lefUSRZEq61MesaUxLqiPAg+
LWPeptRxHfyVQWd5nNOq/kEcfcOBs84sYF6EfKN3s6LwOwxLG4+yH7gh4PX/jdrZ
hC6KGi0z6590Grw7DioqXTNsA6yJv+KLtwYw79SooohpgETS1B3dTlSNgz9nNKcy
w4/rmKH5x6ZSPsHzKu3c9q56hVckVMGvMgI8qA3fxImLF8s52YBWDvQIAZL30v0a
IkAtVMGGbNM=
=kk2+
-----END PGP SIGNATURE-----

V
V
Vincent Legoll wrote on 18 Dec 2020 20:35
(name . Christopher Baines)(address . mail@cbaines.net)(address . 40601@debbugs.gnu.org)
CAEwRq=pUX4v4_OBA=THq7JYk+ef15HDFpPkD-6HmtZkx854KJA@mail.gmail.com
Hello,

Toggle quote (4 lines)
> Thanks for sending a smaller set of patches, that makes reviewing
> easier. I made some tweaks, and pushed 4 commits to master as
> d2532317d136ac063a24baeec6688ea0e0ebe37b.

Thanks for taking care of this, I'll have a look.

Toggle quote (5 lines)
> I'm not sure about the bashisms stuff, given the script seems to depend
> on bash (see the exec bash bit at the start), I think using bash
> functionality is reasonable. What was your motivation behind these
> changes? (sorry if I've missed this earlier in the thread).

Some distributions that I intended to add support for don't default to bash
(nor have it installed by default). I think this script should aim for
the broadest
possible support, but that is only my opinion.

And the patch set was not finished, I wanted to tackle the low hanging fruits
first (also to test the interest from the guix team before doing too much).

Toggle quote (3 lines)
> Maybe once we've talked about the bashisms stuff, would you be able to
> send another set of patches for review?

I'll try to revive the patch set, and submit other portions I should have lying
somewhere.

Tchuss

--
Vincent Legoll
V
V
Vincent Legoll wrote on 20 Dec 2020 18:28
[PATCH 1/5] guix-install.sh: Remove "[[" bashisms in chk_init_sys().
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20201220172839.3059-1-vincent.legoll@gmail.com
* etc/guix-install.sh (chk_init_sys): Use `if something | grep' instead of "[["
pattern matching.
---
etc/guix-install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (20 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 9015f40bb6..26c8622855 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -143,11 +143,11 @@ 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
-- 
2.29.2
V
V
Vincent Legoll wrote on 20 Dec 2020 18:28
[PATCH 2/5] guix-install.sh: Remove $UID bashism.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20201220172839.3059-2-vincent.legoll@gmail.com
* etc/guix-install.sh: Use `id -u' instead of $UID.
---
etc/guix-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 26c8622855..0102901010 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -32,7 +32,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; }
 
 REQUIRE=(
     "dirname"
-- 
2.29.2
V
V
Vincent Legoll wrote on 20 Dec 2020 18:28
[PATCH 3/5] guix-install.sh: Fix requirements.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20201220172839.3059-3-vincent.legoll@gmail.com
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(-)

Toggle diff (31 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 0102901010..d40d90b377 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -35,8 +35,6 @@ set -e
 [ "$(id -u)" -eq 0 ] || { echo "This script must be run as root."; exit 1; }
 
 REQUIRE=(
-    "dirname"
-    "readlink"
     "wget"
     "gpg"
     "grep"
@@ -44,13 +42,14 @@ REQUIRE=(
     "sed"
     "sort"
     "getent"
+    "ln"
     "mktemp"
     "rm"
     "chmod"
     "uname"
     "groupadd"
     "tail"
-    "tr"
+    "tar"
     "xz"
 )
 
-- 
2.29.2
V
V
Vincent Legoll wrote on 20 Dec 2020 18:28
[PATCH 4/5] guix-install.sh: Fix detection of SysV init system.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20201220172839.3059-4-vincent.legoll@gmail.com
Checking the presence of a regular file & not symlink (/etc/init.d/cron)
is not sufficient.

Detect a sysvinit system by running `/sbin/init --version' and checking the
output contains the string "SysV".

* etc/guix-install.sh (chk_init_sys): fix sysvinit system detection.
---
etc/guix-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index d40d90b377..307c42d3fb 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -150,7 +150,7 @@ chk_init_sys()
         _msg "${INF}init system is: systemd"
         INIT_SYS="systemd"
         return 0
-    elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then
+    elif /sbin/init --version 2>/dev/null | grep -q SysV; then
         _msg "${INF}init system is: sysv-init"
         INIT_SYS="sysv-init"
         return 0
-- 
2.29.2
V
V
Vincent Legoll wrote on 20 Dec 2020 18:28
[PATCH 5/5] guix-install.sh: Check daemonize package presence for sysv-init.
(address . 40601@debbugs.gnu.org)(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20201220172839.3059-5-vincent.legoll@gmail.com
* etc/guix-install.sh (chk_init_sys): Call `chk_require daemonize'.
---
etc/guix-install.sh | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 307c42d3fb..ecc86f3e76 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -153,6 +153,10 @@ chk_init_sys()
     elif /sbin/init --version 2>/dev/null | grep -q SysV; then
         _msg "${INF}init system is: sysv-init"
         INIT_SYS="sysv-init"
+        chk_require daemonize || {
+            _err "${ERR}Init system: sysv-init requires the 'daemonize' package."
+            exit 1
+        }
         return 0
     elif [[ $(openrc --version 2>/dev/null) =~ \(OpenRC\) ]]; then
         _msg "${INF}init system is: OpenRC"
-- 
2.29.2
V
V
Vincent Legoll wrote on 20 Dec 2020 18:30
Re: [bug#40601] New reduced patchset, the easy bits first
(name . Christopher Baines)(address . mail@cbaines.net)(address . 40601@debbugs.gnu.org)
CAEwRq=obFfwN+b55nGvZ1OubxVVp6fagFam-YpdrjRy6t+2YEw@mail.gmail.com
I rebased and sent the next batch

On Fri, Dec 18, 2020 at 8:35 PM Vincent Legoll <vincent.legoll@gmail.com> wrote:
Toggle quote (35 lines)
>
> Hello,
>
> > Thanks for sending a smaller set of patches, that makes reviewing
> > easier. I made some tweaks, and pushed 4 commits to master as
> > d2532317d136ac063a24baeec6688ea0e0ebe37b.
>
> Thanks for taking care of this, I'll have a look.
>
> > I'm not sure about the bashisms stuff, given the script seems to depend
> > on bash (see the exec bash bit at the start), I think using bash
> > functionality is reasonable. What was your motivation behind these
> > changes? (sorry if I've missed this earlier in the thread).
>
> Some distributions that I intended to add support for don't default to bash
> (nor have it installed by default). I think this script should aim for
> the broadest
> possible support, but that is only my opinion.
>
> And the patch set was not finished, I wanted to tackle the low hanging fruits
> first (also to test the interest from the guix team before doing too much).
>
> > Maybe once we've talked about the bashisms stuff, would you be able to
> > send another set of patches for review?
>
> I'll try to revive the patch set, and submit other portions I should have lying
> somewhere.
>
> Tchuss
>
> --
> Vincent Legoll



--
Vincent Legoll
C
C
Christopher Baines wrote on 23 Dec 2020 13:17
Re: [bug#40601] [PATCH 2/5] guix-install.sh: Remove $UID bashism.
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)(address . 40601@debbugs.gnu.org)
874kkcbtsl.fsf@cbaines.net
Vincent Legoll <vincent.legoll@gmail.com> writes:

Toggle quote (19 lines)
> * etc/guix-install.sh: Use `id -u' instead of $UID.
> ---
> 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 26c8622855..0102901010 100755
> --- a/etc/guix-install.sh
> +++ b/etc/guix-install.sh
> @@ -32,7 +32,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; }
>
> REQUIRE=(
> "dirname"

Should id be added as a requirement?
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl/jNWpfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xff4RAAqMyideqviA2RZITw4HRcGRDGDYzNwgaz
fQZNWWSrg2GLUNxAqyfeHOZm0gLwPYje9EH8KcNAVG5+NPj9QqDXcAdY2mEftqdV
IlxnZ+guZpWw7BccYseCqsGHb4Ns0wACkKP1lFKrX/fQsjQZoyFJEPJKimkggblY
7dKsJ9T7PI4DKJDQDv4zZgLM8BiqtjPrc1FMKxR8v5SJ3hRGp1jf8RwobIFl9zqf
i0/Zpm+9nchZPuBcBhpVF00O4Jode1x2A1a0kNUGDF6hNSeM6HmtoePLqyGOWxIk
SSN2YxSHEkppKLGMWVOm4KKBZyDWAxvpVLkU6aLHMWAt2IhBR9RJabMDeAtwyt/M
nDAc7UypGCzx5fH3mR5Y3CosWji50Dsa+c1tr2cmfEu3AMeR+UEsymJkpp4lLUDV
7qEYXOAcNQLYszvCG3iqrPgUNVXi1vDa4fTp2slqPY4VLYL7xosE6NRmESIX8Fyc
WCZBJFzuTzY05EbW/WQIXU+KM12e8bt/nHmpamZd/I4An9Qo5bWHZOoH+8+Wn3d+
GAvnxQo/JQ/11+IgfRpOeypNhM7wuiPzsn1hOKJ0Hge3ekGMXZPTaRWwpzQ0lywT
wPdQiP6ftm1hEMtgKNGnfnNpjSssA6aobTmOJKDdT94IPWTcqOXOcIDb4PDZnPZX
LzmESX8/Qwc=
=yZax
-----END PGP SIGNATURE-----

V
V
Vincent Legoll wrote on 23 Dec 2020 15:59
(name . Christopher Baines)(address . mail@cbaines.net)(address . 40601@debbugs.gnu.org)
CAEwRq=rtUUZeoKFZRaeHvmzVy1Jb++H3TBScpXTDHL_Szf7j4g@mail.gmail.com
Hello,

On Wed, Dec 23, 2020 at 1:17 PM Christopher Baines <mail@cbaines.net> wrote:
Toggle quote (8 lines)
> > -[ "$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; }
> >
> > REQUIRE=(
> > "dirname"
>
> Should id be added as a requirement?

good catch !

thanks, I'll respin after this round of feedback

--
Vincent Legoll
J
J
jgart wrote on 2 Sep 2021 19:51
guix-daemon runit service on void
(address . 40601@debbugs.gnu.org)
20210902135154.GB515@gac.attlocal.net
Hi,

I just wanted to give some information about me runnning guix on void linux.

I get the following error when I try to install with guix-install.sh:

[ FAIL ] Init system could not be detected.

That's probably to be expected since runit has not been added yet to the guix-install.sh script.

Here is the guix-daemon runit service that I currently run on void linux in case it is useful to anyone else:

/etc/sv/guix-daemon/run:

```
#!/bin/sh

exec /var/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild --substitute-urls=https://guix.bordeaux.inria.fr2 &1
```

Has anyone tried running guix on void linux?

If so, are you running something different than above for your runit service?

all best,

jgart
_________________________________________
/ 3B1D 7F19 E36B B60C 0F5B 2CA9 A52A A2B4 \
\ 77B6 DD35 /
-----------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 40601@debbugs.gnu.org