truecrypt_scripts/truecrypt_mount.sh
changeset 1 ad15a8882cac
child 27 a8c8d86b8501
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/truecrypt_scripts/truecrypt_mount.sh	Tue Apr 08 11:39:52 2014 +0200
     1.3 @@ -0,0 +1,34 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +BASEDIR="$(dirname $0)"
     1.7 +DEVICE="$1"
     1.8 +MOUNTPOINT="$2"
     1.9 +PASSWORD="$3"
    1.10 +KEYFILE="$4"
    1.11 +
    1.12 +if [ -r "$BASEDIR/truecrypt_config.cfg" ]
    1.13 +then
    1.14 +	. "$BASEDIR/truecrypt_config.cfg"
    1.15 +else
    1.16 +	echo "truecrypt_config.cfg not found" >&2
    1.17 +	exit 1
    1.18 +fi
    1.19 +
    1.20 +if [ -z "$KEYFILE" ]
    1.21 +then
    1.22 +	message="$($tc_cmd --non-interactive "$DEVICE" "$MOUNTPOINT" -p "$PASSWORD")"
    1.23 +	result="$?"
    1.24 +else
    1.25 +	message="$($tc_cmd --non-interactive "$DEVICE" "$MOUNTPOINT" -p "$PASSWORD" -k "$KEYFILE")"
    1.26 +	result="$?"
    1.27 +fi
    1.28 +	
    1.29 +
    1.30 +
    1.31 +if [ "$result" != "0" ]
    1.32 +then
    1.33 +	exit 1
    1.34 +fi
    1.35 +
    1.36 +echo "$message"
    1.37 +exit 0
    1.38 \ No newline at end of file