diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2012-11-24 10:02:38 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2012-11-24 10:02:38 -0200 |
commit | 44d7b22341f55680f1c96a39b17916f417807f3c (patch) | |
tree | a478dd08c4d7364c6805c35f42075b7cd2066ba7 /files | |
parent | df51b9c44c30ea8a255fb7f93b4640c82fb36231 (diff) | |
download | puppet-backup-44d7b22341f55680f1c96a39b17916f417807f3c.tar.gz puppet-backup-44d7b22341f55680f1c96a39b17916f417807f3c.tar.bz2 |
Minor bugfix and increased verbosity
Diffstat (limited to 'files')
-rwxr-xr-x | files/mount-media | 10 |
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 |