From d7622e0cedbcfd6bda7ac0b8354c6fea5d127f37 Mon Sep 17 00:00:00 2001 From: Solstice d'Hiver Date: Sat, 5 Dec 2009 16:51:16 +0200 Subject: Check that cryptsetup mapping exists before trying to remove it Signed-off-by: Roman Kyrylych --- rc.shutdown | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'rc.shutdown') diff --git a/rc.shutdown b/rc.shutdown index 623146e..b0de393 100755 --- a/rc.shutdown +++ b/rc.shutdown @@ -109,12 +109,14 @@ if [ -f /etc/crypttab -a -n "$(/bin/grep -v ^# /etc/crypttab | /bin/grep -v ^$)" CS=/sbin/cryptsetup.static do_uncrypt() { if [ $# -ge 3 ]; then - stat_append "${1}.." - $CS remove $1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - stat_append "failed " - else - stat_append "ok " + if [ -b /dev/mapper/$1 ] ;then + stat_append "${1}.." + $CS remove $1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + stat_append "failed " + else + stat_append "ok " + fi fi fi } -- cgit v1.2.3