commit 4475af91a67a08eff77b2ae0d7c6ff7870c21c4e
parent 650ce60587c5c0a6800fbd5ddd1a9c8a1977e77a
Author: Jaromil <jaromil@dyne.org>
Date: Wed, 19 Jan 2011 12:38:19 +0100
removed tomb-notify,
substituted by generic tool notify-send in libnotify-bin package
also minor fixes and docu updates
Diffstat:
5 files changed, 32 insertions(+), 90 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,8 +1,7 @@
August 2010
- The first public version of Tomb is released to the public
-
+ The first version of Tomb ever released to the public
During the year 2009
@@ -15,8 +14,6 @@ Sometime in 2007
then renamed to Tomb. dyne:bolic specific dependencies where
removed, keeping Zsh as the shell script it is written with.
-
-
Back in 2005
The "nesting" feature of dyne:bolic GNU/Linux lets users encrypt
diff --git a/TODO b/TODO
@@ -1,8 +1,8 @@
-- debian packaging and mime-type installation
+- fix operation without DISPLAY (over SSH)
- system to split keys in parts (ssss)
- transport keys on qrcodes
-- gtk dialogs and configuration? should keep it minimal!
+- more gtk dialogs and configuration? should keep it minimal!
- use inotify on /media to watch usb key plug events
- analyse and show tomb entropy using libdisorder
- sign and verify tomb script integrity (executed as root)
diff --git a/src/Makefile.am b/src/Makefile.am
@@ -1,16 +1,12 @@
bin_SCRIPTS = tomb tomb-open
-bin_PROGRAMS = tomb-status tomb-notify tomb-askpass
+bin_PROGRAMS = tomb-status tomb-askpass
tomb_status_SOURCES = tomb-status.c
tomb_status_LDADD = @GTK2_LIBS@ @NOTIFY_LIBS@
tomb_status_CFLAGS = @GTK2_CFLAGS@ @NOTIFY_CFLAGS@
-tomb_notify_SOURCES = tomb-notify.c
-tomb_notify_LDADD = @NOTIFY_LIBS@
-tomb_notify_CFLAGS = @NOTIFY_CFLAGS@
-
tomb_askpass_SOURCES = tomb-askpass.c
tomb_askpass_LDADD = @GTK2_LIBS@
tomb_askpass_CFLAGS = @GTK2_CFLAGS@
diff --git a/src/tomb b/src/tomb
@@ -101,7 +101,7 @@ ask_password() {
exec_as_user which tomb-askpass
if [ $? = 0 ]; then
- keyname=`echo $enc_key | cut -d. -f1`
+ keyname=`basename $enc_key | cut -d. -f1`
export scolopendro="`exec_as_user tomb-askpass $keyname`"
return
elif [ -x /usr/bin/ssh-askpass ]; then # debian has this
@@ -124,6 +124,20 @@ ask_password() {
}
+# popup notification
+tomb-notify() {
+ if [ -z $1 ]; then
+ exec_as_user notify-send -i monmort \
+ -u low -h string:App:Tomb \
+ -h double:Version:${VERSION} \
+ "Tomb version $VERSION" \
+ "Hi, I'm the Undertaker.
+Let's start setting your Crypt?"
+ else
+ exec_as_user notify-send -i monmort ${@}
+ fi
+}
+
# drop privileges
exec_as_user() {
func "executing as user '$SUDO_USER': ${(f)@}"
@@ -270,7 +284,7 @@ create_tomb() {
cat /dev/urandom | dd bs=1 count=256 of=${keytmp}
notice "Setup your secret key file ${FILE}.gpg"
- exec_as_user tomb-notify "The Tomb key is being forged:" "please set your password."
+ tomb-notify "The Tomb key is being forged:" "please set your password."
# here user is prompted for key password
gpg -o "${FILE}.gpg" --no-options --openpgp -c -a ${keytmp}
while [ $? = 2 ]; do
@@ -299,7 +313,7 @@ create_tomb() {
act "This is recommended for safety:"
act "always keep the key in a different place than the door!"
act "If you answer yes, you'll need a USB KEY now: (yes/no)"
- exec_as_user tomb-notify "Tomb has forged a key." "Would you like to save it on USB?"
+ tomb-notify "Tomb has forged a key." "Would you like to save it on USB?"
echo -n " > "
read -q
if [ $? = 0 ]; then
@@ -331,7 +345,7 @@ create_tomb() {
losetup -d ${nstloop}
notice "done creating $FILE encrypted storage (using Luks dm-crypt AES/SHA256)"
- exec_as_user tomb-notify "The Tomb is ready!" "We will now open your new Tomb for the first time."
+ tomb-notify "The Tomb is ready!" "We will now open your new Tomb for the first time."
tomb mount $FILE
}
@@ -411,9 +425,8 @@ mount_tomb() {
if ! [ -r /dev/mapper/${mapper} ]; then
error "failure mounting the encrypted file"
- tail /var/log/messages
losetup -d ${nstloop}
- return
+ exit 1
fi
act "encrypted storage filesystem check"
@@ -422,8 +435,9 @@ mount_tomb() {
mount -o rw,noatime,nodev /dev/mapper/${mapper} ${MOUNT}
notice "encrypted storage $FILE succesfully mounted on $MOUNT"
- exec_as_user tomb-status ${mapper} ${FILE} ${MOUNT} &
+ ( exec_as_user tomb-status ${mapper} ${FILE} ${MOUNT} ) &
disown
+ exit 0
}
umount_tomb() {
@@ -476,7 +490,7 @@ umount_tomb() {
errno=`umount ${mapper}`
if ! [ $? = 0 ]; then
- exec_as_user tomb-notify "Tomb '$tombname' is too busy." \
+ tomb-notify "Tomb '$tombname' is too busy." \
"Close all applications and file managers, then try again."
exit 1
fi
@@ -500,7 +514,7 @@ umount_tomb() {
# fi
notice "crypt storage ${mapper} unmounted"
- exec_as_user tomb-notify "Tomb closed: $tombname" "Your bones will Rest In Peace."
+ tomb-notify "Tomb closed: $tombname" "Your bones will Rest In Peace."
exit 0
}
@@ -508,6 +522,9 @@ umount_tomb() {
# see http://developers.sun.com/solaris/articles/integrating_gnome.html
# and freedesktop specs
install() {
+
+# TODO: distro package deps (for binary)
+# debian: zsh, cryptsetup, libgtk2.0-0, libnotify-bin
act "updating mimetypes..."
cat <<EOF > /tmp/dyne-tomb.xml
<?xml version="1.0"?>
@@ -610,4 +627,4 @@ case "$CMD" in
;;
esac
-exit 1-
\ No newline at end of file
+exit 0+
\ No newline at end of file
diff --git a/src/tomb-notify.c b/src/tomb-notify.c
@@ -1,68 +0,0 @@
-/* Tomb - encrypted storage undertaker
- *
- * (c) Copyright 2007-2011 Denis Roio <jaromil@dyne.org>
- *
- * 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.
- */
-
-// this file is a notification tool to send messages on the screen
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <libnotify/notify.h>
-
-/* The Tomb icon is an artwork by Jordi aka Món Mort
- a nomadic graffiti artist from Barcelona */
-#include <monmort.xpm>
-
-int main(int argc, char **argv) {
- NotifyNotification *notice;
- GError *error;
- GdkPixbuf *pb_monmort;
-
- char title[256];
- char body[512];
-
- gtk_set_locale();
- gtk_init(&argc, &argv);
-
- // libnotify
- notify_init(PACKAGE);
-
- if(argc<3)
- snprintf(body,511, "Hi, I'm the Undertaker.\nLet's start setting your Crypt?");
- else
- snprintf(body,511, "%s", argv[2]);
-
- if(argc<2)
- snprintf(title,255,"%s version %s",PACKAGE,VERSION);
- else
- snprintf(title,255, "%s", argv[1]);
-
- // set the icon
- pb_monmort = gdk_pixbuf_new_from_xpm_data(monmort);
-
- notice = notify_notification_new(title, body, NULL, NULL);
- notify_notification_set_icon_from_pixbuf(notice, pb_monmort);
-
- notify_notification_show(notice, &error);
-
- notify_uninit();
-
- exit(0);
-
-}