/
run_after_24-cleanup.sh.tmpl
64 lines (53 loc) · 1.69 KB
/
run_after_24-cleanup.sh.tmpl
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
#!/usr/bin/env bash
# @file Miscellaneous Clean Up
# @brief Removes certain files that should not be necessary
# @description
# This script removes various files in the `HOME` directory that are either no longer necessary
# or cluttery.
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
cleanAptGet() {
if command -v apt-get > /dev/null; then
logg info 'Running sudo apt-get autoclean' && sudo apt-get autoclean
logg info 'Running sudo apt-get -y autoremove' && sudo apt-get -y autoremove
fi
}
cleanupBrew() {
if command -v brew > /dev/null; then
logg info 'Running brew cleanup' && brew cleanup
fi
}
### Remove meta sudo file
if [ -f "$HOME/.sudo_as_admin_successful" ]; then
rm -f "$HOME/.sudo_as_admin_successful"
fi
### Remove .bash_history file
# New dotfiles specify this to be kept in the ~/.local folder
if [ -f "$HOME/.bash_history" ]; then
rm -f "$HOME/.bash_history"
fi
### Remove wget history file
# New dotfiles include alias that automatically adds the wget-hsts file in the ~/.local folder
if [ -f "$HOME/.wget-hsts" ]; then
rm -f "$HOME/.wget-hsts"
fi
### Remove .viminfo
# No idea how this is being created
if [ -f "$HOME/.viminfo" ]; then
sudo rm -f "$HOME/.viminfo"
fi
### Remove .wrangler
# Not sure how this is populating but the proper environment variables appear to be in place and nothing breaks when its removed
if [ -d "$HOME/.wrangler" ]; then
rm -rf "$HOME/.wrangler"
fi
if [ -d /Applications ] && [ -d /System ]; then
### Empty trash
if command -v m > /dev/null; then
logg info 'Emptying trash' && m trash clean
fi
fi
cleanAptGet &
cleanupBrew &
wait
logg success 'Finished cleanup process'