"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tomb" between
Tomb-2.8.tar.gz and Tomb-2.8.1.tar.gz

About: Tomb is a commandline tool to manage encrypted storage folders.

tomb  (Tomb-2.8):tomb  (Tomb-2.8.1)
skipping to change at line 33 skipping to change at line 33
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Please refer # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Please refer
# to the GNU Public License for more details. # to the GNU Public License for more details.
# #
# You should have received a copy of the GNU Public License along with # You should have received a copy of the GNU Public License along with
# this source code; if not, , see <https://www.gnu.org/licenses/>. # this source code; if not, , see <https://www.gnu.org/licenses/>.
# }}} - License # }}} - License
# {{{ Global variables # {{{ Global variables
typeset VERSION="2.8" typeset VERSION="2.8.1"
typeset DATE="Nov/2020" typeset DATE="Nov/2020"
typeset TOMBEXEC=$0 typeset TOMBEXEC=$0
typeset TMPPREFIX=${TMPPREFIX:-/tmp} typeset TMPPREFIX=${TMPPREFIX:-/tmp}
# TODO: configure which tmp dir to use from a cli flag # TODO: configure which tmp dir to use from a cli flag
# Tomb is using some global variables set by the shell: # Tomb is using some global variables set by the shell:
# TMPPREFIX, UID, GID, PATH, TTY, USERNAME # TMPPREFIX, UID, GID, PATH, TTY, USERNAME
# You can grep 'global variable' to see where they are used. # You can grep 'global variable' to see where they are used.
# Keep a reference of the original command line arguments # Keep a reference of the original command line arguments
skipping to change at line 429 skipping to change at line 429
elif _is_found "pinentry-qt4"; then elif _is_found "pinentry-qt4"; then
_verbose "using pinentry-qt4" _verbose "using pinentry-qt4"
output=$(pinentry_assuan_getpass | pinentry-qt4) output=$(pinentry_assuan_getpass | pinentry-qt4)
pass_asked=1 pass_asked=1
fi fi
fi fi
if [[ "$pass_asked" == 0 ]]; then if [[ "$pass_asked" == 0 ]]; then
_verbose "no display detected" _verbose "no display detected"
_is_found "pinentry-curses" && { _is_found "pinentry-curses" && {
_verbose "using pinentry-curses with no display" _verbose "using pinentry-curses with no display"
output=$(pinentry_assuan_getpassgetpasspass | pinentry-cu rses) output=$(pinentry_assuan_getpass | pinentry-curses)
pass_asked=1 pass_asked=1
} }
fi fi
[[ "$pass_asked" == 0 ]] && [[ "$pass_asked" == 0 ]] &&
_failure "Cannot find any pinentry-curses and no DISPLAY detected ." _failure "Cannot find any pinentry-curses and no DISPLAY detected ."
# parse the pinentry output # parse the pinentry output
local pinentry_error local pinentry_error
for i in ${(f)output}; do for i in ${(f)output}; do
skipping to change at line 588 skipping to change at line 588
# use the entire filename if the previous transformation returns # use the entire filename if the previous transformation returns
# an empty string. This handles the corner case of tomb being # an empty string. This handles the corner case of tomb being
# hidden files (starting with a dot) and have no extension (only # hidden files (starting with a dot) and have no extension (only
# one dot in string) # one dot in string)
TOMBNAME=${TOMBNAME:-${TOMBFILE}} TOMBNAME=${TOMBNAME:-${TOMBFILE}}
[[ "$TOMBNAME" = "" ]] && [[ "$TOMBNAME" = "" ]] &&
_failure "Tomb won't work without a TOMBNAME." _failure "Tomb won't work without a TOMBNAME."
# checks if Tomb already mounted (or we cannot alter it) # checks if Tomb already mounted (or we cannot alter it)
local maphash=`realpath $TOMBPATH | sha256sum -z` local maphash=`realpath $TOMBPATH | sha256sum -z`
local nextloop=`losetup -f` local nextloop=`_sudo losetup -f`
TOMBMAPPER="tomb.$TOMBNAME.${maphash[(w)1]}.`basename $nextloop`" TOMBMAPPER="tomb.$TOMBNAME.${maphash[(w)1]}.`basename $nextloop`"
local mounted_tombs=(`list_tomb_mounts`) local mounted_tombs=(`list_tomb_mounts`)
local usedmapper local usedmapper
for t in ${mounted_tombs}; do for t in ${mounted_tombs}; do
usedmapper=`basename "${t[(ws:;:)1]}"` usedmapper=`basename "${t[(ws:;:)1]}"`
[[ "${usedmapper%.*}" == "${TOMBMAPPER%.*}" ]] && [[ "${usedmapper%.*}" == "${TOMBMAPPER%.*}" ]] &&
_failure "Tomb file already in use: ::1 tombname::" $TOMB PATH _failure "Tomb file already in use: ::1 tombname::" $TOMB PATH
done done
_verbose "Mapper: ::1 mapper::" $TOMBMAPPER _verbose "Mapper: ::1 mapper::" $TOMBMAPPER
skipping to change at line 769 skipping to change at line 769
local i local i
command -v gettext 1>/dev/null 2>/dev/null && msg="$(gettext -s "$2")" command -v gettext 1>/dev/null 2>/dev/null && msg="$(gettext -s "$2")"
for i in {3..${#}}; do for i in {3..${#}}; do
msg=${(S)msg//::$(($i - 2))*::/$*[$i]} msg=${(S)msg//::$(($i - 2))*::/$*[$i]}
done done
local command="print -P" local command="print -P"
local progname="${TOMBEXEC##*/}" local progname="${TOMBEXEC##*/}"
local pchars="" local pchars=""
local pcolor="normal" local pcolor="normal"
local fd=1 local fd=2
local -i returncode local -i returncode
case "$1" in case "$1" in
inline) inline)
command+=" -n"; pchars=" > "; pcolor="yellow" command+=" -n"; pchars=" > "; pcolor="yellow"
;; ;;
message) message)
pchars=" . "; pcolor="white" pchars=" . "; pcolor="white"
;; ;;
verbose) verbose)
pchars="[D]"; pcolor="blue" pchars="[D]"; pcolor="blue"
fd=2
;; ;;
success) success)
pchars="(*)"; pcolor="green" pchars="(*)"; pcolor="green"
;; ;;
warning) warning)
pchars="[W]"; pcolor="yellow" pchars="[W]"; pcolor="yellow"
;; ;;
failure) failure)
pchars="[E]"; pcolor="red" pchars="[E]"; pcolor="red"
fd=2
returncode=1 returncode=1
;; ;;
print) print)
progname="" progname=""
fd=1
;; ;;
*) *)
pchars="[F]"; pcolor="red" pchars="[F]"; pcolor="red"
msg="Developer oops! Usage: _msg MESSAGE_TYPE \"MESSAGE_ CONTENT\"" msg="Developer oops! Usage: _msg MESSAGE_TYPE \"MESSAGE_ CONTENT\""
fd=2
returncode=127 returncode=127
;; ;;
esac esac
[[ -n $_MSG_FD_OVERRIDE ]] && fd=$_MSG_FD_OVERRIDE [[ -n $_MSG_FD_OVERRIDE ]] && fd=$_MSG_FD_OVERRIDE
if [[ -t $fd ]]; then if [[ -t $fd ]]; then
[[ -n "$progname" ]] && progname="$fg[magenta]$progname$reset_colo r" [[ -n "$progname" ]] && progname="$fg[magenta]$progname$reset_colo r"
[[ -n "$pchars" ]] && pchars="$fg_bold[$pcolor]$pchars$reset_color " [[ -n "$pchars" ]] && pchars="$fg_bold[$pcolor]$pchars$reset_color "
msg="$fg[$pcolor]$msg$reset_color" msg="$fg[$pcolor]$msg$reset_color"
skipping to change at line 2429 skipping to change at line 2427
for t in ${mounted_tombs}; do for t in ${mounted_tombs}; do
mapper=`basename ${t[(ws:;:)1]}` mapper=`basename ${t[(ws:;:)1]}`
tombname=${t[(ws:;:)5]} tombname=${t[(ws:;:)5]}
tombmount=${t[(ws:;:)2]} tombmount=${t[(ws:;:)2]}
tombfs=${t[(ws:;:)3]} tombfs=${t[(ws:;:)3]}
tombfsopts=${t[(ws:;:)4]} tombfsopts=${t[(ws:;:)4]}
tombloop=${mapper[(ws:.:)4]} tombloop=${mapper[(ws:.:)4]}
# calculate tomb size # calculate tomb size
ts=`df -hP /dev/mapper/$TOMBMAPPER | ts=`df -hP /dev/mapper/$mapper |
awk "/mapper/"' { print $2 ";" $3 ";" $4 ";" $5 }'` awk "/mapper/"' { print $2 ";" $3 ";" $4 ";" $5 }'`
tombtot=${ts[(ws:;:)1]} tombtot=${ts[(ws:;:)1]}
tombused=${ts[(ws:;:)2]} tombused=${ts[(ws:;:)2]}
tombavail=${ts[(ws:;:)3]} tombavail=${ts[(ws:;:)3]}
tombpercent=${ts[(ws:;:)4]} tombpercent=${ts[(ws:;:)4]}
tombp=${tombpercent%%%} tombp=${tombpercent%%%}
# obsolete way to get the last open date from /dev/mapper # obsolete way to get the last open date from /dev/mapper
# which doesn't work when tomb filename contain dots # which doesn't work when tomb filename contain dots
# tombsince=`date --date=@${mapper[(ws:.:)3]} +%c` # tombsince=`date --date=@${mapper[(ws:.:)3]} +%c`
skipping to change at line 2476 skipping to change at line 2474
_message "::1 tombname:: size ::2 tombtot:: of which ::3 tombused :: (::5 tombpercent::%) is used: ::4 tombavail:: free " \ _message "::1 tombname:: size ::2 tombtot:: of which ::3 tombused :: (::5 tombpercent::%) is used: ::4 tombavail:: free " \
$tombname $tombtot $tombused $tombavail $tombper cent $tombname $tombtot $tombused $tombavail $tombper cent
[[ ${tombp} -ge 90 ]] && { [[ ${tombp} -ge 90 ]] && {
_warning "::1 tombname:: warning: your tomb is almost ful l!" $tombname _warning "::1 tombname:: warning: your tomb is almost ful l!" $tombname
} }
# Now check hooks # Now check hooks
mounted_hooks=(`list_tomb_binds $tombname $tombmount`) mounted_hooks=(`list_tomb_binds $tombname $tombmount`)
for h in ${mounted_hooks}; do for h in ${mounted_hooks}; do
_message "::1 tombname:: hooks ::2 hookname:: on ::3 hook _message "::1 tombname:: hooks ::2 hookdest::" \
dest::" \ $tombname ${h[(ws:;:)2]}
$tombname "`basename ${h[(ws:;:)1]}`" ${
h[(ws:;:)2]}
done done
done done
} }
# Print out an array of mounted tombs (internal use) # Print out an array of mounted tombs (internal use)
# Format is semi-colon separated list of attributes # Format is semi-colon separated list of attributes
# if 1st arg is supplied, then list only that tomb # if 1st arg is supplied, then list only that tomb
# #
# String positions in the semicolon separated array: # String positions in the semicolon separated array:
# #
skipping to change at line 3302 skipping to change at line 3300
# Make tomb functions available to the calling shell or script # Make tomb functions available to the calling shell or script
'source') return 0 ;; 'source') return 0 ;;
# Ask user for a password interactively # Ask user for a password interactively
askpass) ask_password $PARAM[1] $PARAM[2] ;; askpass) ask_password $PARAM[1] $PARAM[2] ;;
# Default operation: presentation, or version information with -v # Default operation: presentation, or version information with -v
__default) __default)
_print "Tomb ::1 version:: - a strong and gentle undertak er for your secrets" $VERSION _print "Tomb ::1 version:: - a strong and gentle undertak er for your secrets" $VERSION
echo echo
_print " Copyright (C) 2007-2017 Dyne.org Foundation, Lic ense GNU GPL v3+" _print " Copyright (C) 2007-2020 Dyne.org Foundation, Lic ense GNU GPL v3+"
_print " This is free software: you are free to change an d redistribute it" _print " This is free software: you are free to change an d redistribute it"
_print " For the latest sourcecode go to <http://dyne.org /software/tomb>" _print " For the latest sourcecode go to <http://dyne.org /software/tomb>"
echo echo
option_is_set -v && { option_is_set -v && {
local langwas=$LANG local langwas=$LANG
LANG=en LANG=en
_print " This source code is distributed in the h ope that it will be useful," _print " This source code is distributed in the h ope that it will be useful,"
_print " but WITHOUT ANY WARRANTY; without even t he implied warranty of" _print " but WITHOUT ANY WARRANTY; without even t he implied warranty of"
_print " MERCHANTABILITY or FITNESS FOR A PARTICU LAR PURPOSE." _print " MERCHANTABILITY or FITNESS FOR A PARTICU LAR PURPOSE."
LANG=$langwas LANG=$langwas
 End of changes. 11 change blocks. 
13 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)