aboutsummaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-11-24 10:02:38 -0200
committerSilvio Rhatto <rhatto@riseup.net>2012-11-24 10:02:38 -0200
commit44d7b22341f55680f1c96a39b17916f417807f3c (patch)
treea478dd08c4d7364c6805c35f42075b7cd2066ba7 /files
parentdf51b9c44c30ea8a255fb7f93b4640c82fb36231 (diff)
downloadpuppet-backup-44d7b22341f55680f1c96a39b17916f417807f3c.tar.gz
puppet-backup-44d7b22341f55680f1c96a39b17916f417807f3c.tar.bz2
Minor bugfix and increased verbosity
Diffstat (limited to 'files')
-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