Skip to content

Commit 30a714d

Browse files
add option manually upgrade distro conf
1 parent 324b170 commit 30a714d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

udroid/src/udroid.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,18 @@ fetch_distro_data() {
3434
# default to online mode
3535
offline_mode=false
3636
mode=$1
37+
isStrictMode=$2
3738

3839
# if mode is offline, set offline_mode to true
3940
if (( mode == "offline" )); then
4041
offline_mode=true
4142
fi
4243

44+
# set isStrictMode to false if not set
45+
if [[ -z $isStrictMode ]]; then
46+
isStrictMode=false
47+
fi
48+
4349
# setup URL and path variables
4450
URL="https://raw.githubusercontent.com/RandomCoderOrg/udroid-download/main/distro-data.json"
4551
_path="${RTCACHE}/distro-data.json.cache"
@@ -51,6 +57,9 @@ fetch_distro_data() {
5157
g_spin dot "Fetching distro data.." curl -L -s -o $_path $URL || {
5258
ELOG "[${0}] failed to fetch distro data"
5359
mv $_path.old $_path
60+
if $isStrictMode; then
61+
DIE "Failed to fetch distro data from: \n $URL"
62+
fi
5463
}
5564
fi
5665
distro_data=$_path
@@ -705,6 +714,12 @@ remove() {
705714
fi
706715

707716
}
717+
718+
update() {
719+
TITLE "> UPDATE distro data from remove"
720+
fetch_distro_data "online" true
721+
}
722+
708723
_reset() {
709724
# TODO
710725
TITLE "[TODO]"
@@ -763,6 +778,7 @@ fi
763778
while [ $# -gt 0 ]; do
764779
case $1 in
765780
install | --install|-i) shift 1; install $@ ; break ;;
781+
update | --update|-u) shift 1; update $@ ; break ;;
766782
login | --login|-l) shift 1; login $@; break ;;
767783
remove | --remove | --uninstall ) shift 1 ; remove $@; break;;
768784
reset | --reset | --reinstall ) shift 1 ; _reset $@; break;;

0 commit comments

Comments
 (0)