Skip to content

Commit 9cdc3d1

Browse files
feat: clear_cache feature
1 parent bb93448 commit 9cdc3d1

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

udroid/src/help_udroid.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ help_root() {
4141
echo " login, --login <suite>:<varient> login to a distro"
4242
echo " upgrade, --upgrade upgrade udroid scripts"
4343
echo " help, --help show this help message and exit"
44-
echo " --update-cache update cache from remote"
44+
echo " --update-cache update cache from remote"
45+
echo " --clear-cache clear downloaded cache"
4546
echo
4647
}
4748

udroid/src/udroid.sh

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,6 @@ verify_integrity() {
125125
}
126126

127127
install() {
128-
###
129-
# install()
130-
#
131-
# stages:
132-
# 1) take the arguments supplied ( i.e "arg"->$1 and "path"->$2 )
133-
# 2) parse the arg for suite and varient
134-
# 2-1) if suite or varient is null (i.e not supplied) the try to prompt by guessing it with avalible arguments
135-
# 3) parse the download link from json ( if null exit )
136-
# 4) Extract the filesystem to target path
137-
# 5) execute fixes file
138-
139128
# local arg=$1
140129
TITLE "> INSTALL $arg"
141130
local no_check_integrity=false
@@ -990,6 +979,13 @@ _reset() {
990979
# TODO
991980
TITLE "[TODO] RESET"
992981
}
982+
983+
clear_cache() {
984+
TITLE "> CLEAR CACHE"
985+
cache_size=$(du -sh -d 0 $DLCACHE | awk '{print $1}')
986+
g_spin "line" "Clearing cache" -- rm -rf $DLCACHE/*
987+
echo -e "Cache cleared ($cache_size).."
988+
}
993989
####################
994990
download() {
995991
local name=$1
@@ -1047,6 +1043,7 @@ while [ $# -gt 0 ]; do
10471043
install | --install|-i) shift 1; install $@ ; break ;;
10481044
upgrade | --upgrade|-u) shift 1; _upgrade $@ ; break ;;
10491045
--update-cache) shift 1; update_cache $@ ; break ;;
1046+
--clear-cache) shift 1; clear_cache $@ ; break ;;
10501047
login | --login|-l) shift 1; login $@; break ;;
10511048
remove | --remove | --uninstall ) shift 1 ; remove $@; break;;
10521049
reset | --reset | --reinstall ) shift 1 ; _reset $@; break;;

0 commit comments

Comments
 (0)