Skip to content

Commit

Permalink
systemd: read initconfdir
Browse files Browse the repository at this point in the history
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 <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Signed-off-by: Krzysztof Piecuch <piecuch@kpiecuch.pl>
Closes openzfs#12946
  • Loading branch information
pikrzysztof authored and nicman23 committed Aug 22, 2022
1 parent 5b80709 commit 08a0ce8
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions etc/systemd/system/zfs-import-cache.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions etc/systemd/system/zfs-import-scan.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions etc/systemd/system/zfs-mount.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ConditionPathIsDirectory=/sys/module/zfs
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-@initconfdir@/zfs
ExecStart=@sbindir@/zfs mount -a

[Install]
Expand Down
3 changes: 2 additions & 1 deletion etc/systemd/system/zfs-scrub@.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -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'
1 change: 1 addition & 0 deletions etc/systemd/system/zfs-share.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ConditionPathIsDirectory=/sys/module/zfs
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-@initconfdir@/zfs
ExecStart=@sbindir@/zfs share -a

[Install]
Expand Down
1 change: 1 addition & 0 deletions etc/systemd/system/zfs-volume-wait.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ConditionPathIsDirectory=/sys/module/zfs
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-@initconfdir@/zfs
ExecStart=@bindir@/zvol_wait

[Install]
Expand Down
1 change: 1 addition & 0 deletions etc/systemd/system/zfs-zed.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Documentation=man:zed(8)
ConditionPathIsDirectory=/sys/module/zfs

[Service]
EnvironmentFile=-@initconfdir@/zfs
ExecStart=@sbindir@/zed -F
Restart=on-abort

Expand Down

0 comments on commit 08a0ce8

Please sign in to comment.