From 50f96a3876d23cd4542fad868320715a18ac0244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sat, 1 Feb 2020 15:38:30 +0000 Subject: [PATCH] noninteractive mount --- tools/mount-vault | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/mount-vault b/tools/mount-vault index db8ab7b1..c1e5e931 100755 --- a/tools/mount-vault +++ b/tools/mount-vault @@ -10,6 +10,8 @@ MOUNT_TARGET=$2 if [[ -z "$MOUNT_TARGET" ]]; then MOUNT_TARGET=$HOME/.vault fi + +sudo chown $USER "$MOUNT_TARGET" mkdir -p "$MOUNT_TARGET" MOUNT_SOURCE=$1 @@ -18,10 +20,13 @@ if [[ -z "$MOUNT_SOURCE" ]]; then fi if [[ -z "$VAULT_PASSWORD" ]]; then + echo "interactive mount" $VERACRYPT -t --mount "$MOUNT_SOURCE" "$MOUNT_TARGET" 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 + sudo chown $USER "$MOUNT_TARGET" echo "$MOUNT_SOURCE -> $MOUNT_TARGET"