mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 13:37:39 +00:00
Update build script
This commit is contained in:
parent
d5087858ca
commit
799ef3380d
47
build.sh
47
build.sh
@ -1,16 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "$0 --all <version number>"
|
echo "$0 all <version number>"
|
||||||
echo -e "\tBuild binaries, zip, and sign Magisk"
|
echo -e "\tBuild binaries, zip, and sign Magisk"
|
||||||
echo -e "\tThis is equlivant to first --build, then --zip"
|
echo -e "\tThis is equlivant to first --build, then --zip"
|
||||||
echo "$0 --clean"
|
echo "$0 clean"
|
||||||
echo -e "\tCleanup compiled / generated files"
|
echo -e "\tCleanup compiled / generated files"
|
||||||
echo "$0 --build"
|
echo "$0 build"
|
||||||
echo -e "\tBuild the binaries with ndk"
|
echo -e "\tBuild the binaries with ndk"
|
||||||
echo "$0 --zip <version number>"
|
echo "$0 zip <version number>"
|
||||||
echo -e "\tZip and sign Magisk"
|
echo -e "\tZip and sign Magisk"
|
||||||
echo "$0 --uninstaller"
|
echo "$0 uninstaller"
|
||||||
echo -e "\tZip and sign the uninstaller"
|
echo -e "\tZip and sign the uninstaller"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -56,14 +56,18 @@ build_bin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
zip_package() {
|
zip_package() {
|
||||||
|
if [ ! -f "zip_static/arm/bootimgtools" ]; then
|
||||||
|
echo "! Missing binaries!!"
|
||||||
|
echo "! Please run \"$0 build\" before zipping"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
echo "************************"
|
echo "************************"
|
||||||
echo "* Adding version info"
|
echo "* Adding version info"
|
||||||
echo "* \"Magisk v$1\""
|
|
||||||
echo "************************"
|
echo "************************"
|
||||||
sed "s/MAGISK_VERSION_STUB/Magisk v$1 Boot Image Patcher/g" scripts/flash_script.sh > zip_static/META-INF/com/google/android/update-binary
|
sed "s/MAGISK_VERSION_STUB/Magisk v$1 Boot Image Patcher/g" scripts/flash_script.sh > zip_static/META-INF/com/google/android/update-binary
|
||||||
sed "s/MAGISK_VERSION_STUB/setprop magisk.version $1/g" scripts/magic_mask.sh > zip_static/common/magic_mask.sh
|
sed "s/MAGISK_VERSION_STUB/setprop magisk.version $1/g" scripts/magic_mask.sh > zip_static/common/magic_mask.sh
|
||||||
echo "************************"
|
echo "************************"
|
||||||
echo "* Zipping the package"
|
echo "* Zipping Magisk v$1"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
cd zip_static
|
cd zip_static
|
||||||
find . -type f -exec chmod 644 {} \;
|
find . -type f -exec chmod 644 {} \;
|
||||||
@ -74,6 +78,25 @@ zip_package() {
|
|||||||
sign_zip "Magisk-v$1.zip"
|
sign_zip "Magisk-v$1.zip"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zip_uninstaller() {
|
||||||
|
if [ ! -f "uninstaller/arm/bootimgtools" ]; then
|
||||||
|
echo "! Missing binaries!!"
|
||||||
|
echo "! Please run \"$0 build\" before zipping"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "************************"
|
||||||
|
echo "* Zipping uninstaller"
|
||||||
|
echo "************************"
|
||||||
|
cd uninstaller
|
||||||
|
find . -type f -exec chmod 644 {} \;
|
||||||
|
find . -type d -exec chmod 755 {} \;
|
||||||
|
TIMESTAMP=$(date "+%Y%m%d")
|
||||||
|
rm -rf "../Magisk-uninstaller-$TIMESTAMP.zip"
|
||||||
|
zip "../Magisk-uninstaller-$TIMESTAMP.zip" -r .
|
||||||
|
cd ../
|
||||||
|
sign_zip "Magisk-uninstaller-$TIMESTAMP.zip"
|
||||||
|
}
|
||||||
|
|
||||||
sign_zip() {
|
sign_zip() {
|
||||||
if [ ! -f "zipsigntools/zipadjust" ]; then
|
if [ ! -f "zipsigntools/zipadjust" ]; then
|
||||||
echo "************************"
|
echo "************************"
|
||||||
@ -103,22 +126,22 @@ DIR="$(cd "$(dirname "$0")"; pwd)"
|
|||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
"--all" )
|
"all" )
|
||||||
[ -z "$2" ] && echo -e "! Missing version number\n" && usage
|
[ -z "$2" ] && echo -e "! Missing version number\n" && usage
|
||||||
build_bin
|
build_bin
|
||||||
zip_package $2
|
zip_package $2
|
||||||
;;
|
;;
|
||||||
"--clean" )
|
"clean" )
|
||||||
cleanup
|
cleanup
|
||||||
;;
|
;;
|
||||||
"--build" )
|
"build" )
|
||||||
build_bin
|
build_bin
|
||||||
;;
|
;;
|
||||||
"--zip" )
|
"zip" )
|
||||||
[ -z "$2" ] && echo -e "! Missing version number\n" && usage
|
[ -z "$2" ] && echo -e "! Missing version number\n" && usage
|
||||||
zip_package $2
|
zip_package $2
|
||||||
;;
|
;;
|
||||||
"--uninstaller" )
|
"uninstaller" )
|
||||||
zip_uninstaller
|
zip_uninstaller
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user