2023-01-23 23:54:12 -08:00
|
|
|
#!/usr/bin/env bash
|
2023-04-11 20:57:02 -07:00
|
|
|
# @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.
|
2023-01-23 23:54:12 -08:00
|
|
|
|
2023-11-04 20:56:58 -07:00
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
|
|
{{ includeTemplate "universal/logg" }}
|
|
|
|
|
2024-01-28 21:13:53 -08:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-01-23 23:54:12 -08:00
|
|
|
### 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
|
2023-01-23 23:59:25 -08:00
|
|
|
|
2023-12-24 18:35:06 -08:00
|
|
|
### Remove .viminfo
|
|
|
|
# No idea how this is being created
|
|
|
|
if [ -f "$HOME/.viminfo" ]; then
|
|
|
|
sudo rm -f "$HOME/.viminfo"
|
|
|
|
fi
|
|
|
|
|
2023-01-23 23:59:25 -08:00
|
|
|
### 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
|
2023-11-29 20:23:58 -08:00
|
|
|
|
|
|
|
if [ -d /Applications ] && [ -d /System ]; then
|
|
|
|
### Empty trash
|
|
|
|
if command -v m > /dev/null; then
|
|
|
|
logg info 'Emptying trash' && m trash clean
|
|
|
|
fi
|
2023-12-04 21:53:15 -08:00
|
|
|
fi
|
2024-01-28 21:13:53 -08:00
|
|
|
|
|
|
|
cleanAptGet &
|
|
|
|
cleanupBrew &
|
|
|
|
wait
|
|
|
|
|
|
|
|
logg success 'Finished cleanup process'
|