|
3 | 3 | TERMUX="/data/data/com.termux/files" |
4 | 4 | D_SCRIPTS="${TERMUX}/usr/etc/proot-distro" |
5 | 5 | D_INSTALLED_ROOTFS="${TERMUX}/usr/var/lib/proot-distro/installed-rootfs" |
| 6 | +D_CACHCE="${HOME}/.udroid-cache-root" |
6 | 7 |
|
7 | 8 | die() { echo -e "${RED}[E] ${*}${RST}";exit 1;:;} |
8 | 9 | warn() { echo -e "${RED}[W] ${*}${RST}";:;} |
@@ -56,11 +57,45 @@ l_login() { |
56 | 57 |
|
57 | 58 | _install() { |
58 | 59 | 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 |
60 | 69 |
|
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" |
63 | 79 |
|
| 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" |
64 | 99 | if is_installed $final_suite; then |
65 | 100 | msg "$SUITE already installed." |
66 | 101 | exit 1 |
@@ -130,7 +165,9 @@ l_cache() { |
130 | 165 | download() { |
131 | 166 | url=$1 |
132 | 167 | location=$2 |
133 | | - curl -L -o $location $url |
| 168 | + curl -L -o $location $url || { |
| 169 | + die "This action requires connection to the internet." |
| 170 | + } |
134 | 171 | } |
135 | 172 |
|
136 | 173 | if [ $# -ge 0 ]; then |
|
0 commit comments