diff options
| author | Shohei YOSHIDA <syohex@gmail.com> | 2023-10-03 20:05:59 +0900 |
|---|---|---|
| committer | Shohei YOSHIDA <syohex@gmail.com> | 2023-10-03 20:05:59 +0900 |
| commit | 41e7188db57a62f15ec05dd6c3663e2b3b9e9f2b (patch) | |
| tree | 25f0d736706fe1f99c0d9c28cbc2d36dbc3d9b67 /src/_srm | |
| parent | Merge pull request #1046 from zsh-users/do-not-use-global-variable (diff) | |
| download | zsh-completions-41e7188db57a62f15ec05dd6c3663e2b3b9e9f2b.tar zsh-completions-41e7188db57a62f15ec05dd6c3663e2b3b9e9f2b.tar.gz zsh-completions-41e7188db57a62f15ec05dd6c3663e2b3b9e9f2b.tar.bz2 zsh-completions-41e7188db57a62f15ec05dd6c3663e2b3b9e9f2b.tar.lz zsh-completions-41e7188db57a62f15ec05dd6c3663e2b3b9e9f2b.tar.xz zsh-completions-41e7188db57a62f15ec05dd6c3663e2b3b9e9f2b.tar.zst zsh-completions-41e7188db57a62f15ec05dd6c3663e2b3b9e9f2b.zip | |
Support THC secure-delete
Recent Linux distribution uses newer THC secure-delete and
it only supports few options.
Diffstat (limited to 'src/_srm')
| -rw-r--r-- | src/_srm | 60 |
1 files changed, 42 insertions, 18 deletions
@@ -36,38 +36,54 @@ # # ------------------------------------------------------------------------------ -local -a opts args +local -a args + args=( - '(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]' - '(-r --interactive)'{-i,--interactive}'[prompt before any removal]' - '(-r -R --recursive)'{-r,-R,--recursive}'[remove the contents of directories recursively]' - '(-s --simple)'{-s,--simple}'[only overwrite with a single pass of random data]' - '(-v --verbose)'{-v,--verbose}'[explain what is being done]' - '(- *)--help[display help message and exit]' - '(- *)--version[output version information and exit]' '*::files:->file' ) -if _pick_variant gnu=gnu unix --help; then +_pick_variant -r variant gnu=gnu thc=THC unix --help + +if [[ $variant == "thc" ]]; then args+=( - '(-x --one-file-system)'{-x,--one-file-system}'[stay within filesystems of files given as arguments]' - '(-P --openbsd)'{-P,--openbsd}'[overwrite the file 3 times (0xff, 0x00, 0xff)]' - '(-D --dod)'{-D,--dod}'[overwrite the file with 7 US DoD compliant passes (0xF6, 0x00, 0xFF, random, 0x00, 0xFF, random)]' - '(-E --doe)'{-E,--doe}'[overwrite the file with 3 US DoE compliant passes (random, random, DoE)]' + '-d[ignore the two special dot files . and .. on the commandline]' + '-f[fast (and insecure mode)]' + '*-l[lessens the security. -l for a second time lessons the security even more]' + '-r[recursive mode]' + '-v[verbose mode]' + '-z[wipes the last write with zeros instead of random data]' ) else args+=( - '(-m --medium)'{-m,--medium}'[overwrite the file with 7 US DoD compliant passes (0xF6, 0x00, 0xFF, random, 0x00, 0xFF, random)]' - '(-z --zero)'{-z,--zero}'[after overwriting, zero blocks used by file]' - '(-n --nounlink)'{-n,--nounlink}'[overwrite file, but do not rename or unlink it]' + '(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]' + '(-r --interactive)'{-i,--interactive}'[prompt before any removal]' + '(-r -R --recursive)'{-r,-R,--recursive}'[remove the contents of directories recursively]' + '(-s --simple)'{-s,--simple}'[only overwrite with a single pass of random data]' + '(-v --verbose)'{-v,--verbose}'[explain what is being done]' + '(- *)--help[display help message and exit]' + '(- *)--version[output version information and exit]' ) + + if [[ $variant == "gnu" ]]; then + args+=( + '(-x --one-file-system)'{-x,--one-file-system}'[stay within filesystems of files given as arguments]' + '(-P --openbsd)'{-P,--openbsd}'[overwrite the file 3 times (0xff, 0x00, 0xff)]' + '(-D --dod)'{-D,--dod}'[overwrite the file with 7 US DoD compliant passes (0xF6, 0x00, 0xFF, random, 0x00, 0xFF, random)]' + '(-E --doe)'{-E,--doe}'[overwrite the file with 3 US DoE compliant passes (random, random, DoE)]' + ) + else + args+=( + '(-m --medium)'{-m,--medium}'[overwrite the file with 7 US DoD compliant passes (0xF6, 0x00, 0xFF, random, 0x00, 0xFF, random)]' + '(-z --zero)'{-z,--zero}'[after overwriting, zero blocks used by file]' + '(-n --nounlink)'{-n,--nounlink}'[overwrite file, but do not rename or unlink it]' + ) + fi fi local curcontext=$curcontext state line ret=1 local -A opt_args -_arguments -s -S -C $opts \ - $args && ret=0 +_arguments -s -S -C $args && ret=0 case $state in (file) @@ -82,3 +98,11 @@ case $state in esac return $ret + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et |
