Add version and arch checks
This commit is contained in:
parent
2f30bf7eb5
commit
49a4548984
@ -9,7 +9,10 @@
|
||||
DATE=$(date -u +%Y%m%d_%H%M%S)
|
||||
TOP=$(realpath .)
|
||||
ANDROIDV=12.0.0
|
||||
SDKV=31
|
||||
GARCH=$1
|
||||
CPUARCH=$GARCH
|
||||
[ ! -z "$2" ] && CPUARCH=$2
|
||||
OUT=$TOP/out
|
||||
BUILD=$TOP/build
|
||||
METAINF=$BUILD/meta
|
||||
@ -54,6 +57,10 @@ function create() {
|
||||
test -d $OUT/$GARCH/system/addon.d || mkdir -p $OUT/$GARCH/system/addon.d
|
||||
cp -f addond_head $OUT/$GARCH/system/addon.d
|
||||
cp -f addond_tail $OUT/$GARCH/system/addon.d
|
||||
echo "Writing build props..."
|
||||
echo "arch=$CPUARCH" > $OUT/$GARCH/build.prop
|
||||
echo "version=$SDKV" >> $OUT/$GARCH/build.prop
|
||||
echo "version_nice=$ANDROIDV" >> $OUT/$GARCH/build.prop
|
||||
}
|
||||
|
||||
function zipit() {
|
||||
|
@ -11,11 +11,11 @@ distclean:
|
||||
|
||||
gapps_arm:
|
||||
@echo "Compiling GApps for arm..."
|
||||
@bash $(BUILD_GAPPS) arm 2>&1
|
||||
@bash $(BUILD_GAPPS) arm armv7l 2>&1
|
||||
|
||||
gapps_arm64:
|
||||
@echo "Compiling GApps for arm64..."
|
||||
@bash $(BUILD_GAPPS) arm64 2>&1
|
||||
@bash $(BUILD_GAPPS) arm64 aarch64 2>&1
|
||||
|
||||
gapps_x86:
|
||||
@echo "Compiling GApps for x86..."
|
||||
|
@ -21,6 +21,24 @@ ui_print() {
|
||||
echo "ui_print" > "$OUTFD";
|
||||
}
|
||||
|
||||
getprop2() {
|
||||
grep -m 1 "^$2=" $1 | cut -d= -f2
|
||||
}
|
||||
|
||||
nice_arch() {
|
||||
case $1 in
|
||||
aarch64*|armv8*)
|
||||
echo "arm64"
|
||||
;;
|
||||
arm*)
|
||||
echo "arm"
|
||||
;;
|
||||
*)
|
||||
echo $1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
ui_print "Cleaning up files"
|
||||
rm -rf $TMP/system
|
||||
@ -120,6 +138,15 @@ cd "$TMP"
|
||||
unzip -o "$ZIP"
|
||||
rm -rf META-INF
|
||||
|
||||
# Check for arch. We need to do this before extracting our toybox, since that might be
|
||||
# compiled for a different architecture. Just hope that all environments have at least
|
||||
# a proper `grep` and `uname`.
|
||||
GAPPS_ARCH=$(getprop2 $TMP/build.prop arch)
|
||||
CPU_ARCH=$(uname -m)
|
||||
if [ $GAPPS_ARCH != $CPU_ARCH ]; then
|
||||
error "This package is built for $(nice_arch $GAPPS_ARCH) but your device is $(nice_arch $CPU_ARCH)! Aborting"
|
||||
fi
|
||||
|
||||
ui_print "Setting up environment"
|
||||
TOYBOX="${TMP}/toybox"
|
||||
chmod +x "$TOYBOX"
|
||||
@ -181,6 +208,15 @@ error_mounting "$SYSTEM_MNT"
|
||||
fi
|
||||
SYSTEM_OUT="${SYSTEM_MNT}/system"
|
||||
|
||||
# Compare sdk version
|
||||
GAPPS_VERSION=$(getprop2 $TMP/build.prop version)
|
||||
ANDROID_VERSION=$(getprop2 $SYSTEM_OUT/build.prop ro.build.version.sdk)
|
||||
if [ "$GAPPS_VERSION" != "$ANDROID_VERSION" ]; then
|
||||
gapps_version_nice=$(getprop2 $TMP/build.prop version_nice)
|
||||
android_version_nice=$(getprop2 $SYSTEM_OUT/build.prop ro.build.version.release)
|
||||
error "This package is for Android $gapps_version_nice (SDK $GAPPS_VERSION) but your system is Android $android_version_nice (SDK $ANDROID_VERSION)! Aborting"
|
||||
fi
|
||||
|
||||
# Ignore {product,system_ext} block devices in case they are symlinks
|
||||
# This is common on devices where maintainers have chosen not to use
|
||||
# real partitions because of their size being too small to be useful
|
||||
|
Loading…
Reference in New Issue
Block a user