From b32499179e898a6a5ccff1234348f37e03926767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sat, 22 Feb 2020 15:02:48 +0000 Subject: [PATCH] more resilient deescalate script --- nixos/cli.nix | 2 +- tools/mount-vault | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nixos/cli.nix b/nixos/cli.nix index 3343924a..b16c0896 100644 --- a/nixos/cli.nix +++ b/nixos/cli.nix @@ -2,7 +2,7 @@ { home.packages = with pkgs; [ - wget git gnupg curl tmux python36Packages.glances htop atop pciutils powertop ripgrep-all fd dnsutils + wget git gnupg curl tmux python36Packages.glances htop atop pciutils powertop ripgrep-all fd dnsutils du-dust ( pass.withExtensions (ext: [ ext.pass-otp ext.pass-import ext.pass-genphrase ext.pass-audit ext.pass-update ])) cabal-install stack hsetroot lm_sensors wirelesstools ranger apvlv diff --git a/tools/mount-vault b/tools/mount-vault index c1e5e931..dde9b559 100755 --- a/tools/mount-vault +++ b/tools/mount-vault @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -e +set -o pipefail + VERACRYPT="veracrypt" if [[ "$OSTYPE" == "darwin"* ]]; then VERACRYPT="/Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt" @@ -19,6 +21,8 @@ if [[ -z "$MOUNT_SOURCE" ]]; then MOUNT_SOURCE="$HOME/vaults/vault.vera" fi +chmod a+x "$MOUNT_SOURCE" + if [[ -z "$VAULT_PASSWORD" ]]; then echo "interactive mount" $VERACRYPT -t --mount "$MOUNT_SOURCE" "$MOUNT_TARGET" @@ -26,9 +30,10 @@ else echo "non-interactive mount of '$MOUNT_SOURCE' to '$MOUNT_TARGET'" sudo $VERACRYPT -t --non-interactive -p $VAULT_PASSWORD --mount "$MOUNT_SOURCE" "$MOUNT_TARGET" fi - +echo "mounted" sudo chown $USER "$MOUNT_TARGET" +echo "chowned" echo "$MOUNT_SOURCE -> $MOUNT_TARGET" -$MOUNT_TARGET/install +"$MOUNT_TARGET/install"