From: Morgan.J.Smith@outlook.com
To: me@tobias.gr
Cc: Morgan Smith <Morgan.J.Smith@outlook.com>, 42816@debbugs.gnu.org
Subject: [bug#42816] [PATCH 2/2] guix-install.sh: Add openrc support
Date: Tue, 11 Aug 2020 23:38:42 -0400 [thread overview]
Message-ID: <DM5PR1001MB2105E73EB9EF88EF6BFAF513C5420@DM5PR1001MB2105.namprd10.prod.outlook.com> (raw)
In-Reply-To: <20200812033842.99352-1-Morgan.J.Smith@outlook.com>
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
next prev parent reply other threads:[~2020-08-12 3:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Morgan.J.Smith [this message]
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM5PR1001MB2105E73EB9EF88EF6BFAF513C5420@DM5PR1001MB2105.namprd10.prod.outlook.com \
--to=morgan.j.smith@outlook.com \
--cc=42816@debbugs.gnu.org \
--cc=me@tobias.gr \
/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 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).