[PATCH 0/2] Start guix-daemon in SysV.

  • Done
  • quality assurance status badge
Details
4 participants
  • Danny Milosavljevic
  • Leo Famulari
  • Ludovic Courtès
  • Vincent Legoll
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal

Debbugs page

Danny Milosavljevic wrote 5 years ago
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200128155529.12071-1-dannym@scratchpost.org
Danny Milosavljevic (2):
Add system start-up files for guix-daemon.
guix-install.sh: Install sysv init script.

.gitignore | 1 +
etc/guix-install.sh | 11 +++++
etc/init.d/guix-daemon.in | 88 +++++++++++++++++++++++++++++++++++++++
nix/local.mk | 16 ++++++-
4 files changed, 114 insertions(+), 2 deletions(-)
create mode 100644 etc/init.d/guix-daemon.in
Danny Milosavljevic wrote 5 years ago
[PATCH 2/2] guix-install.sh: Install sysv init script.
(address . 39329@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200128155900.12137-2-dannym@scratchpost.org
* etc/guix-install.sh (sys_enable_guix_daemon): Install sysv init script.
---
etc/guix-install.sh | 11 +++++++++++
1 file changed, 11 insertions(+)

Toggle diff (22 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index bfd3842933..f3ea1def32 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -361,6 +361,17 @@ sys_enable_guix_daemon()
systemctl enable guix-daemon; } &&
_msg "${PAS}enabled Guix daemon via systemd"
;;
+ sysv-init)
+ { mkdir -p /etc/init.d;
+ cp "${ROOT_HOME}/.config/guix/current/etc/init.d/guix-daemon" \
+ /etc/init.d/guix-daemon;
+ chmod 664 /etc/init.d/guix-daemon;
+
+ update-rc.d guix-daemon defaults &&
+ update-rc.d guix-daemon enable &&
+ service guix-daemon start; } &&
+ _msg "${PAS}enabled Guix daemon via sysv"
+ ;;
NA|*)
_msg "${ERR}unsupported init system; run the daemon manually:"
echo " ${ROOT_HOME}/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild"
Danny Milosavljevic wrote 5 years ago
[PATCH 1/2] Add system start-up files for guix-daemon.
(address . 39329@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200128155900.12137-1-dannym@scratchpost.org
* etc/init.d/guix-daemon.in: New file.
* nix/local.mk (etc/init.d/guix-daemon): New rule.
(nodist_sysvinitservice_DATA): Add etc/init.d/guix-daemon.in .
(CLEANFILES): Add etc/init.d/guix-daemon .
* .gitignore: Add etc/init.d/guix-daemon .
---
.gitignore | 1 +
etc/init.d/guix-daemon.in | 88 +++++++++++++++++++++++++++++++++++++++
nix/local.mk | 16 ++++++-
3 files changed, 103 insertions(+), 2 deletions(-)
create mode 100644 etc/init.d/guix-daemon.in

Toggle diff (146 lines)
diff --git a/.gitignore b/.gitignore
index df59a9176e..de058dda5e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,6 +71,7 @@
/etc/guix-daemon.service
/etc/guix-publish.conf
/etc/guix-publish.service
+/etc/init.d/guix-daemon
/guix-daemon
/guix/config.scm
/libformat.a
diff --git a/etc/init.d/guix-daemon.in b/etc/init.d/guix-daemon.in
new file mode 100644
index 0000000000..8974a5d215
--- /dev/null
+++ b/etc/init.d/guix-daemon.in
@@ -0,0 +1,88 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides: guix-daemon
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Guix build daemon
+# Description: Provides a daemon that does builds for Guix
+### END INIT INFO
+
+set -e
+set -o pipefail
+mkdir -p "/var/run"
+if [ ! -f "@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon" ]
+then
+ exit 5
+fi
+
+case "$1" in
+start)
+ if [ -f "/var/run/guix-daemon.pid" ]
+ then
+ pid="`cat /var/run/guix-daemon.pid`"
+ if ps www "${pid}" |grep -qa guix-daemon
+ then
+ exit 0
+ else
+ echo "guix-daemon has a stale pid file" >&2
+ exit 1
+ fi
+ else
+ daemonize \
+ -a \
+ -e /var/log/guix-daemon-stderr.log \
+ -o /var/log/guix-daemon-stdout.log \
+ -E GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale \
+ -E LC_ALL=en_US.utf8 \
+ -p /var/run/guix-daemon.pid \
+ @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \
+ --build-users-group=guixbuild
+ fi
+ ;;
+stop)
+ if [ -f "/var/run/guix-daemon.pid" ]
+ then
+ pid="`cat /var/run/guix-daemon.pid`"
+ if ps www "${pid}" |grep -qa guix-daemon
+ then
+ kill "${pid}"
+ sleep 10
+ kill -9 "${pid}" || true
+ exit 0
+ else
+ echo "guix-daemon has a stale pid file" >&2
+ exit 1
+ fi
+ else
+ exit 0
+ fi
+ ;;
+status)
+ if [ -f "/var/run/guix-daemon.pid" ]
+ then
+ pid="`cat /var/run/guix-daemon.pid`"
+ if ps www "${pid}" |grep -qa guix-daemon
+ then
+ echo "guix-daemon is running"
+ exit 0
+ else
+ echo "guix-daemon has a stale pid file"
+ exit 1
+ fi
+ else
+ echo "guix-daemon is not running"
+ exit 3
+ fi
+ ;;
+restart)
+force-reload)
+ "$0" stop
+ "$0" start
+ ;;
+*)
+ echo "Usage: $0 (start|stop|status|restart|force-reload)"
+ exit 3
+ ;;
+esac
diff --git a/nix/local.mk b/nix/local.mk
index dc5a8398b2..a64bdd2137 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -164,6 +164,16 @@ etc/guix-%.service: etc/guix-%.service.in \
"$<" > "$@.tmp"; \
mv "$@.tmp" "$@"
+sysvinitservicedir = $(sysconfdir)/init.d
+nodist_sysvinitservice_DATA = etc/init.d/guix-daemon
+
+etc/init.d/guix-daemon: etc/init.d/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
@@ -177,7 +187,8 @@ etc/guix-%.conf: etc/guix-%.conf.in \
CLEANFILES += \
$(nodist_systemdservice_DATA) \
- $(nodist_upstartjob_DATA)
+ $(nodist_upstartjob_DATA) \
+ $(nodist_sysvinitservice_DATA)
EXTRA_DIST += \
%D%/AUTHORS \
@@ -185,7 +196,8 @@ EXTRA_DIST += \
etc/guix-daemon.service.in \
etc/guix-daemon.conf.in \
etc/guix-publish.service.in \
- etc/guix-publish.conf.in
+ etc/guix-publish.conf.in \
+ etc/init.d/guix-daemon.in
if CAN_RUN_TESTS
Danny Milosavljevic wrote 5 years ago
Re: [PATCH 2/2] guix-install.sh: Install sysv init script.
(address . 39329@debbugs.gnu.org)
20200128170125.620f1582@scratchpost.org
Toggle quote (2 lines)
> + chmod 664 /etc/init.d/guix-daemon;

