From cb23919c91d625ebbd3c0b676ca2dce98cf20a05 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sun, 26 Dec 2010 23:44:11 +0100 Subject: [PATCH] Fix symlink problem with newer device mapper, patch based on work by Thomas Koehler. Original commit message by Thomas Koehler: Newer device mappers create /dev/mapper/grml-crypt_DEV as a symlink to /dev/dm-X, no longer as a block device. Unfortunately, after mounting, you only see /dev/dm-X in /etc/mtab and /proc/mounts, which broke the "stop" command in grml-crypt. By looping over all /dev/mapper/grml-crypt* files and checking if this is the correct one, this problem can be fixed. Thanks: Thomas Koehler --- grml-crypt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/grml-crypt b/grml-crypt index 47ca333..de3c70c 100755 --- a/grml-crypt +++ b/grml-crypt @@ -211,6 +211,19 @@ function actionStop dm_path_=`echo $dm_path_ |awk '{print $1}'` || die "could not get devicemapper name for $tmp_" dprint "dm_path_=\"$dm_path_\"" + # check for symlinks + for dmapper in /dev/mapper/grml-crypt* ; do + link=$(readlink -f "$dmapper") + dprint "looping device mapper devices, dmapper=$dmapper => link=$link" + if [ "$link" = "$dm_path_" ] ; then + tmp_dm_path_="$dmapper" + fi + done + + if [ -n "$tmp_dm_path_" ] ; then + dm_path_="$tmp_dm_path_" + fi + dm_name_="${dm_path_##*/}" dprint "dm_name_=\"$dm_name_\"" -- 2.1.4