Skip to content

Commit 4c44b19

Browse files
satisfy new option --suite
1 parent d8cb4cd commit 4c44b19

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

scripts/udroid/udroid.sh

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ _login() {
4545
if [ -z "$UDROID_SUITE" ] || [ -z "$_SUITE" ] ; then
4646
suite="udroid-focal"
4747
else
48-
suite="$UDROID_SUITE"
49-
msg "udroid suite is set to ${UDROID_SUITE}"
48+
[[ -n "$UDROID_SUITE" ]] && _suite="$UDROID_SUITE"
49+
[[ -n "$_SUITE" ]] && _suite="$_SUITE"
50+
msg "udroid suite is set to ${_SUITE}"
5051
fi
5152

5253
distro="$suite-$varient"
@@ -58,7 +59,7 @@ _login() {
5859
start "$distro" $extra_args
5960
else
6061
# TODO: ADD SUGGESTIONS
61-
lwarn "$distro not found..."
62+
warn "$distro not found..."
6263
fi
6364
}
6465

@@ -114,7 +115,11 @@ _install() {
114115

115116
# relative path of plugins with respect to pd-plugins dir
116117
# set this when you need to install another suite
117-
if [ -n "$OVERRIDE_REMOTE_PLUGIN_DIR" ]; then
118+
if [ -n "$OVERRIDE_REMOTE_PLUGIN_DIR" ] || [ -n "$_SUITE" ]; then
119+
120+
[[ -n "$OVERRIDE_REMOTE_PLUGIN_DIR" ]] && REMOTE_PLUGIN_DIR="$OVERRIDE_REMOTE_PLUGIN_DIR"
121+
[[ -n "$_SUITE" ]] && REMOTE_PLUGIN_DIR="$_SUITE"
122+
118123
warn "overriding remote plugin dir with $OVERRIDE_REMOTE_PLUGIN_DIR"
119124
REMOTE_PLUGIN_DIR=$OVERRIDE_REMOTE_PLUGIN_DIR
120125
else
@@ -170,15 +175,16 @@ _reset() {
170175
if [ -z "$UDROID_SUITE" ] || [ -z "$_SUITE" ] ; then
171176
_suite="udroid-focal"
172177
else
173-
_suite="$UDROID_SUITE"
174-
msg "udroid suite is set to ${UDROID_SUITE}"
178+
[[ -n "$UDROID_SUITE" ]] && _suite="$UDROID_SUITE"
179+
[[ -n "$_SUITE" ]] && _suite="$_SUITE"
180+
msg "udroid suite is set to ${_SUITE}"
175181
fi
176182
suite="${_suite}-$varient"
177183
if is_installed "$suite" && [[ $avalible_distros =~ $distro ]]; then
178184
imsg "Executing $(which proot-distro) reset $suite"
179185
proot-distro reset $suite
180186
else
181-
lwarn "$SUITE is not installed."
187+
warn "$SUITE is not installed."
182188
fi
183189
}
184190

@@ -189,15 +195,16 @@ remove() {
189195
if [ -z "$UDROID_SUITE" ] || [ -z "$_SUITE" ] ; then
190196
_suite="udroid-focal"
191197
else
192-
_suite="$UDROID_SUITE"
193-
msg "udroid suite is set to ${UDROID_SUITE}"
198+
[[ -n "$UDROID_SUITE" ]] && _suite="$UDROID_SUITE"
199+
[[ -n "$_SUITE" ]] && _suite="$_SUITE"
200+
msg "udroid suite is set to ${_SUITE}"
194201
fi
195202
suite="${_suite}-$varient"
196203

197204
if is_installed "$suite"; then
198205
proot-distro remove $suite
199206
else
200-
lwarn "$SUITE is not installed."
207+
warn "$SUITE is not installed."
201208
fi
202209
}
203210

@@ -221,7 +228,7 @@ upgrade() {
221228
fi
222229

223230
download "$url" "$TERMUX/usr/bin/udroid" || {
224-
lwarn "failed to sync tool with GitHub"
231+
warn "failed to sync tool with GitHub"
225232
exit 1
226233
}
227234
chmod +x "$TERMUX/usr/bin/udroid"

0 commit comments

Comments
 (0)