Updated run.sh to take a device instead of a mount folder. Now it will take that device unlock it, mount it, start the docker container, and then auto close, unmount, and removing all residual data afterwards
This commit is contained in:
parent
a012a85e8f
commit
9f78013d6b
34
run.sh
34
run.sh
@ -1,16 +1,34 @@
|
||||
rm -rf ./data.link
|
||||
ln -s "$1/notes" ./data.link
|
||||
echo "Remade link"
|
||||
DEV_USB=$1
|
||||
MOUNT_NAME=priv
|
||||
MOUNT_DIR=/media/michael/priv
|
||||
|
||||
#echo "Start markdown viewer"
|
||||
#echo "pandoc $1/notes/*.md | lynx -stdin"
|
||||
|
||||
echo "Locking db..."
|
||||
cryptsetup luksOpen $DEV_USB $MOUNT_NAME
|
||||
|
||||
echo "Mounting db..."
|
||||
mkdir $MOUNT_DIR
|
||||
mount /dev/mapper/$MOUNT_NAME $MOUNT_DIR
|
||||
|
||||
|
||||
echo "Remaking link..."
|
||||
rm -rf ./data.link
|
||||
ln -s "$MOUNT_DIR/notes" ./data.link
|
||||
|
||||
echo "Waiting..."
|
||||
sleep 10
|
||||
|
||||
echo "Starting container..."
|
||||
docker run --name privmd --rm -it -v `pwd`/data.link/:/notes `docker build -q .`
|
||||
|
||||
echo "Unmounting db..."
|
||||
luks=`lsblk | grep /media/michael/Return\ to\ mscalz | grep -o -e "luks-[[:alnum:]-]*"`
|
||||
umount -f "$1"
|
||||
cryptsetup luksClose /dev/mapper/$luks
|
||||
umount -f "$MOUNT_DIR"
|
||||
rm -rf $MOUNT_DIR
|
||||
|
||||
echo "Removing link..."
|
||||
rm -rf ./data.link
|
||||
|
||||
echo "Locking db..."
|
||||
cryptsetup luksClose /dev/mapper/$MOUNT_NAME
|
||||
|
||||
echo "Exiting..."
|
||||
|
Loading…
Reference in New Issue
Block a user