Update build.sh to detect failures

This commit is contained in:
topjohnwu 2016-11-06 01:33:55 +08:00
parent bcdd74514f
commit da94c2e1e5

View File

@ -42,6 +42,12 @@ build_bin() {
echo "* Building binaries" echo "* Building binaries"
echo "************************" echo "************************"
ndk-build -j4 ndk-build -j4
if [ $? -ne 0 ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!"
echo "! Magisk binary tools build failed...."
echo "!!!!!!!!!!!!!!!!!!!!!!!!"
exit 1
fi
echo "************************" echo "************************"
echo "* Copying binaries" echo "* Copying binaries"
echo "************************" echo "************************"
@ -57,8 +63,10 @@ build_bin() {
zip_package() { zip_package() {
if [ ! -f "zip_static/arm/bootimgtools" ]; then if [ ! -f "zip_static/arm/bootimgtools" ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!"
echo "! Missing binaries!!" echo "! Missing binaries!!"
echo "! Please run \"$0 build\" before zipping" echo "! Please run \"$0 build\" before zipping"
echo "!!!!!!!!!!!!!!!!!!!!!!!!"
exit 1 exit 1
fi fi
echo "************************" echo "************************"
@ -103,6 +111,12 @@ sign_zip() {
echo "* Compiling ZipAdjust" echo "* Compiling ZipAdjust"
echo "************************" echo "************************"
gcc -o zipsigntools/zipadjust zipsigntools/src/*.c -lz gcc -o zipsigntools/zipadjust zipsigntools/src/*.c -lz
if [ $? -ne 0 ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!"
echo "! ZipAdjust Build failed...."
echo "!!!!!!!!!!!!!!!!!!!!!!!!"
exit 1
fi
chmod 755 zipsigntools/zipadjust chmod 755 zipsigntools/zipadjust
fi fi
echo "************************" echo "************************"