fix(crypt-loop): shellcheck for modules.d/91crypt-loop
parent
ad4f8d13f1
commit
2d98cb6f63
|
@ -15,23 +15,26 @@ loop_decrypt() {
|
||||||
local keypath="$2"
|
local keypath="$2"
|
||||||
local keydev="$3"
|
local keydev="$3"
|
||||||
local device="$4"
|
local device="$4"
|
||||||
|
local key
|
||||||
|
|
||||||
local key="/dev/mapper/$(str_replace "loop-$keydev-$mntp-$keypath" '/' '-')"
|
key="/dev/mapper/$(str_replace "loop-$keydev-$mntp-$keypath" '/' '-')"
|
||||||
|
|
||||||
if [ ! -b $key ]; then
|
if [ ! -b "$key" ]; then
|
||||||
local loopdev=$(losetup -f "${mntp}/${keypath}" --show)
|
local loopdev
|
||||||
local opts="-d - luksOpen $loopdev ${key##*/}"
|
local opts
|
||||||
|
loopdev=$(losetup -f "${mntp}/${keypath}" --show)
|
||||||
|
opts="-d - luksOpen $loopdev ${key##*/}"
|
||||||
|
|
||||||
ask_for_password \
|
ask_for_password \
|
||||||
--cmd "cryptsetup $opts" \
|
--cmd "cryptsetup $opts" \
|
||||||
--prompt "Password ($keypath on $keydev for $device)" \
|
--prompt "Password ($keypath on $keydev for $device)" \
|
||||||
--tty-echo-off
|
--tty-echo-off
|
||||||
|
|
||||||
[ -b $key ] || die "Failed to unlock $keypath on $keydev for $device."
|
[ -b "$key" ] || die "Failed to unlock $keypath on $keydev for $device."
|
||||||
|
|
||||||
printf "%s\n" "cryptsetup luksClose \"$key\"" > ${hookdir}/cleanup/"crypt-loop-cleanup-10-${key##*/}".sh
|
printf "%s\n" "cryptsetup luksClose \"$key\"" > "${hookdir}/cleanup/crypt-loop-cleanup-10-${key##*/}.sh"
|
||||||
printf "%s\n" "losetup -d \"$loopdev\"" > ${hookdir}/cleanup/"crypt-loop-cleanup-20-${loopdev##*/}".sh
|
printf "%s\n" "losetup -d \"$loopdev\"" > "${hookdir}/cleanup/crypt-loop-cleanup-20-${loopdev##*/}.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat $key
|
cat "$key"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue