summaryrefslogtreecommitdiffstats
path: root/modules.d/90dm
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:37 +0000
commit734d725d62d2cbe4445524448de024e3b9e7f4b3 (patch)
tree88d8385f24a0efda248b3480fe39037b85e76552 /modules.d/90dm
parentReleasing progress-linux version 060+5-8~progress7.99u1. (diff)
downloaddracut-734d725d62d2cbe4445524448de024e3b9e7f4b3.tar.xz
dracut-734d725d62d2cbe4445524448de024e3b9e7f4b3.zip
Merging upstream version 102.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/90dm')
-rwxr-xr-xmodules.d/90dm/dm-shutdown.sh34
1 files changed, 24 insertions, 10 deletions
diff --git a/modules.d/90dm/dm-shutdown.sh b/modules.d/90dm/dm-shutdown.sh
index bd7134a..93b62bb 100755
--- a/modules.d/90dm/dm-shutdown.sh
+++ b/modules.d/90dm/dm-shutdown.sh
@@ -2,26 +2,40 @@
_remove_dm() {
local dev="$1"
+ local final="$2"
local s
local devname
for s in /sys/block/"${dev}"/holders/dm-*; do
[ -e "${s}" ] || continue
- _remove_dm "${s##*/}"
+ _remove_dm "${s##*/}" "$final" || return $?
done
- # multipath devices might have MD devices on top,
- # which are removed after this script. So do not
- # remove those to avoid spurious errors
+
+ read -r devname < /sys/block/"${dev}"/dm/name
case $(cat /sys/block/"${dev}"/dm/uuid) in
mpath-*)
+ # multipath devices might have MD devices on top,
+ # which are removed after this script. So do not
+ # remove those to avoid spurious errors
return 0
;;
- *)
- read -r devname < /sys/block/"${dev}"/dm/name
- dmsetup -v --noudevsync remove "$devname" || return $?
+ CRYPT-*)
+ if command -v systemd-cryptsetup > /dev/null; then
+ DM_DISABLE_UDEV=true SYSTEMD_LOG_LEVEL=debug systemd-cryptsetup detach "$devname" && return 0
+ elif command -v cryptsetup > /dev/null; then
+ DM_DISABLE_UDEV=true cryptsetup close --debug "$devname" && return 0
+ else
+ dmsetup -v --noudevsync remove "$devname"
+ return $?
+ fi
+
+ # try using plain dmsetup if we're on the final attempt.
+ [ -z "$final" ] && return 1
;;
esac
- return 0
+
+ dmsetup -v --noudevsync remove "$devname"
+ return $?
}
_do_dm_shutdown() {
@@ -33,9 +47,9 @@ _do_dm_shutdown() {
for dev in /sys/block/dm-*; do
[ -e "${dev}" ] || continue
if [ "x$final" != "x" ]; then
- _remove_dm "${dev##*/}" || ret=$?
+ _remove_dm "${dev##*/}" "$final" || ret=$?
else
- _remove_dm "${dev##*/}" > /dev/null 2>&1 || ret=$?
+ _remove_dm "${dev##*/}" "$final" > /dev/null 2>&1 || ret=$?
fi
done
if [ "x$final" != "x" ]; then