diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-10-02 17:21:26 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-10-02 17:21:26 -0300 |
commit | 6d9d7b39bbf87b32a2e12fa6b29f463382c7027e (patch) | |
tree | ce42a76278dddff07c24f8608b35255e705db1e1 /files/mount-media | |
parent | ab184775e79a780eb2a32d67260756d8a9b4258d (diff) | |
download | puppet-backup-6d9d7b39bbf87b32a2e12fa6b29f463382c7027e.tar.gz puppet-backup-6d9d7b39bbf87b32a2e12fa6b29f463382c7027e.tar.bz2 |
Move scripts to the Hydra Suite
Diffstat (limited to 'files/mount-media')
-rwxr-xr-x | files/mount-media | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/files/mount-media b/files/mount-media deleted file mode 100755 index 0073292..0000000 --- a/files/mount-media +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# -# mount-media -# - -# Parameters -MEDIA="$1" -VOLUME="$2" -BASENAME="`basename $0`" -MOUNTPOINT="/media/$MEDIA" - -# Check media config -if [ -z "$MEDIA" ]; then - echo "usage: $BASENAME <media> [volume]" - echo "example: $BASENAME mymedia sdb1" - exit 1 -fi - -# Check volume config -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 "Checking drive health status..." - $sudo smartctl -H /dev/$DISK - 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 && \ - echo "Mounting volume at $MOUNTPOINT..." - $sudo mkdir -p $MOUNTPOINT - $sudo mount /dev/mapper/$MEDIA $MOUNTPOINT -elif [ "$BASENAME" == "umount-media" ]; then - $sudo umount $MOUNTPOINT && \ - $sudo cryptsetup luksClose $MEDIA -fi |