commit 052549a4f9ab400b3e8c46da566833a3c710b53a
parent 3ef639801915204ed8eb2f03bec63160464ac9cc
Author: Jaromil <jaromil@dyne.org>
Date: Mon, 9 May 2011 10:32:08 +0200
colors! :) and documentation for tomb list
Diffstat:
3 files changed, 43 insertions(+), 39 deletions(-)
diff --git a/TODO.org b/TODO.org
@@ -5,24 +5,10 @@ you are welcome to send patches to jaromil@dyne.org
* Release 1.0 :90%:
-** [#A] fix operation without DISPLAY (over SSH) :hellekin:
-** TODO [#A] SLAM tomb and kill all applications using it
-
- using lsof and fuser(1) we can do that easily
-
- we should ask user confirmation when closing a tomb if to slam
-
- tomb-askpass will become tomb-ask managing such user interaction,
- using libassuan and pinentry from the gpg project.
-
-** [#A] incremental backup system using bup :jaromil:
-
- tombs are modifed only where needed so file changes are local to
- the file segment where data is stored. duplicity handles this using
- gpg for backup sets and rdiff for incremental storage. its more
- stable than bup at this moment.
+** TODO [#C] make one single status handle more tombs
+** TODO [#C] decorate creation wizard with ASCII art
-** TODO [#B] remove gnome dependencies from tomb core
+** DONE [#B] remove gnome dependencies from tomb core :jaromil:
gksu is deeply connected to gnome in all its packages. actually
libgksu2-dev is and that doesn't helps.
@@ -35,10 +21,16 @@ you are welcome to send patches to jaromil@dyne.org
to sudo and provide it an interface to ask the password graphically
via pinentry
-** TODO [#C] make one single status handle more tombs
-** TODO [#C] decorate creation wizard with ASCII art
+** DONE [#B] SLAM tomb and kill all applications using it :anathema:
+
+ using lsof and fuser(1) we can do that easily
+ we should ask user confirmation when closing a tomb if to slam
+
+ tomb-askpass will become tomb-ask managing such user interaction,
+ using libassuan and pinentry from the gpg project.
+** DONE [#B] fix operation without DISPLAY (over SSH) :hellekin:
** DONE [#A] steganography to store tomb key :jaromil:
steghide can hide keys in JPG, BMP, WAV or AU files it also takes
diff --git a/doc/tomb.1 b/doc/tomb.1
@@ -49,6 +49,14 @@ where the tomb should be made accessible, if not then the tomb is
mounted in a directory named after the filename and inside /media.
.B
+.IP "list"
+
+List all the tombs found open, including information about the time
+they were opened and the hooks that they mounted. If the \fIfirst
+argument\fR is present, then shows only the tomb named that way or
+returns an error if its not found.
+
+.B
.IP "close"
Closes a currently open tomb. When \fIan argument\fR is specified, it
should be the name of a mounted tomb; if not specified and only one
diff --git a/src/tomb b/src/tomb
@@ -21,19 +21,21 @@
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
VERSION=1.0
-DATE=Feb/2011
+DATE=May/2011
TOMBEXEC=$0
TOMBOPENEXEC="tomb-open"
STEGHIDE=1
# PATH=/usr/bin:/usr/sbin:/bin:/sbin
+autoload colors; colors
+
# standard output message routines
# it's always useful to wrap them, in case we change behaviour later
-notice() { if ! [ $QUIET ]; then echo "[*] $1" >&2; fi }
-act() { if ! [ $QUIET ]; then echo " . $1" >&2; fi }
-error() { if ! [ $QUIET ]; then echo "[!] $1" >&2; fi }
-func() { if [ $DEBUG ]; then echo "[D] $1" >&2; fi }
+notice() { if ! [ $QUIET ]; then print "$fg_bold[green][*]$fg_no_bold[white] $1" >&2; fi }
+act() { if ! [ $QUIET ]; then print "$fg_bold[white] . $fg_no_bold[white] $1" >&2; fi }
+error() { if ! [ $QUIET ]; then print "$fg[red][!]$fg[white] $1" >&2; fi }
+func() { if [ $DEBUG ]; then print "$fg[blue][D]$fg[white] $1" >&2; fi }
check_bin() {
@@ -215,6 +217,7 @@ Commands:
create create a new tomb FILE and its keys
open open an existing tomb FILE on PLACE
+ list list all open tombs or the one called FILE
close close the open tomb called FILE (or all)
slam close tomb FILE and kill all pids using it
bury hide a tomb key FILE inside a jpeg PLACE
@@ -809,11 +812,11 @@ list_tombs() {
if ! [ $mounted_tombs ]; then
if [ $1 ]; then
- notice "There seems to be no open tomb engraved as [${1}]"
+ error "There seems to be no open tomb engraved as [${1}]"
else
- notice "I can't see any open tomb, may they all rest in peace."
+ error "I can't see any open tomb, may they all rest in peace."
fi
- return
+ exit 1
fi
@@ -827,23 +830,23 @@ list_tombs() {
tombsince=`date --date=@${mapper[(ws:.:)3]} +%c`
# breaking up such strings is good for translation
- echo -n $tombname
- echo -n " open on "
- echo -n $tombmount
- echo -n " using "
- echo -n "$tombfs $tombfsopts"
- echo -n " since "
- echo $tombsince
+ print -n "$fg[green]$tombname"
+ print -n "$fg[white] open on "
+ print -n "$fg_bold[white]$tombmount"
+ print -n "$fg_no_bold[white] using "
+ print -n "$fg_bold[white]$tombfs $tombfsopts"
+ print -n "$fg_no_bold[white] since "
+ print "$fg_bold[white]$tombsince$fg_no_bold[white]"
# now check hooks
mtomb=`sed 's:\/:\\\/:g' <<< $tombmount`
mounted_hooks=`mount | awk "/^$mtomb/"' {print $1 ";" $3}'`
for h in ${(f)mounted_hooks}; do
- echo -n $tombname
- echo -n " hooks "
- echo -n `basename ${h[(ws:;:)1]}`
- echo -n " on "
- echo ${h[(ws:;:)2]}
+ print -n "$fg[green]$tombname"
+ print -n "$fg_no_bold[white] hooks "
+ print -n "$fg_bold[white]`basename ${h[(ws:;:)1]}`"
+ print -n "$fg_no_bold[white] on "
+ print "$fg_bold[white]${h[(ws:;:)2]}$fg_no_bold[white]"
done
done
}
@@ -990,6 +993,7 @@ main () {
close) check_priv ; umount_tomb ${CMD2} ;;
slam) check_priv ; SLAM=1; umount_tomb ${CMD2} ;;
list) list_tombs ${CMD2} ;;
+ help) usage ;;
bury) if [ "$STEGHIDE" = 0 ]; then
error "steghide not installed. Cannot bury your key"
return 1