1 changed file
clean_caches.sh | ||
Add comment 92 #
Add comment 93 # rm -fr is done in the next block
Add comment 94 #if type apk >/dev/null 2>&1 2>&1; then
Add comment 95 Minus # rm -rf /var/cache/apk
Add comment 95 Plus # rm -rf -- /var/cache/apk
Add comment 96 if type apt-get >/dev/null 2>&1; then
Add comment 97 # could accidentally remove things it shouldn't
Add comment 98 #apt-get autoremove -y
Add comment 117 [ -n "$directory" ] || continue
Add comment 118 [ -e "$directory" ] || continue
Add comment 119 echo "* removing $directory"
Add comment 120 Minus rm -rf "$directory" || :
Add comment 120 Plus rm -rf -- "$directory" || :
Add comment 121 [ -e "$directory" ] || continue
Add comment 122 # shellcheck disable=SC2039
Add comment 123 if [ "${EUID:-${UID:-$(id -u)}}" != 0 ]; then
Add comment 124 if type sudo >/dev/null 2>&1; then
Add comment 125 Minus sudo -n rm -rf "$directory"
Add comment 125 Plus sudo -n rm -rf -- "$directory"
Add comment 126 fi
Add comment 127 fi
Add comment 128 done
Add comment 143 [ -e "$user_home_cache" ] || continue
Add comment 144 echo "* removing $user_home_cache"
Add comment 145 # ~ more reliable than $HOME which could be unset
Add comment 146 Minus rm -rf "$user_home_cache" || :
Add comment 146 Plus rm -rf -- "$user_home_cache" || :
Add comment 147 # shellcheck disable=SC2039
Add comment 148 if [ "${EUID:-${UID:-$(id -u)}}" != 0 ]; then
Add comment 149 if type sudo >/dev/null 2>&1; then
Add comment 150 # in case user home directory is owned by root, do a late stage removal as root
Add comment 151 Minus sudo -n rm -rf "$user_home_cache"
Add comment 151 Plus sudo -n rm -rf -- "$user_home_cache"
Add comment 152 [ -e "/root/$directory" ] || continue
Add comment 153 echo "* removing /root/$directory"
Add comment 154 Minus sudo -n rm -rf "/root/$directory"
Add comment 154 Plus sudo -n rm -rf -- "/root/$directory"
Add comment 155 fi
Add comment 156 fi
Add comment 157 done