Permalink
Browse files

Update undertaker to the new _msg

  • Loading branch information...
1 parent d0e44bb commit 105a0e14c1f7facfabe0c4ee0c143e40b42dec05 hellekin committed Dec 1, 2011
Showing with 18 additions and 21 deletions.
  1. +18 −21 src/undertaker
View
@@ -6,7 +6,7 @@
#
# Undertaker is a tool to retrieve tomb keys from various sources
#
-# Copyleft (C) 2011 Denis Roio <jaromil@dyne.org>
+# {{{ Copyleft (C) 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
@@ -22,6 +22,7 @@
# this source code; if not, write to:
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# }}}
# first of all source the tomb core functions
which tomb > /dev/null
@@ -31,45 +32,42 @@ fi
source tomb source
if ! [ $1 ] ; then
- error "an argument is missing, the undertaker is confused"
- act "usage: undertaker url://host:path/to/tomb.key"
- exit 1;
+ _warning "an argument is missing, the undertaker is confused"
+ _failure "usage: undertaker url://host:path/to/tomb.key"
fi
ARG1=${1}
check_bin
-notice "Undertaker will look for ${ARG1}"
+_message "Undertaker will look for ${ARG1}"
baseurl=${ARG1%//*}
case $baseurl in
bluetooth:)
- act "access to bluetooth protocol requested"
+ _message "access to bluetooth protocol requested"
which obexftp &> /dev/null
if [[ $? != 0 ]]; then
- error "obexftp not found, needed for bluetooth: operation aborted."
- exit 1
+ die "obexftp not found, needed for bluetooth: operation aborted."
fi
keytmp=`safe_dir undertaker`
cd $keytmp
# fetch key from bluetooth, url format: bluetooth://55:33:44:55:66/file/path
obexdevpath=${ARG1#*//}
obexdev=${obexdevpath%%/*}
obexpath=${obexdevpath#*/}
- act "obex device: $obexdev"
- act "obex path: $obexpath"
+ _message "obex device: $obexdev"
+ _message "obex path: $obexpath"
obexftp -b $obexdev -g $obexpath
if [[ $? != 0 ]]; then
- error "a problem occurred retreiving the key via bluetooth."
rmdir ${keytmp}
- exit 1;
+ die "a problem occurred retreiving the key via bluetooth."
fi
# print out the key on stdout
cat $obexpath >&1
# wipe out the key
- ${WIPE[@]} $obexpath
+ ${=WIPE} $obexpath
cd -
rmdir ${keytmp}
@@ -78,19 +76,18 @@ case $baseurl in
;;
file:)
- act "local file access requested"
- error "TODO"
+ _message "local file access requested"
+ die "TODO"
;;
http:)
- act "access to web protocol requested"
- error "TODO"
+ _message "access to web protocol requested"
+ die "TODO"
;;
ssh:)
- act "access to secure shell requested"
- error "TODO"
+ _message "access to secure shell requested"
+ die "TODO"
;;
*)
- error "url protocol not recognized: $baseurl"
- exit 1
+ die "url protocol not recognized: $baseurl"
;;
esac

0 comments on commit 105a0e1

Please sign in to comment.