mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

commit 98baf5e5b730c3bf9808f0acf2c9abe3df8cd44d
parent 51cce3fb0b5aa313501d251dc0361bedbecd6db3
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sun, 27 Nov 2016 21:27:04 +0100

support without key

Diffstat:
luks_mount | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/luks_mount b/luks_mount @@ -1,12 +1,18 @@ #!/bin/bash set -e +set -x VOLUME="$1" KEY="$HOME/credentials/$VOLUME.key" FOLDER="/mnt/$VOLUME" -sudo cryptsetup luksOpen --key-file "$KEY" $(duuid "$VOLUME") "$VOLUME" +if [ -f "$KEY" ] +then + sudo cryptsetup luksOpen --key-file "$KEY" $(duuid "$VOLUME") "$VOLUME" +else + sudo cryptsetup luksOpen $(duuid "$VOLUME") "$VOLUME" +fi sudo mkdir -p "$FOLDER" sudo mount "/dev/mapper/$VOLUME" "$FOLDER"