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 <behlendorf1@llnl.gov> Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Issue #8510
This commit is contained in:
parent
3b2618927c
commit
e03b25a564
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue