mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-30 08:02:38 -05:00
4cbe0127a6
Also ensure prompt_yes_no always print the message with a trailing space, which is more pleasing to the eye. * etc/guix-daemon.conf.in <--discover=no>: New guix-daemon option. * etc/guix-daemon.service.in: Likewise. * etc/init.d/guix-daemon.in: Likewise. * etc/openrc/guix-daemon.in: Likewise. * etc/guix-install.sh (configure_substitute_discovery): New procedure. (sys_enable_guix_daemon): Ask the user whether automatic substitute discovery should be enabled. Set the '--discover' argument accordingly. (prompt_yes_no): Add a trailing space to the message. (sys_authorize_build_farms): Remove trailing space from the message argument. * NEWS (Distribution): Add news.
78 lines
1.7 KiB
Bash
78 lines
1.7 KiB
Bash
#!/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 --discover=no
|
|
fi
|
|
;;
|
|
stop)
|
|
if [ -f "/var/run/guix-daemon.pid" ]
|
|
then
|
|
pkill -F "/var/run/guix-daemon.pid" guix-daemon || {
|
|
exit 1
|
|
}
|
|
rm -f "/var/run/guix-daemon.pid"
|
|
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
|