aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfiles/mount-media10
1 files changed, 8 insertions, 2 deletions
diff --git a/files/mount-media b/files/mount-media
index b450605..a6ef5b6 100755
--- a/files/mount-media
+++ b/files/mount-media
@@ -7,7 +7,7 @@
MEDIA="$1"
VOLUME="$2"
BASENAME="`basename $0`"
-DISK="`echo ${MEDIA} | sed -e s/[0-9]\$//g`"
+MOUNTPOINT="/media/usb"
# Check media config
if [ -z "$MEDIA" ]; then
@@ -21,16 +21,22 @@ if [ -z "$VOLUME" ]; then
VOLUME="sdb1"
fi
+DISK="`echo ${VOLUME} | sed -e s/[0-9]\$//g`"
+
# Set sudo config
if [ "`whoami`" != 'root' ]; then
sudo="sudo"
fi
if [ "$BASENAME" == "mount-media" ]; then
+ echo "Disabling STANDBY on drive..."
$sudo sdparm --clear STANDBY -6 /dev/$DISK
+ echo "Initializing crypto layer..."
$sudo cryptsetup luksOpen /dev/$VOLUME $MEDIA && \
+ echo "Checking filesystem..."
$sudo fsck -v -y /dev/mapper/$MEDIA && \
- $sudo mount /dev/mapper/$MEDIA /media/usb
+ echo "Mounting volume at $MOUNTPOINT"
+ $sudo mount /dev/mapper/$MEDIA $MOUNTPOINT"
elif [ "$BASENAME" == "umount-media" ]; then
$sudo umount /media/usb && \
$sudo cryptsetup luksClose $MEDIA