Skip to content

Commit

Permalink
Fix var names
Browse files Browse the repository at this point in the history
  • Loading branch information
Antiz96 committed Dec 3, 2023
1 parent 619c90f commit dc92f22
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/script/arch-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,17 @@ orphan_packages() {

# Definition of the packages_cache function: Search for old package archives in the pacman cache and offer to remove them if there are
packages_cache() {
pacman_old_cache=$(paccache -dk3 | sed -n 's/.*: \([0-9]*\) candidate.*/\1/p')
pacman_uninstalled_cache=$(paccache -duk0 | sed -n 's/.*: \([0-9]*\) candidate.*/\1/p')
pacman_cache_old=$(paccache -dk3 | sed -n 's/.*: \([0-9]*\) candidate.*/\1/p')
pacman_cache_uninstalled=$(paccache -duk0 | sed -n 's/.*: \([0-9]*\) candidate.*/\1/p')

[ -z "${pacman_old_cache}" ] && pacman_old_cache="0"
[ -z "${pacman_uninstalled_cache}" ] && pacman_uninstalled_cache="0"
cache_total=$(("${cache_old}+${cache_uninstalled}"))
[ -z "${pacman_cache_old}" ] && pacman_cache_old="0"
[ -z "${pacman_cache_uninstalled}" ] && pacman_cache_uninstalled="0"
pacman_cache_total=$(("${pacman_cache_old}+${pacman_cache_uninstalled}"))

if [ "${cache_total}" -gt 0 ]; then
if [ "${pacman_cache_total}" -gt 0 ]; then
echo "--Old Cached Packages--"

if [ "${cache_total}" -eq 1 ]; then
if [ "${pacman_cache_total}" -eq 1 ]; then
echo -e "There's an old or uninstalled cached package\n"
read -rp $'Would you like to remove it from the cache now? [Y/n] ' answer
else
Expand All @@ -325,11 +325,11 @@ packages_cache() {
[Yy]|"")
echo -e "\n--Removing Old Cached Packages--"

if [ "${pacman_old_cache}" -gt 0 ] && [ "${pacman_uninstalled_cache}" -eq 0 ]; then
if [ "${pacman_cache_old}" -gt 0 ] && [ "${pacman_cache_uninstalled}" -eq 0 ]; then
"${su_cmd}" paccache -r && echo -e "\nThe removal has been applied\n" || echo -e >&2 "\nAn error has occurred\nThe removal has been aborted\n"
elif [ "${pacman_old_cache}" -eq 0 ] && [ "${pacman_uninstalled_cache}" -gt 0 ]; then
elif [ "${pacman_cache_old}" -eq 0 ] && [ "${pacman_cache_uninstalled}" -gt 0 ]; then
"${su_cmd}" paccache -ruk0 && echo -e "\nThe removal has been applied\n" || echo -e >&2 "\nAn error has occurred\nThe removal has been aborted\n"
elif [ "${pacman_old_cache}" -gt 0 ] && [ "${pacman_uninstalled_cache}" -gt 0 ]; then
elif [ "${pacman_cache_old}" -gt 0 ] && [ "${pacman_cache_uninstalled}" -gt 0 ]; then
"${su_cmd}" paccache -r && "${su_cmd}" paccache -ruk0 && echo -e "\nThe removal has been applied\n" || echo -e >&2 "\nAn error has occurred\nThe removal has been aborted\n"
fi
;;
Expand Down

0 comments on commit dc92f22

Please sign in to comment.