-
Notifications
You must be signed in to change notification settings - Fork 0
/
__antihomedir
64 lines (54 loc) · 1.16 KB
/
__antihomedir
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#! /hint/sh
case $HOME in "$PWD") ;; *) return; esac
case $sh_is in # do not use $sh_is_, zsh does not have shopt
bash) eval \#\'' # BASH ONLY BEGIN
(
shopt -s dotglob # must be already set from ./%__history-append.bash
shopt -s nullglob
# whitelist:
set -- ./!(.|..|.cache|.config|.local)
case $# in
0) return 1;;
*) printf %s\\n >&2 "homedir file not in white list:" "$@"; return 0;;
esac
) || return 0
';; #BASH ONLY END'
*) return;;
esac
# black list = auto remove:
unset-unseted-i
for i in \
.pki \
.presage \
.parallel \
.avidemux6 \
.python_history \
.gnome \
; do
[ -e "$i" ] || continue
(
cd -- "${HOME:?}" || exit
rm -rfv -- "$i"
)
done
unset-seted-i
# black list + report = log files + auto remove:
[ ! -d ~/.mozilla ] || {
unalias _find_ || :; . "${B?}"/_loadable/_find_.sh
#command. _find_ || . "${B?}"/_loadable/_find_.sh
{
echo
date -Im
i=$(_find_ .mozilla | tee-fd 3 | wc -l)
} >>~/.cache/0/.mozilla_find 3>&1
case $i in
[0-9][0-9][0-9]*)
puts >&2 "Not expected to get that many files '$i' in output from \`find .mozilla\`"
;;
*)
(
cd -- "${HOME:?}" || exit
rm -rfv -- ~/.mozilla/
)
esac
} >&2