summary refs log tree commit diff
path: root/etc
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2023-07-09 02:00:01 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2023-07-09 02:00:09 +0200
commit93243a6ca4e6b8f6b6c1aa9ee097bca8432a2b35 (patch)
treef6292be89669c952093920e8337b85ea2b5dd737 /etc
parent024f78aba21f1b97420072e2d3b060bd282d2230 (diff)
downloadguix-93243a6ca4e6b8f6b6c1aa9ee097bca8432a2b35.tar.gz
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.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/guix-install.sh29
1 files changed, 16 insertions, 13 deletions
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 74f7688cab..fc14471f1a 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -434,24 +434,27 @@ sys_enable_guix_daemon()
                 _msg "${PAS}enabled Guix daemon via upstart"
             ;;
         systemd)
-            { # systemd .mount units must be named after the target directory.
-              # Here we assume a hard-coded name of /gnu/store.
-              # XXX Work around <https://issues.guix.gnu.org/41356> until next release.
-              cp ~root/.config/guix/current/lib/systemd/system/gnu-store.mount \
-                 /etc/systemd/system/;
-              chmod 664 /etc/systemd/system/gnu-store.mount;
-              systemctl daemon-reload &&
-                  systemctl enable gnu-store.mount;
-
-              cp ~root/.config/guix/current/lib/systemd/system/guix-daemon.service \
-                 /etc/systemd/system/;
-              chmod 664 /etc/systemd/system/guix-daemon.service;
+            { install_unit()
+              {
+                  local dest="/etc/systemd/system/$1"
+                  rm -f "$dest"
+                  cp ~root/.config/guix/current/lib/systemd/system/"$1" "$dest"
+                  chmod 664 "$dest"
+                  systemctl daemon-reload
+                  systemctl enable "$1"
+              }
+
+              install_unit guix-daemon.service
 
               configure_substitute_discovery \
                   /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 enable guix-daemon &&
                   systemctl start  guix-daemon; } &&
                 _msg "${PAS}enabled Guix daemon via systemd"
             ;;