PrivateThoughts/run.sh

32 lines
591 B
Bash
Executable File

DEV_USB=$1
MOUNT_NAME=priv
MOUNT_DIR=/media/michael/priv
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 "Starting container..."
docker run --name privmd --rm -it -v `pwd`/data.link/:/notes `docker build -q .`
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
echo "Exiting..."