* [bug#42816] [PATCH] guix-install.sh: Add support for openrc
@ 2020-08-11 20:36 Morgan.J.Smith
2020-08-11 21:26 ` Tobias Geerinckx-Rice via Guix-patches via
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Morgan.J.Smith @ 2020-08-11 20:36 UTC (permalink / raw)
To: 42816; +Cc: Morgan Smith
From: Morgan Smith <Morgan.J.Smith@outlook.com>
* etc/guix-install.sh: Add support for openrc
I also removed the --warning=no-timestamp tar flag and changed grep to use
extended regex instead of perl regex since these flags where not supported on
the alpine linux image I was using to test (3.12.0-x86_64).
---
etc/guix-install.sh | 18 +++++++++++++++---
etc/openrc/guix-daemon | 11 +++++++++++
2 files changed, 26 insertions(+), 3 deletions(-)
create mode 100644 etc/openrc/guix-daemon
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 72dc3839e8..9e9f8470d8 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -150,6 +150,9 @@ chk_init_sys()
_msg "${INF}init system is: sysv-init"
INIT_SYS="sysv-init"
return 0
+ elif [[ $(openrc --version 2>/dev/null) =~ \(OpenRC\) ]]; then
+ _msg "${INF}init system is: OpenRC"
+ INIT_SYS="openrc"
else
INIT_SYS="NA"
_err "${ERR}Init system could not be detected."
@@ -212,7 +215,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 "([[:digit:]]{1,2}\.){2}[[:digit:]]{1,2}" \
| tail -n1)"
default_ver="guix-binary-${latest_ver}.${ARCH_OS}"
@@ -268,8 +271,7 @@ sys_create_store()
_debug "--- [ $FUNCNAME ] ---"
cd "$tmp_path"
- tar --warning=no-timestamp \
- --extract \
+ tar --extract \
--file "$pkg" &&
_msg "${PAS}unpacked archive"
@@ -384,6 +386,16 @@ sys_enable_guix_daemon()
service guix-daemon start; } &&
_msg "${PAS}enabled Guix daemon via sysv"
;;
+ openrc)
+ { mkdir -p /etc/init.d;
+ cp "${ROOT_HOME}/.config/guix/current/etc/openrc/guix-daemon" \
+ /etc/init.d/guix-daemon;
+ chmod 775 /etc/init.d/guix-daemon;
+
+ rc-update add guix-daemon default &&
+ rc-service guix-daemon start;} &&
+ _msg "${PAS}enabled Guix daemon via OpenRC"
+ ;;
NA|*)
_msg "${ERR}unsupported init system; run the daemon manually:"
echo " ${ROOT_HOME}/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild"
diff --git a/etc/openrc/guix-daemon b/etc/openrc/guix-daemon
new file mode 100644
index 0000000000..436673f169
--- /dev/null
+++ b/etc/openrc/guix-daemon
@@ -0,0 +1,11 @@
+#!/sbin/openrc-run
+
+export GUIX_LOCPATH=/var/guix/profiles/per-user/root/guix-profile/lib/locale
+export LC_ALL=en_US.utf8
+command="/var/guix/profiles/per-user/root/current-guix/bin/guix-daemon"
+command_args="--build-users-group=guixbuild"
+command_background="yes"
+pidfile="/var/run/guix-daemon.pid"
+
+output_log="/var/log/guix-daemon-stdout.log"
+error_log="/var/log/guix-daemon-stderr.log"
--
2.27.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#42816] [PATCH] guix-install.sh: Add support for openrc
2020-08-11 20:36 [bug#42816] [PATCH] guix-install.sh: Add support for openrc Morgan.J.Smith
@ 2020-08-11 21:26 ` Tobias Geerinckx-Rice via Guix-patches via
2020-08-12 3:38 ` [bug#42816] [PATCH 1/2] guix-install.sh: Increase compatibility Morgan.J.Smith
[not found] ` <20200812033842.99352-1-Morgan.J.Smith@outlook.com>
2020-08-12 3:58 ` [bug#42816] [PATCH 3/2] Oops, please merge this patch with the last one. My bad Morgan.J.Smith
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-08-11 21:26 UTC (permalink / raw)
To: Morgan.J.Smith; +Cc: 42816
[-- Attachment #1: Type: text/plain, Size: 3312 bytes --]
Morgan,
Morgan.J.Smith@outlook.com 写道:
> * etc/guix-install.sh: Add support for openrc
\o/ thanks!
> I also removed the --warning=no-timestamp tar flag
My understanding was that this silenced a scary but harmless
warning from older (GNU?) tar versions. I'm happy to see it go if
it actually breaks others.
> and changed grep to use
> extended regex instead of perl regex since these flags where not
> supported on
> the alpine linux image I was using to test (3.12.0-x86_64).
Both Alpine compatibility changes are very welcome but should be
in a separate commit. Keep commits confined to one logical change
whenever possible.
> --- a/etc/guix-install.sh
> +++ b/etc/guix-install.sh
> @@ -150,6 +150,9 @@ chk_init_sys()
> _msg "${INF}init system is: sysv-init"
> INIT_SYS="sysv-init"
> return 0
> + elif [[ $(openrc --version 2>/dev/null) =~ \(OpenRC\) ]];
> then
OK. I didn't realise the script still had severe bashism.
> + _msg "${INF}init system is: OpenRC"
> + INIT_SYS="openrc"
Add a ‘return 0’ line here for consistency with the rest of the
code.
> latest_ver="$(echo "$bin_ver_ls" \
> - | grep -oP "([0-9]{1,2}\.){2}[0-9]{1,2}"
> \
> + | grep -oE
> "([[:digit:]]{1,2}\.){2}[[:digit:]]{1,2}" \
[[:digit:]] wasn't strictly required here, right? I understand
that it's more ‘correct’ but can't imagine any locale actually
breaking either one.
Is there a practical chance that some ancient-but-supported grep
out there supports [0-9] but *not* [[:digit:]]?
If not: OK!
> @@ -384,6 +386,16 @@ sys_enable_guix_daemon()
> service guix-daemon start; } &&
> _msg "${PAS}enabled Guix daemon via sysv"
> ;;
> + openrc)
> + { mkdir -p /etc/init.d;
> + cp
> "${ROOT_HOME}/.config/guix/current/etc/openrc/guix-daemon" \
> + /etc/init.d/guix-daemon;
> + chmod 775 /etc/init.d/guix-daemon;
> +
> + rc-update add guix-daemon default &&
> + rc-service guix-daemon start;} &&
> + _msg "${PAS}enabled Guix daemon via OpenRC"
> + ;;
I'll defer to your expertise on the OpenRC incantations :-)
Minor nitpick: ‘; }’.
> diff --git a/etc/openrc/guix-daemon b/etc/openrc/guix-daemon
I like the subdirectory.
> new file mode 100644
> index 0000000000..436673f169
> --- /dev/null
> +++ b/etc/openrc/guix-daemon
> @@ -0,0 +1,11 @@
> +#!/sbin/openrc-run
> +
> +export
> GUIX_LOCPATH=/var/guix/profiles/per-user/root/guix-profile/lib/locale
> +export LC_ALL=en_US.utf8
> +command="/var/guix/profiles/per-user/root/current-guix/bin/guix-daemon"
> +command_args="--build-users-group=guixbuild"
> +command_background="yes"
> +pidfile="/var/run/guix-daemon.pid"
> +
> +output_log="/var/log/guix-daemon-stdout.log"
> +error_log="/var/log/guix-daemon-stderr.log"
Please rename this to guix-daemon.in & add it to nix/local.mk so
we can use @localstatedir@ here.
If you could send a revised patch series it would be much
appreciated; otherwise I'll make the above changes when I get
around to it (...).
Thanks!
T G-R
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [bug#42816] [PATCH 1/2] guix-install.sh: Increase compatibility
2020-08-11 21:26 ` Tobias Geerinckx-Rice via Guix-patches via
@ 2020-08-12 3:38 ` Morgan.J.Smith
2020-09-04 8:57 ` Ludovic Courtès
[not found] ` <20200812033842.99352-1-Morgan.J.Smith@outlook.com>
1 sibling, 1 reply; 8+ messages in thread
From: Morgan.J.Smith @ 2020-08-12 3:38 UTC (permalink / raw)
To: me; +Cc: Morgan Smith, 42816
From: Morgan Smith <Morgan.J.Smith@outlook.com>
These fixes allow the script to be run using the binaries found on Alpine
Linux 3.12.0-x86_64.
* etc/guix-install.sh (guix_get_bin_list): Change grep to use extended regex
instead of perl regex. Grep using extended regex is POSIX while grep using
perl regex is not.
* etc/guix-install.sh (sys_create_store): Remove --warning flag as it is
unavailable on Alpine Linux
---
So for this change I had to learn perl regex. Then, once I understood
exactly what it did I recreated it from scratch not realizing that it
was almost the same as what was there before. I'm pretty sure there
are no differences between [[:digit:]] and [0-9], I just tend to use
[[:digit:]] because it's flashy
etc/guix-install.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 72dc3839e8..06edbaaffd 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -212,7 +212,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}"
@@ -268,8 +268,7 @@ sys_create_store()
_debug "--- [ $FUNCNAME ] ---"
cd "$tmp_path"
- tar --warning=no-timestamp \
- --extract \
+ tar --extract \
--file "$pkg" &&
_msg "${PAS}unpacked archive"
--
2.28.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#42816] [PATCH 1/2] guix-install.sh: Increase compatibility
2020-08-12 3:38 ` [bug#42816] [PATCH 1/2] guix-install.sh: Increase compatibility Morgan.J.Smith
@ 2020-09-04 8:57 ` Ludovic Courtès
0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2020-09-04 8:57 UTC (permalink / raw)
To: Morgan.J.Smith; +Cc: me, 42816
Hi!
Morgan.J.Smith@outlook.com skribis:
> From: Morgan Smith <Morgan.J.Smith@outlook.com>
>
> These fixes allow the script to be run using the binaries found on Alpine
> Linux 3.12.0-x86_64.
>
> * etc/guix-install.sh (guix_get_bin_list): Change grep to use extended regex
> instead of perl regex. Grep using extended regex is POSIX while grep using
> perl regex is not.
>
> * etc/guix-install.sh (sys_create_store): Remove --warning flag as it is
> unavailable on Alpine Linux
[...]
> From: Morgan Smith <Morgan.J.Smith@outlook.com>
>
> ---
> Oops, please merge this patch with the last one. My bad
>
> etc/openrc/guix-daemon.in | 28 ++++++++++++++++++++++++++++
Tobias, I think these patches fell through the cracks. Could you apply
them if everything looks good to you? :-)
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20200812033842.99352-1-Morgan.J.Smith@outlook.com>]
* [bug#42816] [PATCH 2/2] guix-install.sh: Add openrc support
[not found] ` <20200812033842.99352-1-Morgan.J.Smith@outlook.com>
@ 2020-08-12 3:38 ` Morgan.J.Smith
0 siblings, 0 replies; 8+ messages in thread
From: Morgan.J.Smith @ 2020-08-12 3:38 UTC (permalink / raw)
To: me; +Cc: Morgan Smith, 42816
From: Morgan Smith <Morgan.J.Smith@outlook.com>
Tested and working on Alpine Linux 3.12.0-x86_64
* etc/guix-install.sh: Add openrc support
* etc/openrc/guix-daemon.in: New file - openrc service file
* nix/local.mk (etc/openrc/guix-daemon): New rule.
(nodist_openrcservice_DATA): Add etc/openrc/guix-daemon.in .
(CLEANFILES): Add etc/openrc/guix-daemon .
* .gitignore: Add etc/openrc/guix-daemon .
---
I'm pretty far out of comfort zone on these changes so please let me
know how this works. I basically guessed what needed to be changed in
local.mk.
---
.gitignore | 1 +
etc/guix-install.sh | 15 +++++++++++++++
nix/local.mk | 17 +++++++++++++++--
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index f630444a0f..e2f745b42a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -74,6 +74,7 @@
/etc/guix-publish.conf
/etc/guix-publish.service
/etc/init.d/guix-daemon
+/etc/openrc/guix-daemon
/guix-daemon
/guix/config.scm
/libformat.a
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 06edbaaffd..ff4b95f124 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, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+# Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
#
# This file is part of GNU Guix.
#
@@ -150,6 +151,10 @@ chk_init_sys()
_msg "${INF}init system is: sysv-init"
INIT_SYS="sysv-init"
return 0
+ elif [[ $(openrc --version 2>/dev/null) =~ \(OpenRC\) ]]; then
+ _msg "${INF}init system is: OpenRC"
+ INIT_SYS="openrc"
+ return 0
else
INIT_SYS="NA"
_err "${ERR}Init system could not be detected."
@@ -383,6 +388,16 @@ sys_enable_guix_daemon()
service guix-daemon start; } &&
_msg "${PAS}enabled Guix daemon via sysv"
;;
+ openrc)
+ { mkdir -p /etc/init.d;
+ cp "${ROOT_HOME}/.config/guix/current/etc/openrc/guix-daemon" \
+ /etc/init.d/guix-daemon;
+ chmod 775 /etc/init.d/guix-daemon;
+
+ rc-update add guix-daemon default &&
+ rc-service guix-daemon start; } &&
+ _msg "${PAS}enabled Guix daemon via OpenRC"
+ ;;
NA|*)
_msg "${ERR}unsupported init system; run the daemon manually:"
echo " ${ROOT_HOME}/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild"
diff --git a/nix/local.mk b/nix/local.mk
index 005cde5563..2bb01041b9 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -180,6 +180,17 @@ etc/init.d/guix-daemon: etc/init.d/guix-daemon.in \
"$<" > "$@.tmp"; \
mv "$@.tmp" "$@"
+# The service script for openrc.
+openrcservicedir = $(sysconfdir)/init.d
+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
@@ -194,7 +205,8 @@ etc/guix-%.conf: etc/guix-%.conf.in \
CLEANFILES += \
$(nodist_systemdservice_DATA) \
$(nodist_upstartjob_DATA) \
- $(nodist_sysvinitservice_DATA)
+ $(nodist_sysvinitservice_DATA) \
+ $(nodist_openrcservice_DATA)
EXTRA_DIST += \
%D%/AUTHORS \
@@ -203,7 +215,8 @@ EXTRA_DIST += \
etc/guix-daemon.conf.in \
etc/guix-publish.service.in \
etc/guix-publish.conf.in \
- etc/init.d/guix-daemon.in
+ etc/init.d/guix-daemon.in \
+ etc/openrc/guix-daemon.in
if CAN_RUN_TESTS
--
2.28.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#42816] [PATCH 3/2] Oops, please merge this patch with the last one. My bad
2020-08-11 20:36 [bug#42816] [PATCH] guix-install.sh: Add support for openrc Morgan.J.Smith
2020-08-11 21:26 ` Tobias Geerinckx-Rice via Guix-patches via
@ 2020-08-12 3:58 ` Morgan.J.Smith
2020-08-18 20:52 ` [bug#42816] This is just a test Tobias Geerinckx-Rice via Guix-patches via
2020-09-17 12:13 ` [bug#42816] [PATCH] guix-install.sh: Add support for openrc Tobias Geerinckx-Rice via Guix-patches via
3 siblings, 0 replies; 8+ messages in thread
From: Morgan.J.Smith @ 2020-08-12 3:58 UTC (permalink / raw)
To: me; +Cc: Morgan Smith, 42816
From: Morgan Smith <Morgan.J.Smith@outlook.com>
---
Oops, please merge this patch with the last one. My bad
etc/openrc/guix-daemon.in | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 etc/openrc/guix-daemon.in
diff --git a/etc/openrc/guix-daemon.in b/etc/openrc/guix-daemon.in
new file mode 100644
index 0000000000..110a58b88d
--- /dev/null
+++ b/etc/openrc/guix-daemon.in
@@ -0,0 +1,28 @@
+#!/sbin/openrc-run
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
+#
+# This file is part of GNU Guix.
+#
+# GNU Guix is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+#
+# GNU Guix is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+export GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale
+export LC_ALL=en_US.utf8
+command="@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon"
+command_args="--build-users-group=guixbuild"
+command_background="yes"
+pidfile="/var/run/guix-daemon.pid"
+
+output_log="/var/log/guix-daemon-stdout.log"
+error_log="/var/log/guix-daemon-stderr.log"
--
2.28.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#42816] This is just a test
2020-08-11 20:36 [bug#42816] [PATCH] guix-install.sh: Add support for openrc Morgan.J.Smith
2020-08-11 21:26 ` Tobias Geerinckx-Rice via Guix-patches via
2020-08-12 3:58 ` [bug#42816] [PATCH 3/2] Oops, please merge this patch with the last one. My bad Morgan.J.Smith
@ 2020-08-18 20:52 ` Tobias Geerinckx-Rice via Guix-patches via
2020-09-17 12:13 ` [bug#42816] [PATCH] guix-install.sh: Add support for openrc Tobias Geerinckx-Rice via Guix-patches via
3 siblings, 0 replies; 8+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-08-18 20:52 UTC (permalink / raw)
To: 42816; +Cc: GNU bug tracker automated control server
User: guix
Usertag: notdeadjusttestin
^ permalink raw reply [flat|nested] 8+ messages in thread
* [bug#42816] [PATCH] guix-install.sh: Add support for openrc
2020-08-11 20:36 [bug#42816] [PATCH] guix-install.sh: Add support for openrc Morgan.J.Smith
` (2 preceding siblings ...)
2020-08-18 20:52 ` [bug#42816] This is just a test Tobias Geerinckx-Rice via Guix-patches via
@ 2020-09-17 12:13 ` Tobias Geerinckx-Rice via Guix-patches via
3 siblings, 0 replies; 8+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-09-17 12:13 UTC (permalink / raw)
To: 42816
[-- Attachment #1: Type: text/plain, Size: 179 bytes --]
Morgan, civodul,
> Tobias, I think these patches fell through the cracks.
I think so too. Thanks for your patience, Morgan, and enjoy
commits cabac732 et al.
Closing,
T G-R
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-09-17 12:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-11 20:36 [bug#42816] [PATCH] guix-install.sh: Add support for openrc Morgan.J.Smith
2020-08-11 21:26 ` Tobias Geerinckx-Rice via Guix-patches via
2020-08-12 3:38 ` [bug#42816] [PATCH 1/2] guix-install.sh: Increase compatibility Morgan.J.Smith
2020-09-04 8:57 ` Ludovic Courtès
[not found] ` <20200812033842.99352-1-Morgan.J.Smith@outlook.com>
2020-08-12 3:38 ` [bug#42816] [PATCH 2/2] guix-install.sh: Add openrc support Morgan.J.Smith
2020-08-12 3:58 ` [bug#42816] [PATCH 3/2] Oops, please merge this patch with the last one. My bad Morgan.J.Smith
2020-08-18 20:52 ` [bug#42816] This is just a test Tobias Geerinckx-Rice via Guix-patches via
2020-09-17 12:13 ` [bug#42816] [PATCH] guix-install.sh: Add support for openrc Tobias Geerinckx-Rice via Guix-patches via
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).