install.fairie/home/.chezmoiscripts/universal/run_onchange_after_98-cleanup.sh.tmpl

47 lines
1.5 KiB
Cheetah
Raw Normal View History

#!/usr/bin/env bash
Update 21 files - /home/.chezmoiscripts/universal/run_onchange_after_85-remove-shortcuts.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_98-cleanup.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_09-node-version.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_85-remove-shortcuts.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_98-cleanup.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_09-node-version.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.sh.tmpl
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.
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### 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 .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
logg info 'Checking if there is a pending update'
2023-12-05 10:07:50 -08:00
defaults read /Library/Updates/index.plist InstallAtLogout || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg info 'No pending update discovered by checking /Library/Updates/index.plist'
fi
2023-12-04 21:53:15 -08:00
elif [ -f /var/run/reboot-required ]; then
logg info '/var/run/reboot-required is present so a reboot is required'
fi