Systemd mount generator: Silence shellcheck warnings
Silences a warning about an intentionally unquoted variable. Fixes a warning caused by strings split across lines by slightly refactoring keyloadcmd. Reviewed-by: Richard Laager <rlaager@wiktel.com> Reviewed-by: Antonio Russo <antonio.e.russo@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: InsanePrawn <insane.prawny@gmail.com> Closes #9649
This commit is contained in:
parent
13b5a4d5c0
commit
9d2f3b7f94
|
@ -60,6 +60,7 @@ process_line() {
|
||||||
IFS="$(printf '\t')"
|
IFS="$(printf '\t')"
|
||||||
# protect against special characters in, e.g., mountpoints
|
# protect against special characters in, e.g., mountpoints
|
||||||
set -f
|
set -f
|
||||||
|
# shellcheck disable=SC2086
|
||||||
set -- $1
|
set -- $1
|
||||||
dataset="${1}"
|
dataset="${1}"
|
||||||
p_mountpoint="${2}"
|
p_mountpoint="${2}"
|
||||||
|
@ -87,17 +88,19 @@ process_line() {
|
||||||
pathdep="RequiresMountsFor='${p_keyloc#file://}'"
|
pathdep="RequiresMountsFor='${p_keyloc#file://}'"
|
||||||
keyloadcmd="@sbindir@/zfs load-key '${dataset}'"
|
keyloadcmd="@sbindir@/zfs load-key '${dataset}'"
|
||||||
elif [ "${p_keyloc}" = "prompt" ] ; then
|
elif [ "${p_keyloc}" = "prompt" ] ; then
|
||||||
keyloadcmd="/bin/sh -c 'set -eu;"\
|
keyloadcmd="\
|
||||||
"keystatus=\"\$\$(@sbindir@/zfs get -H -o value keystatus \"${dataset}\")\";"\
|
/bin/sh -c '\
|
||||||
"[ \"\$\$keystatus\" = \"unavailable\" ] || exit 0;"\
|
set -eu;\
|
||||||
"count=0;"\
|
keystatus=\"\$\$(@sbindir@/zfs get -H -o value keystatus \"${dataset}\")\";\
|
||||||
"while [ \$\$count -lt 3 ];do"\
|
[ \"\$\$keystatus\" = \"unavailable\" ] || exit 0;\
|
||||||
" systemd-ask-password --id=\"zfs:${dataset}\""\
|
count=0;\
|
||||||
" \"Enter passphrase for ${dataset}:\"|"\
|
while [ \$\$count -lt 3 ];do\
|
||||||
" @sbindir@/zfs load-key \"${dataset}\" && exit 0;"\
|
systemd-ask-password --id=\"zfs:${dataset}\"\
|
||||||
" count=\$\$((count + 1));"\
|
\"Enter passphrase for ${dataset}:\"|\
|
||||||
"done;"\
|
@sbindir@/zfs load-key \"${dataset}\" && exit 0;\
|
||||||
"exit 1'"
|
count=\$\$((count + 1));\
|
||||||
|
done;\
|
||||||
|
exit 1'"
|
||||||
else
|
else
|
||||||
printf 'zfs-mount-generator: (%s) invalid keylocation\n' \
|
printf 'zfs-mount-generator: (%s) invalid keylocation\n' \
|
||||||
"${dataset}" >/dev/kmsg
|
"${dataset}" >/dev/kmsg
|
||||||
|
|
Loading…
Reference in New Issue