diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-05-30 14:45:39 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-05-30 14:45:39 -0300 |
commit | a5e39bf904e83989b763f001a29adb9053df60f2 (patch) | |
tree | 7f81c07390b46b38a59b158f970d57f1cf3a70d2 /lib/keyringer/functions | |
parent | 6c62a1906b59e4ab8eb3475ebfe3c3b7cfa67f0b (diff) | |
parent | 126eb39671e9c65c0c60a78b25189e4d4b1fae72 (diff) | |
download | keyringer-a5e39bf904e83989b763f001a29adb9053df60f2.tar.gz keyringer-a5e39bf904e83989b763f001a29adb9053df60f2.tar.bz2 |
New upstream version 0.5.3upstream_keyringer_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" |