Skip to content

Commit 8bfaa6b

Browse files
some upgrades to udroid installer
1 parent 86d5338 commit 8bfaa6b

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

scripts/udroid/udroid.sh

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
TERMUX="/data/data/com.termux/files"
44
D_SCRIPTS="${TERMUX}/usr/etc/proot-distro"
55
D_INSTALLED_ROOTFS="${TERMUX}/usr/var/lib/proot-distro/installed-rootfs"
6+
D_CACHCE="${HOME}/.udroid-cache-root"
67

78
die() { echo -e "${RED}[E] ${*}${RST}";exit 1;:;}
89
warn() { echo -e "${RED}[W] ${*}${RST}";:;}
@@ -56,11 +57,45 @@ l_login() {
5657

5758
_install() {
5859
SUITE=$1
59-
plugin_location="https://raw.githubusercontent.com/RandomCoderOrg/ubuntu-on-android/beta/pd-plugins"
60+
61+
# relative path of plugins with respect to pd-plugins dir
62+
# set this when you need to install another suite
63+
if [ -n "$OVERRIDE_REMOTE_PLUGIN_DIR" ]; then
64+
warn "overriding remote plugin dir with $OVERRIDE_REMOTE_PLUGIN_DIR"
65+
REMOTE_PLUGIN_DIR=$OVERRIDE_REMOTE_PLUGIN_DIR
66+
else
67+
REMOTE_PLUGIN_DIR="default"
68+
fi
6069

61-
final_suite="udroid-impish-$SUITE"
62-
local_target="${D_SCRIPTS}/${final_suite}.sh"
70+
# set this to pull plugins from another branch
71+
if [ -n "$OVERRIDE_BRANCH" ]; then
72+
warn "[DEPARTED]: overriding branch to $OVERRIDE_BRANCH"
73+
BRANCH=$OVERRIDE_BRANCH
74+
else
75+
BRANCH="modified"
76+
fi
77+
78+
plugin_location="https://raw.githubusercontent.com/RandomCoderOrg/ubuntu-on-android/$BRANCH/pd-plugins/$REMOTE_PLUGIN_DIR"
6379

80+
# pull and parse plugin properties
81+
download $plugin_location/plugins.prop "$D_CACHCE"/plugins.prop
82+
83+
source $D_CACHCE/plugin.prop || die "failed to parse plugin data..?"
84+
85+
for v in "${avalibe_varients[@]}"; do
86+
if [ "$v" == "$SUITE" ]; then
87+
varient=$SUITE
88+
fi
89+
done
90+
91+
if [ -z "$varient" ]; then
92+
warn "unknown varient: $SUITE"
93+
msg "varients founds: ${avalibe_varients[*]}"
94+
die "installation failed."
95+
fi
96+
97+
final_suite="udroid-$suite-$varient"
98+
local_target="${D_SCRIPTS}/${final_suite}.sh"
6499
if is_installed $final_suite; then
65100
msg "$SUITE already installed."
66101
exit 1
@@ -130,7 +165,9 @@ l_cache() {
130165
download() {
131166
url=$1
132167
location=$2
133-
curl -L -o $location $url
168+
curl -L -o $location $url || {
169+
die "This action requires connection to the internet."
170+
}
134171
}
135172

136173
if [ $# -ge 0 ]; then

0 commit comments

Comments
 (0)