@@ -29,7 +29,6 @@ TITLE() { echo -e "\e[100m${*}\e[0m";:;}
2929# Fetch distro data from the internet and save it to RTCACHE
3030# @param mode [online/offline] - online mode will fetch data from the internet, offline will use the cached data
3131# @return distro_data [string] - path to the downloaded data
32-
3332fetch_distro_data () {
3433
3534 # default to online mode
@@ -89,7 +88,7 @@ fetch_distro_data() {
8988ask () {
9089 local msg=$*
9190
92- echo -ne " $msg \t[Y/N ]: "
91+ echo -ne " $msg \t[y/n ]: "
9392 read -r choice
9493
9594 case $choice in
@@ -255,7 +254,7 @@ install() {
255254
256255login () {
257256 # [ yoinked & modified ]
258- # Most of the code is taken from proot-utils.sh
257+ # Most of the code is taken from proot-disro
259258 # PERMALINK : https://github.com/termux/proot-distro/blob/fcee91ca6c7632c09898c9d0a680c8ff72c3357f/proot-distro.sh#L933
260259 #
261260 # @termux/proot-distro (C) GNU V3 License
@@ -980,22 +979,27 @@ _reset() {
980979 TITLE " [TODO] RESET"
981980}
982981
982+ # clear_cache() => clears filesystem cache
983+ # check for file in cache
984+ # if found calclulate size
985+ # ask for confirmation
986+ # if confirmed, remove files
983987clear_cache () {
984988 TITLE " > CLEAR CACHE"
985989 cache_size=$( du -sh -d 0 $DLCACHE | awk ' {print $1}' )
986990
987- # check if cache is empty
988- if [[ $cache_size == " 0 " ]]; then
989- GWARN " cache is already empty"
991+ # check for files
992+ if [[ -z $( ls -A $DLCACHE ) ]]; then
993+ GWARN " ? cache is empty"
990994 exit 0
991995 fi
992996
993997 # ask for confirmation
994- if ask " Are you sure you want to clear cache?" ; then
995- rm -rf $DLCACHE /*
998+ if ask " Do you want to clear cache?" ; then
999+ rm -rvf $DLCACHE /* >> $LOGFILE
9961000 echo " $cache_size cache cleared"
9971001 else
998- GWARN " cache not cleared"
1002+ GWARN " ? cache not cleared"
9991003 fi
10001004}
10011005# ###################
0 commit comments