Skip to content

Commit

Permalink
Fix systemd-import services
Browse files Browse the repository at this point in the history
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 linux distros use different paths. According to systemd's
man page it is absolutely safe to miss paths for binary located at
standard locations (/bin, /sbin, /usr/bin, ...).

Further, replace this more or less complicated awk command by egrep.

Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
  • Loading branch information
c0d3z3r0 committed Mar 22, 2019
1 parent 5c67dfe commit efe7c08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion etc/systemd/system/zfs-import-cache.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 -v '^-$' | head -1)"

[Install]
WantedBy=zfs-import.target
2 changes: 1 addition & 1 deletion etc/systemd/system/zfs-import-scan.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 -v '^-$' | head -1)"

[Install]
WantedBy=zfs-import.target

0 comments on commit efe7c08

Please sign in to comment.