all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Morgan.J.Smith@outlook.com
To: 42816@debbugs.gnu.org
Cc: Morgan Smith <Morgan.J.Smith@outlook.com>
Subject: [bug#42816] [PATCH] guix-install.sh: Add support for openrc
Date: Tue, 11 Aug 2020 16:36:17 -0400	[thread overview]
Message-ID: <DM5PR1001MB2105C215AA5E05D4DAA5F64CC5450@DM5PR1001MB2105.namprd10.prod.outlook.com> (raw)

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





             reply	other threads:[~2020-08-11 20:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11 20:36 Morgan.J.Smith [this message]
2020-08-11 21:26 ` [bug#42816] [PATCH] guix-install.sh: Add support for openrc 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM5PR1001MB2105C215AA5E05D4DAA5F64CC5450@DM5PR1001MB2105.namprd10.prod.outlook.com \
    --to=morgan.j.smith@outlook.com \
    --cc=42816@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.