-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-termux.sh
More file actions
executable file
·39 lines (32 loc) · 924 Bytes
/
install-termux.sh
File metadata and controls
executable file
·39 lines (32 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -euo pipefail
cd -- "$(dirname -- "$0")"
[[ "${PREFIX:-}" != *"/com.termux/"* ]] && echo "not a termux environment" && exit 1
mkdir -p tmp/termux-apks
cd tmp/termux-apks
fdroid_apk_get_version() {
python3 <<EOF
import urllib.request, json
with urllib.request.urlopen("https://f-droid.org/api/v1/packages/$1") as fp:
print(json.load(fp)['suggestedVersionCode'])
EOF
}
fdroid_apk_download() {
curl -#ROL "https://f-droid.org/repo/$1"
}
do_apk() {
VERSION=$(fdroid_apk_get_version "$1")
APK_FILE="$1_$VERSION.apk"
echo "$APK_FILE"
if [ ! -f "$APK_FILE" ]; then
fdroid_apk_download "$APK_FILE"
fi
if command -v termux-share >/dev/null; then
termux-share -d "$APK_FILE"
read -r -p "install the apk now, [ENTER] to continue"
fi
}
# XXX: opinionated, i don't need other packages
do_apk com.termux.widget
do_apk com.termux.api
do_apk com.termux