#!/bin/bash ######################################################## # Configuration ######################################################## USB_DRIVE_PART_NAME="KINGSTON" VERA_DRIVE_NAME="NO NAME" VERA_CONTAINER_PATH_REL="VERSCHLUESSELT/GTIKlausuren" MOUNT_PATH="/Volumes/" PYTHON_VERA_WRAPPER_BIN=~/ls1-misc/veracrypt/verausbdrive.py ######################################################## set -e USB_DRIVE_MOUNT_PATH="$MOUNT_PATH/$USB_DRIVE_PART_NAME" VERA_MOUNT_PATH="$MOUNT_PATH/$VERA_DRIVE_NAME" if [ ! -d "$USB_DRIVE_MOUNT_PATH" ] then echo "USB drive partition not mounted; ignoring request." exit 0 fi if [ -d "$VERA_MOUNT_PATH" ] then echo "Verascript drive name already in use; assuming the container is already mounted." exit 0 fi MY_BASEPATH="$(dirname "$PYTHON_VERA_WRAPPER_BIN")" MY_BINARY="$(basename "$PYTHON_VERA_WRAPPER_BIN")" pushd "$MY_BASEPATH" > /dev/null pipenv run ./"$MY_BINARY" -m "$MOUNT_PATH" -v "$VERA_DRIVE_NAME" -n "$USB_DRIVE_PART_NAME" "$VERA_CONTAINER_PATH_REL" popd > /dev/null