From 79b20949b25c8db4d379f6486b0835a6613b480c Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov <19779+xnox@users.noreply.github.com> Date: Wed, 24 May 2023 20:31:28 +0100 Subject: [PATCH] systemd: Use non-absolute paths in Exec* lines Since systemd v239, Exec* binaries are resolved from PATH when they are not-absolute. Switch to this by default for ease of downstream maintenance. Many downstream distributions move individual binaries to locations that existing compile-time configurations cannot accommodate. Reviewed-by: Brian Behlendorf Signed-off-by: Dimitri John Ledkov Closes #14880 --- etc/systemd/system/zfs-import-cache.service.in | 2 +- etc/systemd/system/zfs-import-scan.service.in | 2 +- etc/systemd/system/zfs-mount.service.in | 2 +- etc/systemd/system/zfs-scrub@.service.in | 10 +++++----- etc/systemd/system/zfs-share.service.in | 2 +- etc/systemd/system/zfs-trim@.service.in | 10 +++++----- etc/systemd/system/zfs-volume-wait.service.in | 2 +- etc/systemd/system/zfs-zed.service.in | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/etc/systemd/system/zfs-import-cache.service.in b/etc/systemd/system/zfs-import-cache.service.in index fd822989da..6d9a065e7e 100644 --- a/etc/systemd/system/zfs-import-cache.service.in +++ b/etc/systemd/system/zfs-import-cache.service.in @@ -15,7 +15,7 @@ ConditionPathIsDirectory=/sys/module/zfs Type=oneshot RemainAfterExit=yes EnvironmentFile=-@initconfdir@/zfs -ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN $ZPOOL_IMPORT_OPTS +ExecStart=zpool import -c @sysconfdir@/zfs/zpool.cache -aN $ZPOOL_IMPORT_OPTS [Install] WantedBy=zfs-import.target diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in index c5dd45d87e..fb524f3b08 100644 --- a/etc/systemd/system/zfs-import-scan.service.in +++ b/etc/systemd/system/zfs-import-scan.service.in @@ -14,7 +14,7 @@ ConditionPathIsDirectory=/sys/module/zfs Type=oneshot RemainAfterExit=yes EnvironmentFile=-@initconfdir@/zfs -ExecStart=@sbindir@/zpool import -aN -o cachefile=none $ZPOOL_IMPORT_OPTS +ExecStart=zpool import -aN -o cachefile=none $ZPOOL_IMPORT_OPTS [Install] WantedBy=zfs-import.target diff --git a/etc/systemd/system/zfs-mount.service.in b/etc/systemd/system/zfs-mount.service.in index 66d894923f..fc4e1c49f1 100644 --- a/etc/systemd/system/zfs-mount.service.in +++ b/etc/systemd/system/zfs-mount.service.in @@ -12,7 +12,7 @@ ConditionPathIsDirectory=/sys/module/zfs Type=oneshot RemainAfterExit=yes EnvironmentFile=-@initconfdir@/zfs -ExecStart=@sbindir@/zfs mount -a +ExecStart=zfs mount -a [Install] WantedBy=zfs.target diff --git a/etc/systemd/system/zfs-scrub@.service.in b/etc/systemd/system/zfs-scrub@.service.in index 8ffffeb0cf..2bb2757d5e 100644 --- a/etc/systemd/system/zfs-scrub@.service.in +++ b/etc/systemd/system/zfs-scrub@.service.in @@ -8,8 +8,8 @@ ConditionPathIsDirectory=/sys/module/zfs [Service] EnvironmentFile=-@initconfdir@/zfs -ExecStart=/bin/sh -c '\ -if @sbindir@/zpool status %i | grep -q "scrub in progress"; then\ -exec @sbindir@/zpool wait -t scrub %i;\ -else exec @sbindir@/zpool scrub -w %i; fi' -ExecStop=-/bin/sh -c '@sbindir@/zpool scrub -p %i 2>/dev/null || true' +ExecStart=sh -c '\ +if zpool status %i | grep -q "scrub in progress"; then\ +exec zpool wait -t scrub %i;\ +else exec zpool scrub -w %i; fi' +ExecStop=-sh -c 'zpool scrub -p %i 2>/dev/null || true' diff --git a/etc/systemd/system/zfs-share.service.in b/etc/systemd/system/zfs-share.service.in index 1a6342a06f..dd321f490f 100644 --- a/etc/systemd/system/zfs-share.service.in +++ b/etc/systemd/system/zfs-share.service.in @@ -14,7 +14,7 @@ ConditionPathIsDirectory=/sys/module/zfs Type=oneshot RemainAfterExit=yes EnvironmentFile=-@initconfdir@/zfs -ExecStart=@sbindir@/zfs share -a +ExecStart=zfs share -a [Install] WantedBy=zfs.target diff --git a/etc/systemd/system/zfs-trim@.service.in b/etc/systemd/system/zfs-trim@.service.in index 423fb448c1..f55e36cd84 100644 --- a/etc/systemd/system/zfs-trim@.service.in +++ b/etc/systemd/system/zfs-trim@.service.in @@ -8,8 +8,8 @@ ConditionPathIsDirectory=/sys/module/zfs [Service] EnvironmentFile=-@initconfdir@/zfs -ExecStart=/bin/sh -c '\ -if @sbindir@/zpool status %i | grep -q "(trimming)"; then\ -exec @sbindir@/zpool wait -t trim %i;\ -else exec @sbindir@/zpool trim -w %i; fi' -ExecStop=-/bin/sh -c '@sbindir@/zpool trim -s %i 2>/dev/null || true' +ExecStart=sh -c '\ +if zpool status %i | grep -q "(trimming)"; then\ +exec zpool wait -t trim %i;\ +else exec zpool trim -w %i; fi' +ExecStop=-sh -c 'zpool trim -s %i 2>/dev/null || true' diff --git a/etc/systemd/system/zfs-volume-wait.service.in b/etc/systemd/system/zfs-volume-wait.service.in index 110c0f5f52..a86a3561e0 100644 --- a/etc/systemd/system/zfs-volume-wait.service.in +++ b/etc/systemd/system/zfs-volume-wait.service.in @@ -9,7 +9,7 @@ ConditionPathIsDirectory=/sys/module/zfs Type=oneshot RemainAfterExit=yes EnvironmentFile=-@initconfdir@/zfs -ExecStart=@bindir@/zvol_wait +ExecStart=zvol_wait [Install] WantedBy=zfs-volumes.target diff --git a/etc/systemd/system/zfs-zed.service.in b/etc/systemd/system/zfs-zed.service.in index be2fc67348..ac58ad3eff 100644 --- a/etc/systemd/system/zfs-zed.service.in +++ b/etc/systemd/system/zfs-zed.service.in @@ -5,7 +5,7 @@ ConditionPathIsDirectory=/sys/module/zfs [Service] EnvironmentFile=-@initconfdir@/zfs -ExecStart=@sbindir@/zed -F +ExecStart=zed -F Restart=always [Install]