commit 81be1fa619de813332c6bbbac7d3edea01bf7710
parent f309e3f08ddaacd7aefa4a948d56e82e59f63c47
Author: Jaromil <jaromil@dyne.org>
Date:   Sun, 20 Feb 2011 20:10:08 +0100
key file extension changed to .tomb.key
rename your keys !
this change was motivated by the fact gpg tends to overwrite the
.tomb file if we decrypt the tomb.gpg by hand. changing the extension
in .tomb.key this doesn't happens.
Diffstat:
8 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/share/dyne-tomb.xml b/share/dyne-tomb.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
   <mime-type type="application/x-tomb-volume">
-    <comment>Tomb encrypted volume</comment>
+    <comment>Tomb crypto volume</comment>
     <glob pattern="*.tomb"/>
   </mime-type>
   <mime-type type="application/x-tomb-key">
     <comment>Tomb crypto key</comment>
-    <glob pattern="*.tomb.gpg"/>
+    <glob pattern="*.tomb.key"/>
   </mime-type>
 </mime-info>
diff --git a/share/tomb b/share/tomb
@@ -1,4 +1,4 @@
-?package(tomb):command="tomb" icon="/usr/share/pixmaps/monmort.xpm" needs="cryptsetup" \
+?package(tomb):command="tomb" icon="/usr/share/pixmaps/monmort.xpm" needs="text" \
 	section="Applications/Accessories" title="Tomb" hints="Crypto" \
 	hotkey="Tomb"
 
diff --git a/share/tomb.applications b/share/tomb.applications
@@ -3,5 +3,5 @@ tomb
          name=Tomb - Crypto Undertaker
          can_open_multiple_files=false
          expects_uris=false
-         requires_terminal=false
+         requires_terminal=true
          mime-types=application/x-tomb-volume,application/x-tomb-key
diff --git a/share/tomb.desktop b/share/tomb.desktop
@@ -7,7 +7,7 @@ Comment=Keep your bones safe
 Exec=tomb-open %U
 TryExec=tomb-open
 Icon=monmort.xpm
-Terminal=false
+Terminal=true
 Categories=Utility;Security;Archiving;Filesystem;
 MimeType=application/x-tomb-volume;
 X-AppInstall-Package=tomb
diff --git a/share/tomb.keys b/share/tomb.keys
@@ -4,3 +4,9 @@ application/x-tomb-volume:
 	view=tomb-open %f
 	icon-filename=monmort.xpm
         short_list_application_ids_for_novice_user_level=tomb
+
+application/x-tomb-key:
+	open=tomb-open %f
+	view=tomb-open %f
+	icon-filename=monmort.xpm
+        short_list_application_ids_for_novice_user_level=tomb
diff --git a/share/tomb.mime b/share/tomb.mime
@@ -3,4 +3,4 @@ application/x-tomb-volume
 	ext: tomb
 
 application/x-tomb-key
