~cyplo/dotfiles

ref: 88207f1d3672730a3533a0e886d2441411d98f1b dotfiles/tools/mount-vault -rwxr-xr-x 651 bytes
88207f1d — Cyryl Płotnicki Make sure Vim is installed on Fedora when installing everythin from scratch 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

set -e
VERACRYPT="veracrypt"
if [[ "$OSTYPE" == "darwin"* ]]; then
    VERACRYPT="/Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt"
fi

MOUNT_TARGET=$2
if [[ -z "$MOUNT_TARGET" ]]; then
    MOUNT_TARGET=$HOME/.vault
fi
mkdir -p "$MOUNT_TARGET"

MOUNT_SOURCE=$1
if [[ -z "$MOUNT_SOURCE" ]]; then
    MOUNT_SOURCE="$HOME/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"

$MOUNT_TARGET/install