. "$BST_LIB" require wipe wipe/present # wipe 0.24 (secure file erasure): overwrite passes, wipe the name, then # unlink. -f no confirmation, -s silent, -q quick mode, -Q quick-pass # count (1 keeps tmpfs churn minimal), -k keep the inode, -r recurse. check_out wipe/version "This is wipe version" wipe -v tmp=${TMPDIR:-/tmp}/bst-wipe.$$ mkdir -p "$tmp" # single regular file: wiped and unlinked printf 'sensitive-data-0123456789abcdef\n' > "$tmp/f1" check wipe/file-rc wipe -f -s -q -Q 1 "$tmp/f1" if [ ! -e "$tmp/f1" ]; then bst_ok wipe/file-gone else bst_notok wipe/file-gone "file still present after wipe"; fi # -k overwrites in place but keeps the inode; plaintext must not survive printf 'KEEPME-marker-KEEPME\n' > "$tmp/f2" check wipe/keep-rc wipe -f -s -q -Q 1 -k "$tmp/f2" if [ -f "$tmp/f2" ]; then bst_ok wipe/keep-present else bst_notok wipe/keep-present "-k removed the file"; fi if grep -q KEEPME "$tmp/f2" 2>/dev/null; then bst_notok wipe/keep-scrambled "plaintext survived the overwrite" else bst_ok wipe/keep-scrambled; fi rm -f "$tmp/f2" # a directory without -r is refused mkdir -p "$tmp/d0" check_rc wipe/dir-needs-r 1 wipe -f -q -Q 1 "$tmp/d0" rmdir "$tmp/d0" 2>/dev/null # recursive: wipes the files and rmdirs the tree mkdir -p "$tmp/d/sub" printf 'aaa\n' > "$tmp/d/a" printf 'bbb\n' > "$tmp/d/sub/b" check wipe/recurse-rc wipe -r -f -s -q -Q 1 "$tmp/d" if [ ! -e "$tmp/d" ]; then bst_ok wipe/recurse-gone else bst_notok wipe/recurse-gone "directory still present after wipe -r"; fi rm -rf "$tmp"