guix-install.sh: Remove any old systemd units first.

Don't clobber /dev/null permissions if units are masked.

* etc/guix-install.sh (sys_enable_guix_daemon): Factor out unit
installation.  Unconditionally remove any old units.  Install and enable
gnu-store.mount after guix-daemon.service.
This commit is contained in:
Tobias Geerinckx-Rice 2023-07-09 02:00:01 +02:00
parent 024f78aba2
commit 93243a6ca4
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -434,24 +434,27 @@ sys_enable_guix_daemon()
_msg "${PAS}enabled Guix daemon via upstart" _msg "${PAS}enabled Guix daemon via upstart"
;; ;;
systemd) systemd)
{ # systemd .mount units must be named after the target directory. { install_unit()
# Here we assume a hard-coded name of /gnu/store. {
# XXX Work around <https://issues.guix.gnu.org/41356> until next release. local dest="/etc/systemd/system/$1"
cp ~root/.config/guix/current/lib/systemd/system/gnu-store.mount \ rm -f "$dest"
/etc/systemd/system/; cp ~root/.config/guix/current/lib/systemd/system/"$1" "$dest"
chmod 664 /etc/systemd/system/gnu-store.mount; chmod 664 "$dest"
systemctl daemon-reload && systemctl daemon-reload
systemctl enable gnu-store.mount; systemctl enable "$1"
}
cp ~root/.config/guix/current/lib/systemd/system/guix-daemon.service \ install_unit guix-daemon.service
/etc/systemd/system/;
chmod 664 /etc/systemd/system/guix-daemon.service;
configure_substitute_discovery \ configure_substitute_discovery \
/etc/systemd/system/guix-daemon.service /etc/systemd/system/guix-daemon.service
# Install after guix-daemon.service to avoid a harmless warning.
# systemd .mount units must be named after the target directory.
# Here we assume a hard-coded name of /gnu/store.
install_unit gnu-store.mount
systemctl daemon-reload && systemctl daemon-reload &&
systemctl enable guix-daemon &&
systemctl start guix-daemon; } && systemctl start guix-daemon; } &&
_msg "${PAS}enabled Guix daemon via systemd" _msg "${PAS}enabled Guix daemon via systemd"
;; ;;