]> gitweb.fluxo.info Git - hydra.git/commitdiff
Fixes mount-media
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 14 Oct 2016 15:56:20 +0000 (12:56 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 14 Oct 2016 15:56:20 +0000 (12:56 -0300)
share/hydractl/mount-media

index 6916439040cfef8e0c477ac1762091f10b03e989..468eb7e90a034cfe05a832501659d1a60ce91fae 100755 (executable)
@@ -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