File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 11/webui /node_modules
22/module /webroot
33/module /bin
4+ /out
45* .zip
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ if [[ $1 == " clean" ]]; then
4+ rm -rf out module/bin module/webroot
5+ exit 0
6+ fi
7+
8+ mkdir -p out module/bin module/webroot
9+
10+ # Build WebUI
11+ cd webui
12+ npm run build || npm install && npm run build
13+ cd ..
14+
15+ download_bin () {
16+ local suffix=" $1 "
17+ local target=" $2 "
18+ local url=$( echo " $RELEASE_JSON " | jq -r " .assets[] | select(.name | endswith(\" $suffix \" )) | .browser_download_url" )
19+
20+ echo " Downloading $target from $url "
21+ curl -L " $url " -o " module/bin/$target "
22+ }
23+
24+ # Fetch KPatch-Next binaries
25+ if [[ ! -f " module/bin/kpatch" || ! -f " module/bin/kpimg" || ! -f " module/bin/kptools" ]]; then
26+ URL=" https://api.github.com/repos/KernelSU-Next/KPatch-Next/releases"
27+ RELEASE_JSON=$( curl -s " $URL " | jq ' .[0]' )
28+
29+ download_bin " kpatch-android" " kpatch"
30+ download_bin " kpimg-linux" " kpimg"
31+ download_bin " kptools-android" " kptools"
32+ fi
33+
34+ # Fetch magiskboot
35+ if [[ ! -f " module/bin/magiskboot" ]]; then
36+ URL=" https://api.github.com/repos/topjohnwu/Magisk/releases"
37+ RELEASE_JSON=$( curl -s " $URL " | jq ' .[0]' )
38+ download_bin " Magisk*.apk" " magiskboot"
39+ fi
40+
41+ # zip module
42+ commit_number=$( git rev-list --count HEAD)
43+ commit_hash=$( git rev-parse --short HEAD)
44+
45+ cd module
46+ zip -r ../out/KPatch-Next-${commit_number} -${commit_hash} .zip .
47+ cd ..
You can’t perform that action at this time.
0 commit comments