-
-
Save brunomiguel/a617c2e592068eee8cbce0490a24dedc to your computer and use it in GitHub Desktop.
Shell function for system upgrade and cleanup on Arch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sysupdate { | |
local native() { | |
tput bold; | |
echo "\n\e[0;93mUpdating native packages..." | |
tput sgr0; | |
paru -Syyuv; | |
} | |
local fltpk() { | |
tput bold; | |
echo "\n\e[0;93mUpdating flatpaks..." | |
tput sgr0; | |
flatpak update; | |
} | |
local cleanup() { | |
array=($HOME/.cargo $HOME/.cache/go-build $HOME/.npm $HOME/.cache/paru $HOME/.cache/winetricks $HOME/.cache/wine $HOME/.cache/spotify $HOME/.cache/pnmp $HOME/.cache/pip $HOME/go) | |
for ((i = 1; i <= $#array; i++)) { | |
if [ -d $array[i] ]; then | |
tput bold; | |
echo -e "\n\e[0;93mDeleting $array[i]..."; | |
tput sgr0; | |
sudo rm -rfv -- $array[i]; | |
fi | |
} | |
tput bold; | |
echo -e "\n\e[0;93mDeleting native package cache..."; | |
tput sgr0; | |
paru -Sccc | |
tput bold; | |
echo -e "\n\e[0;93mDeleting flatpak unused files and dependencies..."; | |
flatpak uninstall --unused | |
} | |
case "$1" in | |
-p) | |
native;; | |
-f) | |
fltpk;; | |
-c) | |
cleanup;; | |
-a) | |
native; fltpk; cleanup;; | |
-h | *) | |
echo -e "-p\t Update native packages\n-f\t Update Flatpaks\n-c\t Cleanup after system update. Also includes stuff from ~/.cache\n-a\t Do all the above\n-h\t Show help";; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment