From ccdcc1dbe8b2b741194cdbc5b81bdb8b58cc7142 Mon Sep 17 00:00:00 2001 From: Krzysztof Piecuch <3964215+pikrzysztof@users.noreply.github.com> Date: Tue, 22 Feb 2022 20:59:11 +0000 Subject: [PATCH] systemd: read initconfdir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Systemd units do not read @initconfdir@ but refer to variables defined there, also a minor fixup in zfs-scrub service file. Reviewed-by: Ahelenia ZiemiaƄska Reviewed-by: George Melikov Reviewed-by: Brian Behlendorf Reviewed-by: Damian Szuberski Signed-off-by: Krzysztof Piecuch Closes #12946 --- etc/systemd/system/zfs-import-cache.service.in | 1 + etc/systemd/system/zfs-import-scan.service.in | 1 + etc/systemd/system/zfs-mount.service.in | 1 + etc/systemd/system/zfs-scrub@.service.in | 3 ++- etc/systemd/system/zfs-share.service.in | 1 + etc/systemd/system/zfs-volume-wait.service.in | 1 + etc/systemd/system/zfs-zed.service.in | 1 + 7 files changed, 8 insertions(+), 1 deletion(-) diff --git a/etc/systemd/system/zfs-import-cache.service.in b/etc/systemd/system/zfs-import-cache.service.in index 5e5c6281c9..08c11698bc 100644 --- a/etc/systemd/system/zfs-import-cache.service.in +++ b/etc/systemd/system/zfs-import-cache.service.in @@ -14,6 +14,7 @@ ConditionPathIsDirectory=/sys/module/zfs [Service] Type=oneshot RemainAfterExit=yes +EnvironmentFile=-@initconfdir@/zfs ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN $ZPOOL_IMPORT_OPTS [Install] diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in index d3c083f7e9..c37f70f13b 100644 --- a/etc/systemd/system/zfs-import-scan.service.in +++ b/etc/systemd/system/zfs-import-scan.service.in @@ -13,6 +13,7 @@ ConditionPathIsDirectory=/sys/module/zfs [Service] Type=oneshot RemainAfterExit=yes +EnvironmentFile=-@initconfdir@/zfs ExecStart=@sbindir@/zpool import -aN -o cachefile=none $ZPOOL_IMPORT_OPTS [Install] diff --git a/etc/systemd/system/zfs-mount.service.in b/etc/systemd/system/zfs-mount.service.in index 3ab82fb033..66d894923f 100644 --- a/etc/systemd/system/zfs-mount.service.in +++ b/etc/systemd/system/zfs-mount.service.in @@ -11,6 +11,7 @@ ConditionPathIsDirectory=/sys/module/zfs [Service] Type=oneshot RemainAfterExit=yes +EnvironmentFile=-@initconfdir@/zfs ExecStart=@sbindir@/zfs mount -a [Install] diff --git a/etc/systemd/system/zfs-scrub@.service.in b/etc/systemd/system/zfs-scrub@.service.in index bebe91d746..8ffffeb0cf 100644 --- a/etc/systemd/system/zfs-scrub@.service.in +++ b/etc/systemd/system/zfs-scrub@.service.in @@ -7,8 +7,9 @@ ConditionACPower=true ConditionPathIsDirectory=/sys/module/zfs [Service] +EnvironmentFile=-@initconfdir@/zfs ExecStart=/bin/sh -c '\ -if @sbindir@/zpool status %i | grep "scrub in progress"; then\ +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' diff --git a/etc/systemd/system/zfs-share.service.in b/etc/systemd/system/zfs-share.service.in index 745077513c..263055e528 100644 --- a/etc/systemd/system/zfs-share.service.in +++ b/etc/systemd/system/zfs-share.service.in @@ -13,6 +13,7 @@ ConditionPathIsDirectory=/sys/module/zfs [Service] Type=oneshot RemainAfterExit=yes +EnvironmentFile=-@initconfdir@/zfs ExecStart=@sbindir@/zfs share -a [Install] diff --git a/etc/systemd/system/zfs-volume-wait.service.in b/etc/systemd/system/zfs-volume-wait.service.in index 4c77724d8b..110c0f5f52 100644 --- a/etc/systemd/system/zfs-volume-wait.service.in +++ b/etc/systemd/system/zfs-volume-wait.service.in @@ -8,6 +8,7 @@ ConditionPathIsDirectory=/sys/module/zfs [Service] Type=oneshot RemainAfterExit=yes +EnvironmentFile=-@initconfdir@/zfs ExecStart=@bindir@/zvol_wait [Install] diff --git a/etc/systemd/system/zfs-zed.service.in b/etc/systemd/system/zfs-zed.service.in index 008075138f..73a83e59e5 100644 --- a/etc/systemd/system/zfs-zed.service.in +++ b/etc/systemd/system/zfs-zed.service.in @@ -4,6 +4,7 @@ Documentation=man:zed(8) ConditionPathIsDirectory=/sys/module/zfs [Service] +EnvironmentFile=-@initconfdir@/zfs ExecStart=@sbindir@/zed -F Restart=on-abort