aboutsummaryrefslogtreecommitdiffstats
path: root/etc/systemd
diff options
context:
space:
mode:
authorInsanePrawn <[email protected]>2020-01-11 19:14:23 +0100
committerBrian Behlendorf <[email protected]>2020-02-14 15:32:33 -0800
commit9d2f3b7f94b62939de3fb50c8d9a2d78477f8627 (patch)
tree95b4b077bdf5d2e704c96a4e0b833bbaff7f36fa /etc/systemd
parent13b5a4d5c018f94d04efefcec6205aa73205e05f (diff)
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 <[email protected]> Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #9649
Diffstat (limited to 'etc/systemd')
-rwxr-xr-xetc/systemd/system-generators/zfs-mount-generator.in25
1 files changed, 14 insertions, 11 deletions
diff --git a/etc/systemd/system-generators/zfs-mount-generator.in b/etc/systemd/system-generators/zfs-mount-generator.in
index b79ce5482..411b3f955 100755
--- a/etc/systemd/system-generators/zfs-mount-generator.in
+++ b/etc/systemd/system-generators/zfs-mount-generator.in
@@ -60,6 +60,7 @@ process_line() {
IFS="$(printf '\t')"
# protect against special characters in, e.g., mountpoints
set -f
+ # shellcheck disable=SC2086
set -- $1
dataset="${1}"
p_mountpoint="${2}"
@@ -87,17 +88,19 @@ process_line() {
pathdep="RequiresMountsFor='${p_keyloc#file://}'"
keyloadcmd="@sbindir@/zfs load-key '${dataset}'"
elif [ "${p_keyloc}" = "prompt" ] ; then
- keyloadcmd="/bin/sh -c 'set -eu;"\
-"keystatus=\"\$\$(@sbindir@/zfs get -H -o value keystatus \"${dataset}\")\";"\
-"[ \"\$\$keystatus\" = \"unavailable\" ] || exit 0;"\
-"count=0;"\
-"while [ \$\$count -lt 3 ];do"\
-" systemd-ask-password --id=\"zfs:${dataset}\""\
-" \"Enter passphrase for ${dataset}:\"|"\
-" @sbindir@/zfs load-key \"${dataset}\" && exit 0;"\
-" count=\$\$((count + 1));"\
-"done;"\
-"exit 1'"
+ keyloadcmd="\
+/bin/sh -c '\
+set -eu;\
+keystatus=\"\$\$(@sbindir@/zfs get -H -o value keystatus \"${dataset}\")\";\
+[ \"\$\$keystatus\" = \"unavailable\" ] || exit 0;\
+count=0;\
+while [ \$\$count -lt 3 ];do\
+ systemd-ask-password --id=\"zfs:${dataset}\"\
+ \"Enter passphrase for ${dataset}:\"|\
+ @sbindir@/zfs load-key \"${dataset}\" && exit 0;\
+ count=\$\$((count + 1));\
+done;\
+exit 1'"
else
printf 'zfs-mount-generator: (%s) invalid keylocation\n' \
"${dataset}" >/dev/kmsg