PrivateThoughts/run.sh

36 lines
701 B
Bash
Raw Normal View History

DEV_USB=$1
MOUNT_NAME=priv
MOUNT_DIR=/media/michael/priv
2022-03-22 02:05:02 -04:00
LOC=0
echo "Locking db..."
2022-03-22 02:05:02 -04:00
cryptsetup luksOpen $DEV_USB $MOUNT_NAME || \
echo "Issue unlocking db... quitting" &&\
exit 1
echo "Mounting db..."
mkdir $MOUNT_DIR
2022-03-22 02:05:02 -04:00
rm -rf $MOUNT_DIR
mount /dev/mapper/$MOUNT_NAME $MOUNT_DIR || \
echo "Issue mounting db... quiting..." &&\
exit 1
2022-03-21 17:09:11 -04:00
rm -rf ./data.link
ln -s "$MOUNT_DIR/notes" ./data.link
2022-03-21 17:09:11 -04:00
echo "Starting container..."
2022-03-22 02:05:02 -04:00
docker run --name priv --rm -it -v `pwd`/data.link/:/notes `docker build -q .`
2022-03-21 17:09:11 -04:00
echo "Unmounting db..."
umount -f "$MOUNT_DIR"
rm -rf $MOUNT_DIR
echo "Removing link..."
rm -rf ./data.link
echo "Locking db..."
cryptsetup luksClose /dev/mapper/$MOUNT_NAME
2022-03-21 17:09:11 -04:00
echo "Exiting..."