mount test korrigiert + kleinigkeiten dazu
This commit is contained in:
parent
f60d31f075
commit
765758598f
1 changed files with 27 additions and 11 deletions
|
@ -12,12 +12,15 @@ crypt_mount()
|
||||||
{
|
{
|
||||||
local partitions=`dmsetup ls | grep -v "No devices found" | cut -f1`
|
local partitions=`dmsetup ls | grep -v "No devices found" | cut -f1`
|
||||||
for i in $partitions; do
|
for i in $partitions; do
|
||||||
if mount | grep -q "^/dev/mapper/$i "
|
#if mount | grep -q "^/dev/mapper/$i$"; then
|
||||||
then true
|
# this doesn't work for me (age)
|
||||||
else echo -e "\t$i (mounting)"
|
if [ `mount | grep -c /dev/mapper/$i` -lt 1 ]; then
|
||||||
mount "/dev/mapper/$i" &>/dev/null || echo -e " (\"mount /dev/mapper/$i\" failed)" >&2
|
echo -en "\t$i(mounting)"
|
||||||
fi
|
mount "/dev/mapper/$i" &>/dev/null || echo -en "(failed)" >&2
|
||||||
done
|
else echo -en "\t$i(already mounted)"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,11 +28,23 @@ crypt_umount()
|
||||||
{
|
{
|
||||||
local partitions=`dmsetup ls | grep -v "No devices found" | cut -f1`
|
local partitions=`dmsetup ls | grep -v "No devices found" | cut -f1`
|
||||||
for i in $partitions; do
|
for i in $partitions; do
|
||||||
if mount | grep -q "^/dev/mapper/$i "
|
#if mount | grep -q "^/dev/mapper/$i$"; then
|
||||||
then echo -e "\t$i (unmounting)"
|
if [ `mount | grep -c /dev/mapper/$i` -gt 0 ]; then
|
||||||
umount "/dev/mapper/$i" &>/dev/null || echo -e " (\"umount /dev/mapper/$i\" failed)" >&2
|
echo -en "\t$i (unmounting)"
|
||||||
fi
|
umount "/dev/mapper/$i" &>/dev/null || echo -en "(failed!)" >&2
|
||||||
done
|
else echo -en "\t$i(not mounted)"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
show_active_mappings()
|
||||||
|
{
|
||||||
|
mappings=`dmsetup ls | cut -f1`
|
||||||
|
if [ "X$mappings" != "X" ]; then
|
||||||
|
echo "there are still some active mappings:"
|
||||||
|
echo "$mappings"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +61,7 @@ case "$ACTION" in
|
||||||
stop )
|
stop )
|
||||||
crypt_umount
|
crypt_umount
|
||||||
/etc/init.d/cryptdisks stop
|
/etc/init.d/cryptdisks stop
|
||||||
|
show_active_mappings
|
||||||
;;
|
;;
|
||||||
restart|reload|force-reload )
|
restart|reload|force-reload )
|
||||||
$0 stop
|
$0 stop
|
||||||
|
|
Loading…
Reference in a new issue