775
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl4wWtUACgkQ5xo1VCww
uqUCHggAhPw4vvaN4aFLsKI/IOOHK7tLMcSCxR6k6pI69BXtcl4fdOoZ4+6fqhdP
YKsyWGtZOcevk2nsBfN5Bg07hhqjp9r/cIwlcMPbmYBGJMKZMYn9UojZF7tOlMkb
P68a+kBeOXoCWmKvpUSBsG4Zgkq9fXcDlwYrtYd1BcFuYTtargx5HMiyZZoDdIrH
Ua+CFAyrgxAgr0Zpg22m+GECsGOV4ViSRru0E/gO/1m4psC/JSUtYYaE6xvNivlW
l6vGa5kNPBP0W5oXxpGYHwPhuhENbfRaDOnWuJLI/ypx4iHN40ZHugnX/1DX0sat
x7Wu8mErTtadG8eNuldFK4DsHRkfUw==
=m75t
-----END PGP SIGNATURE-----


Danny Milosavljevic wrote 5 years ago
Re: [PATCH 1/2] Add system start-up files for guix-daemon.
(address . 39329@debbugs.gnu.org)
20200128170158.2c7d692c@scratchpost.org
On Tue, 28 Jan 2020 16:58:59 +0100
Danny Milosavljevic <dannym@scratchpost.org> wrote:

