#!/bin/bash # script for converting normal TC-Containers into "Extended Truecrypt Volumes" in Ubuntu Privacy Remix # www.privacy-cd.org TEXTDOMAIN=TCNautilus test -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" || exit 0 # where is truecrypt? TC=/usr/local/bin/truecrypt FILECOUNT=`echo -en "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | wc -l` if [ $FILECOUNT -gt 1 ]; then zenity --error --text=$"This script does not work with multiple files selected. Please try again." exit 1 fi # the TC-Volume ENCRYPTEDFILE=`echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | head -n 1 | sed "s/.volume/ /"` # the mount point MOUNTPOINT=/media/`basename "$ENCRYPTEDFILE" | cut -f1 -d.` # ------------------------------------------------------------------------ # return value of truecrypt -t -l is true if it is mounted, false if not if ( $TC -t -l "$ENCRYPTEDFILE" ); then zenity --error --text=$"Truecrypt volume $ENCRYPTEDFILE is already mounted - please close it first." else # warning if zenity --question --title $"Attention - loss of data!" --text $"The volume will be formatted by this command. Thereby you will lose all data within this volume. Do you want to continue?" then # open container and format $TC --filesystem=none -k="" --protect-hidden=no "$ENCRYPTEDFILE" || exit 1 if ( $TC -t -l "$ENCRYPTEDFILE" ); then DMNAME=`$TC -t -l -v "$ENCRYPTEDFILE" | grep "^Virtual Device: " | sed -e "s/Virtual Device: //"` DMNAME2=`$TC -t -l -v "$ENCRYPTEDFILE" | grep "^Volume: " | sed -e "s/Volume: //"` sudo mkfs.ext3 -m 0 $DMNAME && $TC -t -d "$DMNAME2" && zenity --info --title $"Formatting successful" --text=$"The truecrypt volume $DMNAME2 was formatted with the ext3 filesystem and closed. It can now be opened by the context menu entry \"extended Volume -> öffnen/open\"." else zenity --error --text=$"ext3-formatting of the volume $ENCRYPTEDFILE failed! Wrong passphrase or this is not a truecrypt volume." fi fi fi