Update undertaker to the new _msg

This commit is contained in:
hellekin 2011-12-01 21:39:10 +01:00
parent d0e44bb264
commit 105a0e14c1

View File

@ -6,7 +6,7 @@
# #
# Undertaker is a tool to retrieve tomb keys from various sources # 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 # 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 # modify it under the terms of the GNU Public License as published by
@ -22,6 +22,7 @@
# this source code; if not, write to: # this source code; if not, write to:
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# }}}
# first of all source the tomb core functions # first of all source the tomb core functions
which tomb > /dev/null which tomb > /dev/null
@ -31,26 +32,24 @@ fi
source tomb source source tomb source
if ! [ $1 ] ; then if ! [ $1 ] ; then
error "an argument is missing, the undertaker is confused" _warning "an argument is missing, the undertaker is confused"
act "usage: undertaker url://host:path/to/tomb.key" _failure "usage: undertaker url://host:path/to/tomb.key"
exit 1;
fi fi
ARG1=${1} ARG1=${1}
check_bin check_bin
notice "Undertaker will look for ${ARG1}" _message "Undertaker will look for ${ARG1}"
baseurl=${ARG1%//*} baseurl=${ARG1%//*}
case $baseurl in case $baseurl in
bluetooth:) bluetooth:)
act "access to bluetooth protocol requested" _message "access to bluetooth protocol requested"
which obexftp &> /dev/null which obexftp &> /dev/null
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
error "obexftp not found, needed for bluetooth: operation aborted." die "obexftp not found, needed for bluetooth: operation aborted."
exit 1
fi fi
keytmp=`safe_dir undertaker` keytmp=`safe_dir undertaker`
cd $keytmp cd $keytmp
@ -58,18 +57,17 @@ case $baseurl in
obexdevpath=${ARG1#*//} obexdevpath=${ARG1#*//}
obexdev=${obexdevpath%%/*} obexdev=${obexdevpath%%/*}
obexpath=${obexdevpath#*/} obexpath=${obexdevpath#*/}
act "obex device: $obexdev" _message "obex device: $obexdev"
act "obex path: $obexpath" _message "obex path: $obexpath"
obexftp -b $obexdev -g $obexpath obexftp -b $obexdev -g $obexpath
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
error "a problem occurred retreiving the key via bluetooth."
rmdir ${keytmp} rmdir ${keytmp}
exit 1; die "a problem occurred retreiving the key via bluetooth."
fi fi
# print out the key on stdout # print out the key on stdout
cat $obexpath >&1 cat $obexpath >&1
# wipe out the key # wipe out the key
${WIPE[@]} $obexpath ${=WIPE} $obexpath
cd - cd -
rmdir ${keytmp} rmdir ${keytmp}
@ -78,19 +76,18 @@ case $baseurl in
;; ;;
file:) file:)
act "local file access requested" _message "local file access requested"
error "TODO" die "TODO"
;; ;;
http:) http:)
act "access to web protocol requested" _message "access to web protocol requested"
error "TODO" die "TODO"
;; ;;
ssh:) ssh:)
act "access to secure shell requested" _message "access to secure shell requested"
error "TODO" die "TODO"
;; ;;
*) *)
error "url protocol not recognized: $baseurl" die "url protocol not recognized: $baseurl"
exit 1
;; ;;
esac esac