Toggle quote (2 lines)
> + if ps www "${pid}" |grep -qa guix-daemon

If pgrep is standard enough, might want to use that. Is it?
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl4wWvYACgkQ5xo1VCww
uqWfewf9HI8Erm9ZCYm+vqYEE6AOUHoW33KQMFJWAJ0d48zol9ujCksqNI0EHXgk
C6TPQRno5Hjxnl2g+bpaRj/zfsp9vOpTBBcwVaeTilOKl9XKxXD5yy0r/pBLlx+j
mdBfzuQGDIGnk0/iNsNKW9N9h12C1BSGqh3UQ7iKkVSozGGqT9pKrV6R17lXNlri
i+rcIzL7A1mNS7BpU8DQTYsoLk4nR5RnljW7NoymafeZAtuXDhipEnkxsZ3WWPiB
hgWGm/K6qrH+gFHMLfqqstz45IP1BiqfC63shbqheIvbbiy0wotMoNDxVi9zdFET
duv7QUp6VwRfZ3JNnSYrHx5MIses8g==
=0ohs
-----END PGP SIGNATURE-----


Danny Milosavljevic wrote 5 years ago
[PATCH v3 1/2] Add system start-up files for guix-daemon.
(address . 39329@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200128162914.13008-2-dannym@scratchpost.org
* etc/init.d/guix-daemon.in: New file.
* nix/local.mk (etc/init.d/guix-daemon): New rule.
(nodist_sysvinitservice_DATA): Add etc/init.d/guix-daemon.in .
(CLEANFILES): Add etc/init.d/guix-daemon .
* .gitignore: Add etc/init.d/guix-daemon .
---
.gitignore | 1 +
etc/init.d/guix-daemon.in | 80 +++++++++++++++++++++++++++++++++++++++
nix/local.mk | 16 +++++++-
3 files changed, 95 insertions(+), 2 deletions(-)
create mode 100644 etc/init.d/guix-daemon.in

Toggle diff (138 lines)
diff --git a/.gitignore b/.gitignore
index df59a9176e..de058dda5e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,6 +71,7 @@
/etc/guix-daemon.service
/etc/guix-publish.conf
/etc/guix-publish.service
+/etc/init.d/guix-daemon
/guix-daemon
/guix/config.scm
/libformat.a
diff --git a/etc/init.d/guix-daemon.in b/etc/init.d/guix-daemon.in
new file mode 100644
index 0000000000..b9c99204df
--- /dev/null
+++ b/etc/init.d/guix-daemon.in
@@ -0,0 +1,80 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides: guix-daemon
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Guix build daemon
+# Description: Provides a daemon that does builds for Guix
+### END INIT INFO
+
+set -e
+mkdir -p "/var/run"
+if [ ! -f "@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon" ]
+then
+ exit 5
+fi
+
+case "$1" in
+start)
+ if [ -f "/var/run/guix-daemon.pid" ]
+ then
+ if pgrep -F "/var/run/guix-daemon.pid" guix-daemon
+ then
+ exit 0
+ else
+ echo "guix-daemon has a stale pid file" >&2
+ exit 1
+ fi
+ else
+ daemonize \
+ -a \
+ -e "/var/log/guix-daemon-stderr.log" \
+ -o "/var/log/guix-daemon-stdout.log" \
+ -E GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale \
+ -E LC_ALL=en_US.utf8 \
+ -p "/var/run/guix-daemon.pid" \
+ @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \
+ --build-users-group=guixbuild
+ fi
+ ;;
+stop)
+ if [ -f "/var/run/guix-daemon.pid" ]
+ then
+ pkill -F "/var/run/guix-daemon.pid" guix-daemon || {
+ exit 1
+ }
+ sleep 10
+ pkill --signal 9 -F "/var/run/guix-daemon.pid" guix-daemon || true
+ exit 0
+ else
+ exit 0
+ fi
+ ;;
+status)
+ if [ -f "/var/run/guix-daemon.pid" ]
+ then
+ if pgrep -F "/var/run/guix-daemon.pid" guix-daemon
+ then
+ echo "guix-daemon is running"
+ exit 0
+ else
+ echo "guix-daemon has a stale pid file"
+ exit 1
+ fi
+ else
+ echo "guix-daemon is not running"
+ exit 3
+ fi
+ ;;
+restart)
+force-reload)
+ "$0" stop
+ "$0" start
+ ;;
+*)
+ echo "Usage: $0 (start|stop|status|restart|force-reload)"
+ exit 3
+ ;;
+esac
diff --git a/nix/local.mk b/nix/local.mk
index dc5a8398b2..a64bdd2137 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -164,6 +164,16 @@ etc/guix-%.service: etc/guix-%.service.in \
"$<" > "$@.tmp"; \
mv "$@.tmp" "$@"
+sysvinitservicedir = $(sysconfdir)/init.d
+nodist_sysvinitservice_DATA = etc/init.d/guix-daemon
+
+etc/init.d/guix-daemon: etc/init.d/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
@@ -177,7 +187,8 @@ etc/guix-%.conf: etc/guix-%.conf.in \
CLEANFILES += \
$(nodist_systemdservice_DATA) \
- $(nodist_upstartjob_DATA)
+ $(nodist_upstartjob_DATA) \
+ $(nodist_sysvinitservice_DATA)
EXTRA_DIST += \
%D%/AUTHORS \
@@ -185,7 +196,8 @@ EXTRA_DIST += \
etc/guix-daemon.service.in \
etc/guix-daemon.conf.in \
etc/guix-publish.service.in \
- etc/guix-publish.conf.in
+ etc/guix-publish.conf.in \
+ etc/init.d/guix-daemon.in
if CAN_RUN_TESTS
Danny Milosavljevic wrote 5 years ago
[PATCH v3 0/2] Start guix-daemon on SysV.
(address . 39329@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200128162914.13008-1-dannym@scratchpost.org
Danny Milosavljevic (2):
Add system start-up files for guix-daemon.
guix-install.sh: Install sysv init script.

.gitignore | 1 +
etc/guix-install.sh | 11 ++++++
etc/init.d/guix-daemon.in | 80 +++++++++++++++++++++++++++++++++++++++
nix/local.mk | 16 +++++++-
4 files changed, 106 insertions(+), 2 deletions(-)
create mode 100644 etc/init.d/guix-daemon.in
Danny Milosavljevic wrote 5 years ago
[PATCH v3 2/2] guix-install.sh: Install sysv init script.
(address . 39329@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200128162914.13008-3-dannym@scratchpost.org
* etc/guix-install.sh (sys_enable_guix_daemon): Install sysv init script.
---
etc/guix-install.sh | 11 +++++++++++
1 file changed, 11 insertions(+)

Toggle diff (22 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index bfd3842933..e7f4d2cd59 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -361,6 +361,17 @@ sys_enable_guix_daemon()
systemctl enable guix-daemon; } &&
_msg "${PAS}enabled Guix daemon via systemd"
;;
+ sysv-init)
+ { mkdir -p /etc/init.d;
+ cp "${ROOT_HOME}/.config/guix/current/etc/init.d/guix-daemon" \
+ /etc/init.d/guix-daemon;
+ chmod 775 /etc/init.d/guix-daemon;
+
+ update-rc.d guix-daemon defaults &&
+ update-rc.d guix-daemon enable &&
+ service guix-daemon start; } &&
+ _msg "${PAS}enabled Guix daemon via sysv"
+ ;;
NA|*)
_msg "${ERR}unsupported init system; run the daemon manually:"
echo " ${ROOT_HOME}/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild"
Danny Milosavljevic wrote 5 years ago
[PATCH v4 0/2] Start guix-daemon on SysV.
(address . 39329@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200128173858.14978-1-dannym@scratchpost.org
Danny Milosavljevic (2):
Add system start-up files for guix-daemon.
guix-install.sh: Install SysV init script.

.gitignore | 1 +
etc/guix-install.sh | 11 ++++++
etc/init.d/guix-daemon.in | 78 +++++++++++++++++++++++++++++++++++++++
nix/local.mk | 16 +++++++-
4 files changed, 104 insertions(+), 2 deletions(-)
create mode 100644 etc/init.d/guix-daemon.in
Danny Milosavljevic wrote 5 years ago
[PATCH v4 2/2] guix-install.sh: Install SysV init script.
(address . 39329@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200128173858.14978-3-dannym@scratchpost.org
* etc/guix-install.sh (sys_enable_guix_daemon): Install SysV init script.
---
etc/guix-install.sh | 11 +++++++++++
1 file changed, 11 insertions(+)

Toggle diff (22 lines)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index bfd3842933..e7f4d2cd59 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -361,6 +361,17 @@ sys_enable_guix_daemon()
systemctl enable guix-daemon; } &&
_msg "${PAS}enabled Guix daemon via systemd"
;;
+ sysv-init)
+ { mkdir -p /etc/init.d;
+ cp "${ROOT_HOME}/.config/guix/current/etc/init.d/guix-daemon" \
+ /etc/init.d/guix-daemon;
+ chmod 775 /etc/init.d/guix-daemon;
+
+ update-rc.d guix-daemon defaults &&
+ update-rc.d guix-daemon enable &&
+ service guix-daemon start; } &&
+ _msg "${PAS}enabled Guix daemon via sysv"
+ ;;
NA|*)
_msg "${ERR}unsupported init system; run the daemon manually:"
echo " ${ROOT_HOME}/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild"
Danny Milosavljevic wrote 5 years ago
[PATCH v4 1/2] Add system start-up files for guix-daemon.
(address . 39329@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200128173858.14978-2-dannym@scratchpost.org
* etc/init.d/guix-daemon.in: New file.
* nix/local.mk (etc/init.d/guix-daemon): New rule.
(nodist_sysvinitservice_DATA): Add etc/init.d/guix-daemon.in .
(CLEANFILES): Add etc/init.d/guix-daemon .
* .gitignore: Add etc/init.d/guix-daemon .
---
.gitignore | 1 +
etc/init.d/guix-daemon.in | 78 +++++++++++++++++++++++++++++++++++++++
nix/local.mk | 16 +++++++-
3 files changed, 93 insertions(+), 2 deletions(-)
create mode 100644 etc/init.d/guix-daemon.in

Toggle diff (136 lines)
diff --git a/.gitignore b/.gitignore
index df59a9176e..de058dda5e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,6 +71,7 @@
/etc/guix-daemon.service
/etc/guix-publish.conf
/etc/guix-publish.service
+/etc/init.d/guix-daemon
/guix-daemon
/guix/config.scm
/libformat.a
diff --git a/etc/init.d/guix-daemon.in b/etc/init.d/guix-daemon.in
new file mode 100644
index 0000000000..80bd18eaeb
--- /dev/null
+++ b/etc/init.d/guix-daemon.in
@@ -0,0 +1,78 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides: guix-daemon
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Guix build daemon
+# Description: Provides a daemon that does builds for Guix
+### END INIT INFO
+
+set -e
+mkdir -p "/var/run"
+if [ ! -f "@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon" ]
+then
+ exit 5
+fi
+
+case "$1" in
+start)
+ if [ -f "/var/run/guix-daemon.pid" ]
+ then
+ if pgrep -F "/var/run/guix-daemon.pid" guix-daemon
+ then
+ exit 0
+ else
+ echo "guix-daemon has a stale pid file" >&2
+ exit 1
+ fi
+ else
+ daemonize \
+ -a \
+ -e "/var/log/guix-daemon-stderr.log" \
+ -o "/var/log/guix-daemon-stdout.log" \
+ -E GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale \
+ -E LC_ALL=en_US.utf8 \
+ -p "/var/run/guix-daemon.pid" \
+ @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \
+ --build-users-group=guixbuild
+ fi
+ ;;
+stop)
+ if [ -f "/var/run/guix-daemon.pid" ]
+ then
+ pkill -F "/var/run/guix-daemon.pid" guix-daemon || {
+ exit 1
+ }
+ exit 0
+ else
+ exit 0
+ fi
+ ;;
+status)
+ if [ -f "/var/run/guix-daemon.pid" ]
+ then
+ if pgrep -F "/var/run/guix-daemon.pid" guix-daemon
+ then
+ echo "guix-daemon is running"
+ exit 0
+ else
+ echo "guix-daemon has a stale pid file"
+ exit 1
+ fi
+ else
+ echo "guix-daemon is not running"
+ exit 3
+ fi
+ ;;
+restart)
+force-reload)
+ "$0" stop
+ "$0" start
+ ;;
+*)
+ echo "Usage: $0 (start|stop|status|restart|force-reload)"
+ exit 3
+ ;;
+esac
diff --git a/nix/local.mk b/nix/local.mk
index dc5a8398b2..a64bdd2137 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -164,6 +164,16 @@ etc/guix-%.service: etc/guix-%.service.in \
"$<" > "$@.tmp"; \
mv "$@.tmp" "$@"
+sysvinitservicedir = $(sysconfdir)/init.d
+nodist_sysvinitservice_DATA = etc/init.d/guix-daemon
+
+etc/init.d/guix-daemon: etc/init.d/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
@@ -177,7 +187,8 @@ etc/guix-%.conf: etc/guix-%.conf.in \
CLEANFILES += \
$(nodist_systemdservice_DATA) \
- $(nodist_upstartjob_DATA)
+ $(nodist_upstartjob_DATA) \
+ $(nodist_sysvinitservice_DATA)
EXTRA_DIST += \
%D%/AUTHORS \
@@ -185,7 +196,8 @@ EXTRA_DIST += \
etc/guix-daemon.service.in \
etc/guix-daemon.conf.in \
etc/guix-publish.service.in \
- etc/guix-publish.conf.in
+ etc/guix-publish.conf.in \
+ etc/init.d/guix-daemon.in
if CAN_RUN_TESTS
Ludovic Courtès wrote 5 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 39329@debbugs.gnu.org)
87lfp5k18x.fsf@gnu.org
Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (6 lines)
> * etc/init.d/guix-daemon.in: New file.
> * nix/local.mk (etc/init.d/guix-daemon): New rule.
> (nodist_sysvinitservice_DATA): Add etc/init.d/guix-daemon.in .
> (CLEANFILES): Add etc/init.d/guix-daemon .
> * .gitignore: Add etc/init.d/guix-daemon .

