#!/bin/zsh # # Tomb, the Crypto Undertaker # # a tool to easily operate file encryption of private and secret data # # Copyleft (C) 2007-2011 Denis Roio # # This source code is free software; you can redistribute it and/or # modify it under the terms of the GNU Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This source code is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # Please refer to the GNU Public License for more details. # # You should have received a copy of the GNU Public License along with # this source code; if not, write to: # Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # startup wrapper to open tombs try() { which ${1} > /dev/null if [ $? = 0 ]; then return 0; else return -1; fi } # if no arguments are given, run in terminal if [ -z $1 ]; then try gnome-terminal; if [ $? = 0 ]; then gnome-terminal -e "tomb-open create"; exit 0; fi try lxterm; if [ $? = 0 ]; then lxterm -bg black -fg white -e "tomb-open create"; exit 0; fi try urxvt; if [ $? = 0 ]; then urxvt -bg black -fg white -e "tomb-open create"; exit 0; fi try uxterm; if [ $? = 0 ]; then uxterm -bg black -fg white -e "tomb-open create"; exit 0; fi try xterm; if [ $? = 0 ]; then xterm -bg black -fg white -e "tomb-open create"; exit 0; fi exit 1 fi # got a directory as argument if [ -d $1 ]; then # FIXME: somehow xdg-open loses mailcap mimes when executed by tomb-status # try xdg-open; if [ $? = 0 ]; then xdg-open ${1}; exit 0; fi try gnome-open; if [ $? = 0 ]; then gnome-open ${1}; exit 0; fi try thunar; if [ $? = 0 ]; then thunar ${1}; exit 0; fi try rox; if [ $? = 0 ]; then rox ${1}; exit 0; fi try fsviewer; if [ $? = 0 ]; then fsviewer ${1}; exit 0; fi try xnc; if [ $? = 0 ]; then xnc ${1}; exit 0; fi tomb notify "File manager not found." "Tomb cannot guess which filemanager you are using" exit 1 fi # got a tomb as argument? if [ -f $1 ]; then file $1 | grep LUKS if [ $? = 0 ]; then tomb -S mount $1 exit $? else tomb notify "Not a real Tomb." "We found no real bones in there." exit 1 fi fi # no argument but on graphical display: creation dialog if [ -z $DISPLAY ]; then echo "[!] tomb-open is a wrapper for the command 'tomb'" tomb -h exit 1 fi if [ "$1" != "create" ]; then exit 0 fi # start guided tomb creation tomb -S notify cat < " read -q if [ $? != 0 ]; then echo "Operation aborted." exit 1 fi # let's proceed echo " Please type in the name for your new tomb file:" echo -n "> " read filename echo " How big you want the Tomb to be?" echo " Type a size number in Megabytes:" echo -n "> " read size echo " You have commanded the creation of this Tomb:" echo " $filename ( $size MBytes )"; echo echo " Please confirm if you want to proceed now," echo " digging will take quite some time! (y/n)" echo -n "> " read -q if [ $? != 0 ]; then echo "Operation aborted." exit 1 fi cat <