mount grep klappt

This commit is contained in:
age 2005-06-16 22:48:37 +00:00
parent 765758598f
commit f33689fdbc

View file

@ -12,9 +12,8 @@ crypt_mount()
{
local partitions=`dmsetup ls | grep -v "No devices found" | cut -f1`
for i in $partitions; do
#if mount | grep -q "^/dev/mapper/$i$"; then
# this doesn't work for me (age)
if [ `mount | grep -c /dev/mapper/$i` -lt 1 ]; then
if mount | grep -q "^/dev/mapper/$i$"; then
#if [ `mount | grep -c /dev/mapper/$i` -lt 1 ]; then
echo -en "\t$i(mounting)"
mount "/dev/mapper/$i" &>/dev/null || echo -en "(failed)" >&2
else echo -en "\t$i(already mounted)"
@ -28,8 +27,8 @@ crypt_umount()
{
local partitions=`dmsetup ls | grep -v "No devices found" | cut -f1`
for i in $partitions; do
#if mount | grep -q "^/dev/mapper/$i$"; then
if [ `mount | grep -c /dev/mapper/$i` -gt 0 ]; then
if mount | grep -q "^/dev/mapper/$i$"; then
#if [ `mount | grep -c /dev/mapper/$i` -gt 0 ]; then
echo -en "\t$i (unmounting)"
umount "/dev/mapper/$i" &>/dev/null || echo -en "(failed!)" >&2
else echo -en "\t$i(not mounted)"