Encrypted DVDs - mount / umount toggle script
This script is designed to handle .tc files (I use this extension for truecrypt volumes) from konqueror. One double click mounts, the next unmounts. It only supports volumes that only use a key file and no additional password.
On encrypted DVDs the mount point must already exist. Also the dvd.key needs to reside on a encrypted volume itself for obvious reasons.
#!/bin/bash vaultfile=$(readlink -f $1) vaultdir=$(echo $vaultfile | rev | cut --complement -d. -f1 | rev) if [ $vaultfile == $vaultdir ]; then echo "Mount point and file identical. Aborting." exit fi mappingname=$(mount | grep $vaultdir | cut -d\ -f1) if [ -z $mappingname ]; then if [ ! -e $vaultdir ]; then echo "Creating mount point $vaultdir..." mkdir $vaultdir fi echo "Mounting $vaultfile..." truecrypt -k ~/.truecrypt/dvd.key -u $vaultfile $vaultdir else echo "Unmounting $vaultfile..." truecrypt -d $mappingname fi
Related notes for 'truecrypt':