forked from j-hc/revanced-magisk-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-termux.sh
executable file
·70 lines (61 loc) · 1.88 KB
/
build-termux.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
set -e
pr() { echo -e "\033[0;32m[+] ${1}\033[0m"; }
ask() {
local y
for ((n = 0; n < 3; n++)); do
pr "$1"
if read -r y; then
if [ "$y" = y ]; then
return 0
elif [ "$y" = n ]; then
return 1
fi
fi
pr "Asking again..."
done
return 1
}
pr "Setting up environment..."
yes "" | pkg update -y && pkg install -y git wget openssl jq openjdk-17 zip
pr "Cloning revanced-magisk-module repository..."
if [ -d revanced-magisk-module ]; then
if ask "Directory revanced-magisk-module already exists. Do you want to clone the repo again and overwrite your config? [y/n]"; then
rm -rf revanced-magisk-module
git clone https://github.com/j-hc/revanced-magisk-module --recurse --depth 1
sed -i '/^enabled.*/d; /^\[.*\]/a enabled = false' revanced-magisk-module/config.toml
fi
else
git clone https://github.com/j-hc/revanced-magisk-module --recurse --depth 1
sed -i '/^enabled.*/d; /^\[.*\]/a enabled = false' revanced-magisk-module/config.toml
fi
if [ ! -f build.sh ]; then
cd revanced-magisk-module
fi
if ask "Do you want to open the config.toml for customizations? [y/n]"; then
nano config.toml
else
pr "No app is selected for patching!"
fi
if ! ask "Setup is done. Do you want to start building? [y/n]"; then
exit 0
fi
./build.sh
cd build
pr "Ask for storage permission"
until
yes | termux-setup-storage >/dev/null 2>&1
ls /sdcard >/dev/null 2>&1
do
sleep 1
done
PWD=$(pwd)
mkdir ~/storage/downloads/revanced-magisk-module 2>/dev/null || :
for op in *; do
[ "$op" = "*" ] && continue
cp -f "${PWD}/${op}" ~/storage/downloads/revanced-magisk-module/"${op}"
done
pr "Outputs are available in /sdcard/Download/revanced-magisk-module folder"
am start -a android.intent.action.VIEW -d file:///sdcard/Download/revanced-magisk-module -t resource/folder
sleep 2
am start -a android.intent.action.VIEW -d file:///sdcard/Download/revanced-magisk-module -t resource/folder