fix(dm): shellcheck for modules.d/90dm

master
Harald Hoyer 2021-03-26 10:29:19 +01:00 committed by Daniel Molkentin
parent 2536a9eaff
commit f6597b0d51
2 changed files with 9 additions and 9 deletions

0
modules.d/90dm/.shchkdir Normal file
View File

View File

@ -5,19 +5,19 @@ _remove_dm() {
local s
local devname

for s in /sys/block/${dev}/holders/dm-*; do
[ -e ${s} ] || continue
_remove_dm ${s##*/}
for s in /sys/block/"${dev}"/holders/dm-*; do
[ -e "${s}" ] || continue
_remove_dm "${s##*/}"
done
# multipath devices might have MD devices on top,
# which are removed after this script. So do not
# remove those to avoid spurious errors
case $(cat /sys/block/${dev}/dm/uuid) in
case $(cat /sys/block/"${dev}"/dm/uuid) in
mpath-*)
return 0
;;
*)
devname=$(cat /sys/block/${dev}/dm/name)
devname=$(cat /sys/block/"${dev}"/dm/name)
dmsetup -v --noudevsync remove "$devname" || return $?
;;
esac
@ -31,11 +31,11 @@ _do_dm_shutdown() {

info "Disassembling device-mapper devices"
for dev in /sys/block/dm-*; do
[ -e ${dev} ] || continue
[ -e "${dev}" ] || continue
if [ "x$final" != "x" ]; then
_remove_dm ${dev##*/} || ret=$?
_remove_dm "${dev##*/}" || ret=$?
else
_remove_dm ${dev##*/} > /dev/null 2>&1 || ret=$?
_remove_dm "${dev##*/}" > /dev/null 2>&1 || ret=$?
fi
done
if [ "x$final" != "x" ]; then
@ -47,7 +47,7 @@ _do_dm_shutdown() {

if command -v dmsetup > /dev/null \
&& [ "x$(dmsetup status)" != "xNo devices found" ]; then
_do_dm_shutdown $1
_do_dm_shutdown "$1"
else
:
fi