|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /proc/self/root/usr/share/hal/scripts/ |
Upload File : |
#!/bin/bash
# Copyright (C) 2005 W. Michael Petullo <mike@flyn.org>
# Copyright (C) 2006 David Zeuthen <davidz@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
if [ "$HAL_PROP_BLOCK_DEVICE" == "" ] || [ "$HAL_PROP_INFO_UDI" == "" ] || [ "$HAL_PROP_VOLUME_UUID" == "" ] ; then
echo "Missing or empty environment variable(s)." >&2
echo "This script should be started by hald." >&2
exit 1
fi
CRYPTSETUP=/sbin/cryptsetup
# make sure that the cleartext volume is unmounted
CLEARTEXT_VOLUME_UDI=`hal-find-by-property --key volume.crypto_luks.clear.backing_volume --string $HAL_PROP_INFO_UDI`
RET=$?
if [ x$RET = x0 ]; then
MOUNT_POINT=`hal-get-property --udi $CLEARTEXT_VOLUME_UDI --key volume.mount_point`
if [ ! x${#MOUNT_POINT} = x0 ]; then
/bin/umount -l "$MOUNT_POINT"
# remove directory only if HAL has created it
if [ -e "$MOUNT_POINT/.created-by-hal" ]; then
rm -f "$MOUNT_POINT/.created-by-hal"
rmdir --ignore-fail-on-non-empty "$MOUNT_POINT"
fi
fi
fi
if [ ! -f $CRYPTSETUP ]; then
echo Error removing $HAL_PROP_BLOCK_DEVICE - $CRYPTSETUP not found >&2
exit 1
fi
if [ -z $HAL_PROP_VOLUME_UUID ]; then
echo Error determining UUID of $HAL_PROP_BLOCK_DEVICE >&2
exit 1
fi
if ! $CRYPTSETUP luksClose luks_crypto_$HAL_PROP_VOLUME_UUID 2> /dev/null; then
echo Error removing luks_crypto_$HAL_PROP_VOLUME_UUID >&2
exit 1
fi
exit 0