Skip to content

Commit 5f71475

Browse files
fetch config from online
1 parent 7061f12 commit 5f71475

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

udroid/src/udroid.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ fetch_distro_data() {
1919
URL="https://raw.githubusercontent.com/RandomCoderOrg/udroid-download/main/distro-data.json"
2020
_path="${RTCACHE}/distro-data.json.cache"
2121

22+
mv _path _path.old
23+
2224
gum_spin dot "Fetching distro data.." curl -L -s -o $_path $URL || {
2325
ELOG "[${0}] failed to fetch distro data"
26+
mv _path.old _path
2427
}
25-
28+
2629
if [[ -f $_path ]]; then
2730
LOG "set distro_data to $_path"
2831
distro_data=$_path
@@ -69,14 +72,18 @@ install() {
6972
LOG "[USER] function args => suite=$suite varient=$varient"
7073

7174
# if TEST_MODE is set run scripts in current directory and use test.json for distro_conf
72-
[[ -n $TEST_MODE ]] && {
75+
if [[ -n $TEST_MODE ]]; then
7376
LOG "[TEST] test mode enabled"
7477
distro_data=test.json
7578
DLCACHE="./tmp/dlcache"
7679
mkdir -p $DLCACHE
7780
LOG "[TEST] DLCACHE=$DLCACHE"
7881
LOG "[TEST] distro_data=$distro_data"
79-
}
82+
else
83+
mkdir $RTCACHE 2> /dev/null
84+
fetch_distro_data
85+
distro_data=${RTCACHE}/distro-data.json.cache
86+
fi
8087

8188
############### START OF OPTION PARSER ##############
8289

0 commit comments

Comments
 (0)