Hubert Chan schrieb am Sat 05. Mar, 11:36 (-0500) :
> Hi Jörg,
> 
> You tagged bug #298141 with the patch tag, but I don't see any patch
> attached to your message.  I think it got eaten (or maybe you just
> forgot to attach it).  Can you re-send?

Oh sorry, I'm a little bit absent-minded the last days.

Joerg.

-- 
Nichts ist so langweilig, wie die Wiederholung seinerselbst.
                                        (Marcel Reich-Ranicki)
--- /tmp/usr/bin/mount.crypt    2005-03-01 22:45:49.000000000 +0100
+++ /sbin/mount.crypt   2005-03-05 13:47:23.000000000 +0100
@@ -45,6 +45,11 @@
        exit 1
 }
 
+DEVICE=$1
+MOUNT_POINT=$2
+
+shift 2
+
 while :;
        do case "$1" in
                -h | "-?" )     
@@ -62,17 +67,17 @@
        shift
 done
 
-if [ -z "$1" ]; then
+if [ -z "$DEVICE" ]; then
        echo "${0##*/}: device to mount not specified" >&2
 fi
 
-if [ ! -f "$1" ] && [ ! -b "$1" ]; then
-        echo "${0##*/}: $1 is not a block device or file" >&2
+if [ ! -f "$DEVICE" ] && [ ! -b "$DEVICE" ]; then
+        echo "${0##*/}: $DEVICE is not a block device or file" >&2
        exit 1
 fi
 
-if [ ! -d "$2" ]; then
-        echo "${0##*/}: $2 is not a directory" >&2
+if [ ! -d "$MOUNT_POINT" ]; then
+        echo "${0##*/}: $MOUNT_POINT is not a directory" >&2
        exit 1
 fi
 
@@ -83,8 +88,8 @@
 MOUNTOPTIONS=""
 IFS=","
 for opt in $OPTIONS; do
-       KEY=`echo $opt | awk -F = '{ print $1 }'`
-       VAL=`echo $opt | awk -F = '{ print $2 }'`
+       KEY=${opt%=*}
+       VAL=${opt#*=}
        case $KEY in
                # FIXME: use cipher instead of encryption to avoid conflicting
                # with mount's built-in (cryptoloop) encryption argument.
@@ -112,29 +117,27 @@
 done
 
 if [ x"${LOOP}" = xtrue ]; then
-       DEVICE=`_losetup $1`
-else
-       DEVICE=$1
+       DEVICE=`_losetup $DEVICE`
 fi
 # if loop device, make device mapper name based on file pointed to
-if [ `echo $1 | grep '^/dev/loop'` ]; then
-       DMDEVICE=`$LOSETUP $1 | egrep '(.+)' | awk '{print $3}' | sed 's/(//' | 
sed 's/)//'`
-fi
-# if not a loop device or previous command fails
-if [ -z $DMDEVICE ]; then
-       DMDEVICE=$1
-fi
+case "$DEVICE" in
+  /dev/loop*)
+       DMDEVICE=`$LOSETUP $DEVICE | egrep '(.+)' | awk '{print $3}' | sed 
's/(//; s/)//'`
+esac
+# if not a loop device or previous command fails use $DEVICE
+: ${DMDEVICE:=$DEVICE}
+
 # FIXME: blind replacement of / with _ may be a bad idea.
 DMDEVICE=`echo $DMDEVICE | sed 's/\//_/g'`
 
 CIPHEROPT="aes"
 if [ -n "$CIPHER" ]; then
-       CIPHEROPT="-c $CIPHER"
+       CIPHEROPT="$CIPHER"
 fi
 
 HASHOPT="ripemd160"
 if [ -n "$HASH" ]; then
-       HASHOPT="-h $HASH"
+       HASHOPT="$HASH"
 fi
 
 KEYSIZEOPT="256"
@@ -150,8 +153,8 @@
 fi
 
 if [ -z "$MOUNTOPTIONS" ]; then
-       # $2 might not exist as mount can try to read it from /etc/fstab
-       $MOUNT /dev/mapper/$DMDEVICE $2
+       # $MOUNT_POINT might not exist as mount can try to read it from 
/etc/fstab
+       $MOUNT /dev/mapper/$DMDEVICE $MOUNT_POINT
        if [ $? != 0 ]; then
                echo "${0##*/}: error mounting $DMDEVICE" >&2
                $CRYPTSETUP remove $DMDEVICE
@@ -159,7 +162,7 @@
                exit 1
        fi
 else
-       $MOUNT -o $MOUNTOPTIONS /dev/mapper/$DMDEVICE $2
+       $MOUNT -o $MOUNTOPTIONS /dev/mapper/$DMDEVICE $MOUNT_POINT
        if [ $? != 0 ]; then
                echo "${0##*/}: error mounting $DMDEVICE" >&2
                $CRYPTSETUP remove $DMDEVICE

Attachment: signature.asc
Description: Digital signature

Reply via email to