mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-25 14:17:41 +00:00
Removed QUIET and DEBUG globals
Addressed removal of $CMD2 and $CMD3, too. They were deprecated since a long time. You should use $PARAM[1], $PARAM[2],... instead
This commit is contained in:
parent
e19c837598
commit
40af028d8f
43
src/tomb
43
src/tomb
@ -401,8 +401,8 @@ EOF
|
|||||||
# {{{ - HELPERS FOR KEYS
|
# {{{ - HELPERS FOR KEYS
|
||||||
# {{{ - Encode Key
|
# {{{ - Encode Key
|
||||||
encode_key() {
|
encode_key() {
|
||||||
tombkey=$CMD2
|
tombkey=$1
|
||||||
imagefile=$CMD3
|
imagefile=$2
|
||||||
|
|
||||||
file $tombkey | grep PGP > /dev/null
|
file $tombkey | grep PGP > /dev/null
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
@ -457,8 +457,8 @@ encode_key() {
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ - Decode Key
|
# {{{ - Decode Key
|
||||||
decode_key() {
|
decode_key() {
|
||||||
tombname=$CMD2
|
tombname=$1
|
||||||
imagefile=$CMD3
|
imagefile=$2
|
||||||
res=1
|
res=1
|
||||||
|
|
||||||
file $imagefile | grep JPEG > /dev/null
|
file $imagefile | grep JPEG > /dev/null
|
||||||
@ -597,13 +597,13 @@ create_tomb() {
|
|||||||
_message "Commanded to create tomb $CMD2"
|
_message "Commanded to create tomb $CMD2"
|
||||||
if ! option_is_set -f; then check_swap; fi
|
if ! option_is_set -f; then check_swap; fi
|
||||||
|
|
||||||
if ! [ ${CMD2} ]; then
|
if ! [ $1 ]; then
|
||||||
_warning "no tomb name specified for creation"
|
_warning "no tomb name specified for creation"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tombfile=`basename ${CMD2}`
|
tombfile=`basename $1`
|
||||||
tombdir=`dirname ${CMD2}`
|
tombdir=`dirname $1`
|
||||||
# make sure the file has a .tomb extension
|
# make sure the file has a .tomb extension
|
||||||
tombname=${tombfile%%\.*}
|
tombname=${tombfile%%\.*}
|
||||||
tombfile=${tombname}.tomb
|
tombfile=${tombname}.tomb
|
||||||
@ -767,11 +767,12 @@ create_tomb() {
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ - Open
|
# {{{ - Open
|
||||||
|
|
||||||
|
# $1 = tombfile $2(optional) = mountpoint
|
||||||
mount_tomb() {
|
mount_tomb() {
|
||||||
_message "Commanded to open tomb $CMD2"
|
_message "Commanded to open tomb $1"
|
||||||
if ! option_is_set -f; then check_swap; fi
|
if ! option_is_set -f; then check_swap; fi
|
||||||
|
|
||||||
if ! [ ${CMD2} ]; then
|
if ! [ ${1} ]; then
|
||||||
_warning "no tomb name specified for creation"
|
_warning "no tomb name specified for creation"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -783,12 +784,12 @@ mount_tomb() {
|
|||||||
local tombfile
|
local tombfile
|
||||||
local tombdir
|
local tombdir
|
||||||
local tombname
|
local tombname
|
||||||
tombfile=`basename ${CMD2}`
|
tombfile=`basename ${1}`
|
||||||
tombdir=`dirname ${CMD2}`
|
tombdir=`dirname ${1}`
|
||||||
# check file type (if its a Luks fs)
|
# check file type (if its a Luks fs)
|
||||||
file ${tombdir}/${tombfile} | grep -i 'luks encrypted file' 2>&1 >/dev/null
|
file ${tombdir}/${tombfile} | grep -i 'luks encrypted file' 2>&1 >/dev/null
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
_warning "$CMD2 is not a valid tomb file, operation aborted"
|
_warning "$1 is not a valid tomb file, operation aborted"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
tombname=${tombfile%%\.*}
|
tombname=${tombfile%%\.*}
|
||||||
@ -815,14 +816,14 @@ mount_tomb() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ $CMD3 ]; then
|
if ! [ $2 ]; then
|
||||||
tombmount=/media/${tombfile}
|
tombmount=/media/${tombfile}
|
||||||
_message "mountpoint not specified, using default: $tombmount"
|
_message "mountpoint not specified, using default: $tombmount"
|
||||||
elif ! [ -x $CMD3 ]; then
|
elif ! [ -x $2 ]; then
|
||||||
_warning "mountpoint $CMD3 doesn't exist, operation aborted."
|
_warning "mountpoint $2 doesn't exist, operation aborted."
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
tombmount=${CMD3}
|
tombmount=$2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if its already open
|
# check if its already open
|
||||||
@ -1689,16 +1690,16 @@ main() {
|
|||||||
CMD2=$PARAM[1]
|
CMD2=$PARAM[1]
|
||||||
CMD3=$PARAM[2]
|
CMD3=$PARAM[2]
|
||||||
|
|
||||||
xxx "Tomb command: $CMD $CMD2 $CMD3"
|
xxx "Tomb command: $subcommand ${PARAM}"
|
||||||
|
|
||||||
case "$subcommand" in
|
case "$subcommand" in
|
||||||
create)
|
create)
|
||||||
check_priv
|
check_priv
|
||||||
create_tomb
|
create_tomb $PARAM[1]
|
||||||
;;
|
;;
|
||||||
mount|open)
|
mount|open)
|
||||||
check_priv
|
check_priv
|
||||||
mount_tomb
|
mount_tomb $PARAM[1] $PARAM[2]
|
||||||
;;
|
;;
|
||||||
umount|close|slam)
|
umount|close|slam)
|
||||||
check_priv
|
check_priv
|
||||||
@ -1730,7 +1731,7 @@ main() {
|
|||||||
_warning "steghide not installed. Cannot exhume your key"
|
_warning "steghide not installed. Cannot exhume your key"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
decode_key ${CMD2}
|
decode_key ${CMD2} ${CMD3}
|
||||||
;;
|
;;
|
||||||
resize)
|
resize)
|
||||||
check_priv
|
check_priv
|
||||||
@ -1758,7 +1759,7 @@ EOF
|
|||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
_warning "command \"$CMD\" not recognized"
|
_warning "command \"$subcommand\" not recognized"
|
||||||
_message "try -h for help"
|
_message "try -h for help"
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user