changeset 5:14e726efe9b0

Change from sudo (which may record command) to su, since we're mounting something private/encrypted
author IBBoard <dev@ibboard.co.uk>
date Sun, 09 Nov 2014 09:29:01 +0000
parents 14c88dd76d53
children 7c8b5c5f0fb7
files mount-crypt umount-crypt
diffstat 2 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mount-crypt	Sun Nov 09 09:28:31 2014 +0000
+++ b/mount-crypt	Sun Nov 09 09:29:01 2014 +0000
@@ -10,8 +10,6 @@
 	exit 2
 fi
 
-LOOP_DEV=$(sudo losetup --find --show "$1")
+LOOP_DEV=$(su -c "losetup --find --show \"$1\"")
 MAPPER=${LOOP_DEV##*/}
-sudo cryptsetup luksOpen $LOOP_DEV $MAPPER
-sudo mkdir -p /media/$MAPPER
-sudo mount /dev/mapper/$MAPPER /media/$MAPPER
+su -c "cryptsetup luksOpen $LOOP_DEV $MAPPER && mkdir -p /media/$MAPPER && mount /dev/mapper/$MAPPER /media/$MAPPER"
--- a/umount-crypt	Sun Nov 09 09:28:31 2014 +0000
+++ b/umount-crypt	Sun Nov 09 09:29:01 2014 +0000
@@ -18,7 +18,4 @@
 	exit 3
 fi
 
-sudo umount "/media/$LOOP_DEV"
-sudo rmdir "/media/$LOOP_DEV"
-sudo cryptsetup luksClose "/dev/mapper/$LOOP_DEV"
-sudo losetup -d "/dev/$LOOP_DEV"
+su -c "umount \"/media/$LOOP_DEV\" && rmdir \"/media/$LOOP_DEV\" && cryptsetup luksClose \"/dev/mapper/$LOOP_DEV\" && losetup -d \"/dev/$LOOP_DEV\""