2016-10-07 21:46:23 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
2017-11-01 15:11:51 +00:00
|
|
|
VERACRYPT="veracrypt"
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
VERACRYPT="/Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt"
|
|
|
|
fi
|
2018-01-10 11:08:12 +00:00
|
|
|
|
|
|
|
MOUNT_TARGET=$2
|
|
|
|
if [[ -z "$MOUNT_TARGET" ]]; then
|
|
|
|
MOUNT_TARGET=~/.vault
|
|
|
|
fi
|
|
|
|
mkdir -p "$MOUNT_TARGET"
|
|
|
|
|
|
|
|
MOUNT_SOURCE=$1
|
|
|
|
if [[ -z "$MOUNT_SOURCE" ]]; then
|
|
|
|
MOUNT_SOURCE="~/vaults/vault.vera"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$VAULT_PASSWORD" ]]; then
|
|
|
|
$VERACRYPT -t --mount "$MOUNT_SOURCE" "$MOUNT_TARGET"
|
|
|
|
else
|
|
|
|
$VERACRYPT -t --non-interactive -p $VAULT_PASSWORD --mount "$MOUNT_SOURCE" "$MOUNT_TARGET"
|
|
|
|
fi
|
|
|
|
sudo chown $USER "$MOUNT_TARGET"
|
|
|
|
|
|
|
|
echo "$MOUNT_SOURCE -> $MOUNT_TARGET"
|