diff options
-rwxr-xr-x | share/hydractl/mount-media | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/share/hydractl/mount-media b/share/hydractl/mount-media index 6916439..468eb7e 100755 --- a/share/hydractl/mount-media +++ b/share/hydractl/mount-media @@ -17,6 +17,11 @@ if [ -z "$MEDIA" ]; then exit 1 fi +# Set sudo config +if [ "`whoami`" != 'root' ]; then + sudo="sudo" +fi + # Check volume config if [ -z "$VOLUME" ]; then VOLUME="sdb1" @@ -30,12 +35,7 @@ DEVICE="/dev/$DISK" if $sudo lvdisplay /dev/$MEDIA/root &> /dev/null; then LVM="yes" DEVICE="/dev/$MEDIA/root" - MAPPING="$MAPPING-root" -fi - -# Set sudo config -if [ "`whoami`" != 'root' ]; then - sudo="sudo" + MAPPING="$MAPPING-unlocked" fi if [ "$BASENAME" == "mount-media" ]; then @@ -48,7 +48,7 @@ if [ "$BASENAME" == "mount-media" ]; then fi if [ "$LVM" == "yes" ]; then - $sudo vgchange -a y $VOLUME + $sudo vgchange -a y $MEDIA fi echo "Initializing crypto layer..." @@ -65,6 +65,6 @@ elif [ "$BASENAME" == "umount-media" ]; then $sudo cryptsetup luksClose $MAPPING if [ "$LVM" == "yes" ]; then - $sudo vgchange -a n $VOLUME + $sudo vgchange -a n $MEDIA fi fi |