-        ext: tomb.gpg
+        ext: tomb.key
diff --git a/src/tomb b/src/tomb
@@ -170,8 +170,8 @@ get_arg_tomb() {
     if [ $KEY ]; then
 	tombkey=$KEY # commandline -k flag
 	act "tomb key specified manually: $tombkey"
-    elif [ -r ${tombdir}/${tombname}.key ]; then
-	tombkey=${tombdir}/${tombname}.key
+    elif [ -r ${tombdir}/${tombname}.tomb.key ]; then
+	tombkey=${tombdir}/${tombname}.tomb.key
 	act "key found for tomb '${tombname}': ${tombkey}"
     else
 	error "key not found for tomb '${tombname}'"
@@ -340,7 +340,7 @@ create_tomb() {
 	exit 1
     fi
 	
-    notice "Setup your secret key file ${tombname}.key"
+    notice "Setup your secret key file ${tombname}.tomb.key"
 
     # here user is prompted for key password
     for c in 1 2 3; do
@@ -365,7 +365,7 @@ create_tomb() {
 
     echo "${tombpass}" | gpg \
 	--openpgp --batch --no-options --no-tty --passphrase-fd 0 \
-	-o "${tombdir}/${tombname}.key" -c -a ${keytmp}/tomb.tmp
+	-o "${tombdir}/${tombname}.tomb.key" -c -a ${keytmp}/tomb.tmp
 
     if [ $? = 2 ]; then
 	error "setting password failed: gnupg returns 2"
@@ -409,7 +409,7 @@ create_tomb() {
     losetup -d ${nstloop}
 
     act "done creating $tombname encrypted storage (using Luks dm-crypt AES/SHA256)"
-    notice "Your tomb is ready in ${tombdir}/${tombfile} and secured with key ${tombname}.key"
+    notice "Your tomb is ready in ${tombdir}/${tombfile} and secured with key ${tombname}.tomb.key"
 
 }
 
@@ -580,7 +580,7 @@ decode_key() {
 	return 1
     fi
 
-    keyfile=${tombname%%\.*}.key
+    keyfile=${tombname%%\.*}.tomb.key
     notice "Trying to exhume a key out of image $imagefile"
     for c in 1 2 3; do
 	if [ $c = 1 ]; then
@@ -880,7 +880,7 @@ install_tomb() {
   </mime-type>
   <mime-type type="application/x-tomb-key">
     <comment>Tomb crypto key</comment>
-    <glob pattern="*.key"/>
+    <glob pattern="*.tomb.key"/>
   </mime-type>
 </mime-info>
 EOF
@@ -901,7 +901,7 @@ Comment=Keep your bones safe
 Exec=tomb-open %U
 TryExec=tomb-open
 Icon=monmort.xpm
-Terminal=false
+Terminal=true
 Categories=Utility;Security;Archiving;Filesystem;
 MimeType=application/x-tomb-volume;
 X-AppInstall-Package=tomb
@@ -910,7 +910,7 @@ EOF
 
     act "updating menus..."
     cat <<EOF > /etc/menu/tomb
-?package(tomb):command="tomb" icon="/usr/share/pixmaps/monmort.xpm" needs="cryptsetup" \
+?package(tomb):command="tomb" icon="/usr/share/pixmaps/monmort.xpm" needs="text" \
 	section="Applications/Accessories" title="Tomb" hints="Crypto" \
 	hotkey="Tomb"
 EOF
@@ -931,7 +931,7 @@ application/x-tomb-volume
 	ext: tomb
 
 application/x-tomb-key
-        ext: key
+        ext: tomb.key
 EOF
     cat <<EOF > /usr/lib/mime/packages/tomb
 application/x-tomb-volume; tomb-open '%s'; priority=8
@@ -946,7 +946,7 @@ tomb
          name=Tomb - Crypto Undertaker
          can_open_multiple_files=false
          expects_uris=false
-         requires_terminal=false
+         requires_terminal=true
          mime-types=application/x-tomb-volume,application/x-tomb-key
 EOF
     act "Tomb is now installed."
diff --git a/src/tomb-open b/src/tomb-open
@@ -168,8 +168,8 @@ if [ $1 ]; then # is it a file?
 	# is it a luks partition
 	file ${tombdir}/${tombfile} | grep -i LUKS > /dev/null
 	if [ $? = 0 ]; then # tomb is a valid LUKS file
-	    if [ -r ${tombdir}/${tombname}.key ]; then
-		tombkey=${tombdir}/${tombname}.key
+	    if [ -r ${tombdir}/${tombname}.tomb.key ]; then
+		tombkey=${tombdir}/${tombname}.tomb.key
 	    else
 		ask_usbkey
 		if ! [ $usbkey_mount ]; then # no usb key was mounted
@@ -177,8 +177,8 @@ if [ $1 ]; then # is it a file?
 		    echo "operation aborted." # TODO: dialog with pinentry
 		    exit 1
 		else # usb mounted, check key presence
-		    if [ -r ${usbkey_mount}/.tomb/${tombname}.key ]; then
-			tombkey=${usbkey_mount}/.tomb/${tombname}.key
+		    if [ -r ${usbkey_mount}/.tomb/${tombname}.tomb.key ]; then
+			tombkey=${usbkey_mount}/.tomb/${tombname}.tomb.key
 		    elif [ -r ${usbkey_mount}/.tomb ]; then
 			echo "we can't find the right key, have a look yourself:"
 			ls -lha ${usbkey_mount}/.tomb
@@ -335,12 +335,12 @@ if [ $? = 0 ]; then
 	echo "${tombname}.key succesfully saved on your USB"
 	echo "now we'll proceed opening your brand new tomb"
 
-	tomb -k ${tombname}.key open ${tombfile}
+	tomb -k ${tombname}.tomb.key open ${tombfile}
 	if [ $? = 0 ]; then
 	    launch_status ${tombname}
 	fi
 
-	rm -f ${tombname}.key
+	rm -f ${tombname}.tomb.key
 
 	sudo umount ${usbkey_mount}
 	rmdir  ${usbkey_mount}
@@ -357,7 +357,7 @@ cat <<EOF
   named .tomb inside the first partition of an usb key.
 EOF
 
-tomb -k ${tombname}.key open ${tombfile}
+tomb -k ${tombname}.tomb.key open ${tombfile}
 if [ $? = 0 ]; then
     launch_status ${tombname}
 fi