noninteractive mount

This commit is contained in:
Cyryl Płotnicki 2020-02-01 15:38:30 +00:00
parent 77db747694
commit 50f96a3876

View file

@ -10,6 +10,8 @@ MOUNT_TARGET=$2
if [[ -z "$MOUNT_TARGET" ]]; then if [[ -z "$MOUNT_TARGET" ]]; then
MOUNT_TARGET=$HOME/.vault MOUNT_TARGET=$HOME/.vault
fi fi
sudo chown $USER "$MOUNT_TARGET"
mkdir -p "$MOUNT_TARGET" mkdir -p "$MOUNT_TARGET"
MOUNT_SOURCE=$1 MOUNT_SOURCE=$1
@ -18,10 +20,13 @@ if [[ -z "$MOUNT_SOURCE" ]]; then
fi fi
if [[ -z "$VAULT_PASSWORD" ]]; then if [[ -z "$VAULT_PASSWORD" ]]; then
echo "interactive mount"
$VERACRYPT -t --mount "$MOUNT_SOURCE" "$MOUNT_TARGET" $VERACRYPT -t --mount "$MOUNT_SOURCE" "$MOUNT_TARGET"
else else
$VERACRYPT -t --non-interactive -p $VAULT_PASSWORD --mount "$MOUNT_SOURCE" "$MOUNT_TARGET" echo "non-interactive mount of '$MOUNT_SOURCE' to '$MOUNT_TARGET'"
sudo $VERACRYPT -t --non-interactive -p $VAULT_PASSWORD --mount "$MOUNT_SOURCE" "$MOUNT_TARGET"
fi fi
sudo chown $USER "$MOUNT_TARGET" sudo chown $USER "$MOUNT_TARGET"
echo "$MOUNT_SOURCE -> $MOUNT_TARGET" echo "$MOUNT_SOURCE -> $MOUNT_TARGET"