Mercurial > repos > other > usr-local-bin
annotate mount-crypt @ 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 | e85e3470a41e |
children |
rev | line source |
---|---|
0 | 1 #! /bin/bash |
2 | |
3 if [ $# -ne 1 ]; then | |
4 echo "Usage: $0 <filename>" >&2 | |
5 exit 1 | |
6 fi | |
7 | |
8 if [ ! -f "$1" ]; then | |
9 echo "File doesn't exist" >&2 | |
10 exit 2 | |
11 fi | |
12 | |
5
14e726efe9b0
Change from sudo (which may record command) to su, since we're mounting something private/encrypted
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
13 LOOP_DEV=$(su -c "losetup --find --show \"$1\"") |
0 | 14 MAPPER=${LOOP_DEV##*/} |
5
14e726efe9b0
Change from sudo (which may record command) to su, since we're mounting something private/encrypted
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
15 su -c "cryptsetup luksOpen $LOOP_DEV $MAPPER && mkdir -p /media/$MAPPER && mount /dev/mapper/$MAPPER /media/$MAPPER" |