diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-05-30 14:45:45 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-05-30 14:45:45 -0300 |
commit | b2d96296ca410329527d9d2608d518f8b8e85901 (patch) | |
tree | 1ed9aeac4cc61ef7264fb254cc487d183573c818 /lib/keyringer/functions | |
parent | 682186c57f968e676c9f03f9003604d4706eb66e (diff) | |
parent | a5e39bf904e83989b763f001a29adb9053df60f2 (diff) | |
download | keyringer-b2d96296ca410329527d9d2608d518f8b8e85901.tar.gz keyringer-b2d96296ca410329527d9d2608d518f8b8e85901.tar.bz2 |
Merge tag 'upstream_keyringer_0.5.3' into debian
Upstream version 0.5.3
Diffstat (limited to 'lib/keyringer/functions')
-rwxr-xr-x | lib/keyringer/functions | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/keyringer/functions b/lib/keyringer/functions index 6f9a5e3..d529daf 100755 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -161,7 +161,7 @@ function keyringer_set_tmpfile { if [ -z "$1" ]; then template="$tmp/keyringer.XXXXXXXXXX" else - template="$tmp/XXXXXXXXXX.$1" + template="$tmp/keyringer.$1.XXXXXXXXXX" fi mkdir -p "$tmp" @@ -192,27 +192,36 @@ function keyringer_shred { return fi + # Create our test target + local rmtest="$(mktemp)" + # Get shred implementation if which wipe &> /dev/null; then tool="wipe" elif which shred &> /dev/null; then tool="shred" + elif rm -P "${rmtest}" &> /dev/null; then + tool="rm -P" else # Worst implementation message="WARNING $message" tool="rm" fi + # Cleanup in case "rm -P" is never called or -P flag is unsupported + rm -f "${rmtest}" + echo "$message $path using $tool..." if [ -d "$path" ]; then - if [ "$tool" == "wipe" ] || [ "$tool" == "rm" ]; then + if [ "$tool" == "wipe" ] || [ "$tool" == "rm" ] || [ "$tool" == "rm -P" ]; then $tool -rf $path else - find $path -exec $tool -uf {} \; + find $path -type f -exec $tool -uf {} \; + find $path -depth -type d -exec rmdir {} \; fi else - if [ "$tool" == "wipe" ] || [ "$tool" == "rm" ]; then + if [ "$tool" == "wipe" ] || [ "$tool" == "rm" ] || [ "$tool" == "rm -P" ]; then $tool -f "$path" else $tool -uf "$path" |