mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-10 23:20:57 +00:00
[cleanup] Formalize tests for flags
This commit is contained in:
parent
da183aa689
commit
9539d0cc4b
39
tomb
39
tomb
@ -49,11 +49,14 @@ DD=(dd)
|
|||||||
WIPE=(rm -f)
|
WIPE=(rm -f)
|
||||||
MKFS=(mkfs.ext3 -q -F -j -L)
|
MKFS=(mkfs.ext3 -q -F -j -L)
|
||||||
|
|
||||||
KDF=1
|
# Flag optional commands if available
|
||||||
STEGHIDE=1
|
typeset -i 2 KDF=1
|
||||||
RESIZER=1
|
typeset -i 2 STEGHIDE=1
|
||||||
SWISH=1
|
typeset -i 2 RESIZER=1
|
||||||
QRENCODE=1
|
typeset -i 2 SWISH=1
|
||||||
|
typeset -i 2 QRENCODE=1
|
||||||
|
|
||||||
|
# Default mount options
|
||||||
MOUNTOPTS="rw,noatime,nodev"
|
MOUNTOPTS="rw,noatime,nodev"
|
||||||
|
|
||||||
# prefix for temporary files
|
# prefix for temporary files
|
||||||
@ -405,22 +408,22 @@ _print " search looks for filenames matching text patterns"
|
|||||||
_print " list list of open TOMBs and information on them"
|
_print " list list of open TOMBs and information on them"
|
||||||
_print " close close a specific TOMB (or 'all')"
|
_print " close close a specific TOMB (or 'all')"
|
||||||
_print " slam slam a TOMB killing all programs using it"
|
_print " slam slam a TOMB killing all programs using it"
|
||||||
if [ "$RESIZER" = 1 ]; then
|
[[ $RESIZER == 1 ]] && {
|
||||||
_print " resize resize a TOMB to a new size -s (can only grow)"
|
_print " resize resize a TOMB to a new size -s (can only grow)"
|
||||||
fi
|
}
|
||||||
_print "\000"
|
_print "\000"
|
||||||
_print " // Operations on keys:"
|
_print " // Operations on keys:"
|
||||||
_print " passwd change the password of a KEY"
|
_print " passwd change the password of a KEY"
|
||||||
_print " setkey change the KEY locking a TOMB (needs old one)"
|
_print " setkey change the KEY locking a TOMB (needs old one)"
|
||||||
_print "\000"
|
_print "\000"
|
||||||
{ test "$QRENCODE" = "1" } && {
|
[[ $QRENCODE == 1 ]] && {
|
||||||
_print " engrave makes a QR code of a KEY to be saved on paper"
|
_print " engrave makes a QR code of a KEY to be saved on paper"
|
||||||
}
|
}
|
||||||
_print "\000"
|
_print "\000"
|
||||||
if [ "$STEGHIDE" = 1 ]; then
|
[[ $STEGHIDE == 1 ]] && {
|
||||||
_print " bury hide a KEY inside a JPEG image"
|
_print " bury hide a KEY inside a JPEG image"
|
||||||
_print " exhume extract a KEY from a JPEG image"
|
_print " exhume extract a KEY from a JPEG image"
|
||||||
fi
|
}
|
||||||
_print "\000"
|
_print "\000"
|
||||||
_print "Options:"
|
_print "Options:"
|
||||||
_print "\000"
|
_print "\000"
|
||||||
@ -429,7 +432,7 @@ _print " -k path to the key to be used ('-k -' to read from stdin)"
|
|||||||
_print " -n don't process the hooks found in tomb"
|
_print " -n don't process the hooks found in tomb"
|
||||||
_print " -o mount options used to open (default: rw,noatime,nodev)"
|
_print " -o mount options used to open (default: rw,noatime,nodev)"
|
||||||
_print " -f force operation (i.e. even if swap is active)"
|
_print " -f force operation (i.e. even if swap is active)"
|
||||||
{ test "$KDF" = 1 } && {
|
[[ $KDF == 1 ]] && {
|
||||||
_print " --kdf generate passwords armored against dictionary attacks"
|
_print " --kdf generate passwords armored against dictionary attacks"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -899,7 +902,7 @@ gen_key() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
header=""
|
header=""
|
||||||
{ test "$KDF" = 1 } && {
|
[[ $KDF == 1 ]] && {
|
||||||
{ option_is_set --kdf } && {
|
{ option_is_set --kdf } && {
|
||||||
# KDF is a new key strenghtening technique against brute forcing
|
# KDF is a new key strenghtening technique against brute forcing
|
||||||
# see: https://github.com/dyne/Tomb/issues/82
|
# see: https://github.com/dyne/Tomb/issues/82
|
||||||
@ -1935,7 +1938,7 @@ index_tombs() {
|
|||||||
updatedb -l 0 -o ${tombmount}/.updatedb -U ${tombmount}
|
updatedb -l 0 -o ${tombmount}/.updatedb -U ${tombmount}
|
||||||
|
|
||||||
# here we use swish to index file contents
|
# here we use swish to index file contents
|
||||||
{ test $SWISH = 1 } && {
|
[[ $SWISH == 1 ]] && {
|
||||||
_message "Indexing ::1 tomb name:: contents..." $tombname
|
_message "Indexing ::1 tomb name:: contents..." $tombname
|
||||||
tmp_create
|
tmp_create
|
||||||
swishrc=`tmp_new`
|
swishrc=`tmp_new`
|
||||||
@ -2045,7 +2048,7 @@ search_tombs() {
|
|||||||
_message "Matches found: ::1 matches::" $(locate -d ${tombmount}/.updatedb -e -i -c ${(f)@})
|
_message "Matches found: ::1 matches::" $(locate -d ${tombmount}/.updatedb -e -i -c ${(f)@})
|
||||||
|
|
||||||
# use swish-e to search over contents
|
# use swish-e to search over contents
|
||||||
{ test $SWISH = 1 } && { test -r $tombmount/.swish } && {
|
[[ $SWISH == 1 && -r $tombmount/.swish ]] && {
|
||||||
_message "Searching contents in tomb ::1 tomb name::" $tombname
|
_message "Searching contents in tomb ::1 tomb name::" $tombname
|
||||||
swish-e -w ${=@} -f $tombmount/.swish -H0 }
|
swish-e -w ${=@} -f $tombmount/.swish -H0 }
|
||||||
|
|
||||||
@ -2461,7 +2464,7 @@ main() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
engrave)
|
engrave)
|
||||||
{ test "$QRENCODE" = 0 } && {
|
[[ $QRENCODE == 0 ]] && {
|
||||||
_failure "QREncode not installed: cannot engrave keys on paper." }
|
_failure "QREncode not installed: cannot engrave keys on paper." }
|
||||||
engrave_key ${=PARAM}
|
engrave_key ${=PARAM}
|
||||||
;;
|
;;
|
||||||
@ -2499,17 +2502,17 @@ main() {
|
|||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
bury)
|
bury)
|
||||||
{ test "$STEGHIDE" = 0 } && {
|
[[ $STEGHIDE == 0 ]] && {
|
||||||
_failure "Steghide not installed: cannot bury keys into images." }
|
_failure "Steghide not installed: cannot bury keys into images." }
|
||||||
bury_key $PARAM[1]
|
bury_key $PARAM[1]
|
||||||
;;
|
;;
|
||||||
exhume)
|
exhume)
|
||||||
{ test "$STEGHIDE" = 0 } && {
|
[[ $STEGHIDE == 0 ]] && {
|
||||||
_failure "Steghide not installed: cannot exhume keys from images." }
|
_failure "Steghide not installed: cannot exhume keys from images." }
|
||||||
exhume_key $PARAM[1]
|
exhume_key $PARAM[1]
|
||||||
;;
|
;;
|
||||||
resize)
|
resize)
|
||||||
{ test "$RESIZER" = 0 } && {
|
[[ $RESIZER == 0 ]] && {
|
||||||
_failure "Resize2fs not installed: cannot resize tombs." }
|
_failure "Resize2fs not installed: cannot resize tombs." }
|
||||||
check_priv
|
check_priv
|
||||||
resize_tomb $PARAM[1]
|
resize_tomb $PARAM[1]
|
||||||
|
Loading…
Reference in New Issue
Block a user