I haven’t tested the SysV script, but it LGTM!

Could you perhaps mention it in “Binary Install” in the manual, right
after Upstart?

Thanks!

Ludo’.
Ludovic Courtès wrote 5 years ago
Re: [bug#39329] [PATCH v4 2/2] guix-install.sh: Install SysV init script.
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 39329@debbugs.gnu.org)
87h7ztk17t.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (2 lines)
> * etc/guix-install.sh (sys_enable_guix_daemon): Install SysV init script.

[...]

Toggle quote (5 lines)
> + update-rc.d guix-daemon defaults &&
> + update-rc.d guix-daemon enable &&
> + service guix-daemon start; } &&
> + _msg "${PAS}enabled Guix daemon via sysv"

Maybe s/sysv/SysV/ for clarity.

Otherwise LGTM, thank you!

Ludo’.
Danny Milosavljevic wrote 5 years ago
Re: [PATCH v4 0/2] Start guix-daemon on SysV.
(address . 39329@debbugs.gnu.org)
20200311024946.4fee8d4c@scratchpost.org
It might make sense not to use pid files here but to actually test whether the
socket /var/guix/daemon-socket/socket works.

No idea how to do that with just bash. It would be easy in Python.

Committed v4 to guix master as commits 73fbe04107d38f4561636c74d28d7a4935cbb1ef
and fe60ef998f537e0e71bbb3377d5886ad297821d0.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl5oQ7oACgkQ5xo1VCww
uqUNYQf/TzbHBXBr5B9IWSd8szAccAWoz4GUbM2kRcJ4D5PFayNHlDnBRoqSCRy6
idwrkX36IPk4dRz+YFl/6xJ8cC5NbGcom/PNacG6/92oNf+v3AFThJH+OKWFuqny
5BszyCApS/oMEwCfqcnD/q0fC08bIEASahloF4fMMdSAR1n4BZ0kndV1QLt70vX/
l4buvXchDObHRqjIVYfj3b9McjzQesMwnl+mS8AVz6Xh9471dh5O4yr/3Hdp08NF
gyD1Jm96NgK5wc7xyLnTlrW54ox07unx7o0jxN5VD73rwPSR/IENUQzAigy3PtTD
oqUbWN/c0Wq8osnIWGzE8RwAkTOPuw==
=Dqco
-----END PGP SIGNATURE-----


