diff options
author | Michael Niewöhner <[email protected]> | 2019-03-17 22:47:15 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-03-29 15:17:23 -0700 |
commit | e03b25a56443c79a53327806fa4cc5a2b6acd70c (patch) | |
tree | e0439109b1d5afa4a79809d0309a490c66d23a38 | |
parent | 3b2618927c666aaa7458bfe3a9cdd15d8e537864 (diff) |
Fix systemd-import services
On debian, systemd complains about missing /bin/awk because it
actually is located at /usr/bin/awk. It is not a good idea to
hardcode binary paths because different linux distros use different
paths. According to systemd's man page it is absolutely safe to
miss paths for binaries located at standard locations (/bin,
/sbin, /usr/bin, ...).
Further, replace this more or less complicated awk command by
grep.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Michael Niewöhner <[email protected]>
Issue #8510
-rw-r--r-- | etc/systemd/system/zfs-import-cache.service.in | 2 | ||||
-rw-r--r-- | etc/systemd/system/zfs-import-scan.service.in | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/etc/systemd/system/zfs-import-cache.service.in b/etc/systemd/system/zfs-import-cache.service.in index 73f77e989..8087a294d 100644 --- a/etc/systemd/system/zfs-import-cache.service.in +++ b/etc/systemd/system/zfs-import-cache.service.in @@ -13,7 +13,7 @@ ConditionPathExists=@sysconfdir@/zfs/zpool.cache Type=oneshot RemainAfterExit=yes ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN -ExecStartPost=/bin/sh -c "/bin/systemctl set-environment BOOTFS=$(@sbindir@/zpool list -H -o bootfs | /bin/awk '$1 != \"-\" {print; exit}')" +ExecStartPost=/bin/sh -c "/bin/systemctl set-environment BOOTFS=$(@sbindir@/zpool list -H -o bootfs | grep -m1 -v '^-$')" [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 1b6a0d4d3..802328da3 100644 --- a/etc/systemd/system/zfs-import-scan.service.in +++ b/etc/systemd/system/zfs-import-scan.service.in @@ -12,7 +12,7 @@ ConditionPathExists=!@sysconfdir@/zfs/zpool.cache Type=oneshot RemainAfterExit=yes ExecStart=@sbindir@/zpool import -aN -o cachefile=none -ExecStartPost=/bin/sh -c "/bin/systemctl set-environment BOOTFS=$(@sbindir@/zpool list -H -o bootfs | /bin/awk '$1 != \"-\" {print; exit}')" +ExecStartPost=/bin/sh -c "/bin/systemctl set-environment BOOTFS=$(@sbindir@/zpool list -H -o bootfs | grep -m1 -v '^-$')" [Install] WantedBy=zfs-import.target |