etc/systemd/zfs-mount-generator: don't fail if no cached pools

If $FSLIST exists but is empty, the generator fails with
  sort: cannot read: '/etc/zfs/zfs-list.cache/*':
  No such file or directory

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11915
This commit is contained in:
наб 2021-04-19 19:52:44 +02:00 committed by Brian Behlendorf
parent 219acd907b
commit 478b8ec8f2

View File

@ -28,6 +28,7 @@ set -e
FSLIST="@sysconfdir@/zfs/zfs-list.cache" FSLIST="@sysconfdir@/zfs/zfs-list.cache"
[ -d "${FSLIST}" ] || exit 0 [ -d "${FSLIST}" ] || exit 0
[ "$(echo "${FSLIST}"/*)" = "${FSLIST}/*" ] && exit 0
do_fail() { do_fail() {
printf 'zfs-mount-generator: %s\n' "$*" > /dev/kmsg printf 'zfs-mount-generator: %s\n' "$*" > /dev/kmsg