Vincent Legoll wrote 5 years ago
(address . 39329@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
57afed60-5bca-8776-102f-6126396d481c@gmail.com
Hello,

shouldn't this issue be closed ?

--
Vincent Legoll
Leo Famulari wrote 5 years ago
Re: [bug#39329] [PATCH v4 0/2] Start guix-daemon on SysV.
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
20200413174623.GA23262@jasmine.lan
On Mon, Apr 13, 2020 at 07:02:46PM +0200, Vincent Legoll wrote:
Toggle quote (4 lines)
> Hello,
>
> shouldn't this issue be closed ?

Yup, done!

Feel free to do this in the future by sending a message to
<NNN-done@debbugs.gnu.org>, where NNN is the bug number.
Closed
Danny Milosavljevic wrote 5 years ago
Re: [PATCH v4 0/2] Start guix-daemon on SysV.
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)(address . 39329@debbugs.gnu.org)
20200413200829.7ceb3c7e@scratchpost.org
Hi Vincent,

I don't know whether it actually works.

I don't feel great just closing this because of that.

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?

Also, it would be a lot better to just check for
/var/guix/daemon-socket/socket availability and usability--but I have no idea
how to use UNIX domain sockets with bash or with tools that would be available
everywhere.

PID files are awful.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl6Uqp0ACgkQ5xo1VCww
uqUxMQgAgkkEjznWb0zpONg1akRY+BOH0NmGf/qz15t61WL4R8lomQpvKl+BAlIq
UjVNJPp2EzvWwExKpJRs73whvP+h8hjUtS5DmzIbG88oZal6Nkb0e0bMl9I6B64h
WkHPAETs41xuv1CCLTuSsT/TN37MOiJzE5mBlRePQ4Mg4kpIORdDVpPwmx+kCo52
t0Ite1s737nKWpjYamA8LwfWh1OtX7igcZ7llN4ONCBx8X2wQmFiKsPgEXTJSsBA
8pxgdRxKaCVeN2rrrvChpOU91JlixH1O1qEFR2Rel3OigWt4NsrzPOEmivwb6IGj
4CgX+8v0GsRbIjHnr/KNIOY9nBxbjA==
=3KyC
-----END PGP SIGNATURE-----


Leo Famulari wrote 5 years ago
Re: [bug#39329] [PATCH v4 0/2] Start guix-daemon on SysV.
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200413182145.GA24906@jasmine.lan
On Mon, Apr 13, 2020 at 08:08:29PM +0200, Danny Milosavljevic wrote:
Toggle quote (4 lines)
> 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]

Toggle quote (4 lines)
> 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.

Toggle quote (7 lines)
> Also, it would be a lot better to just check for
> /var/guix/daemon-socket/socket availability and usability--but I have no idea
> how to use UNIX domain sockets with bash or with tools that would be available
> everywhere.
>
> PID files are awful.

Yeah... there's a reason everyone switched to systemd.

[0]
Vincent Legoll wrote 5 years ago
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
?
Your comment

This issue is archived.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 39329
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help