Add version and arch checks
This commit is contained in:
@@ -9,7 +9,10 @@
|
|||||||
DATE=$(date -u +%Y%m%d_%H%M%S)
|
DATE=$(date -u +%Y%m%d_%H%M%S)
|
||||||
TOP=$(realpath .)
|
TOP=$(realpath .)
|
||||||
ANDROIDV=12.0.0
|
ANDROIDV=12.0.0
|
||||||
|
SDKV=31
|
||||||
GARCH=$1
|
GARCH=$1
|
||||||
|
CPUARCH=$GARCH
|
||||||
|
[ ! -z "$2" ] && CPUARCH=$2
|
||||||
OUT=$TOP/out
|
OUT=$TOP/out
|
||||||
BUILD=$TOP/build
|
BUILD=$TOP/build
|
||||||
METAINF=$BUILD/meta
|
METAINF=$BUILD/meta
|
||||||
@@ -54,6 +57,10 @@ function create() {
|
|||||||
test -d $OUT/$GARCH/system/addon.d || mkdir -p $OUT/$GARCH/system/addon.d
|
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_head $OUT/$GARCH/system/addon.d
|
||||||
cp -f addond_tail $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() {
|
function zipit() {
|
||||||
|
@@ -11,11 +11,11 @@ distclean:
|
|||||||
|
|
||||||
gapps_arm:
|
gapps_arm:
|
||||||
@echo "Compiling GApps for arm..."
|
@echo "Compiling GApps for arm..."
|
||||||
@bash $(BUILD_GAPPS) arm 2>&1
|
@bash $(BUILD_GAPPS) arm armv7l 2>&1
|
||||||
|
|
||||||
gapps_arm64:
|
gapps_arm64:
|
||||||
@echo "Compiling GApps for arm64..."
|
@echo "Compiling GApps for arm64..."
|
||||||
@bash $(BUILD_GAPPS) arm64 2>&1
|
@bash $(BUILD_GAPPS) arm64 aarch64 2>&1
|
||||||
|
|
||||||
gapps_x86:
|
gapps_x86:
|
||||||
@echo "Compiling GApps for x86..."
|
@echo "Compiling GApps for x86..."
|
||||||
|
@@ -21,6 +21,24 @@ ui_print() {
|
|||||||
echo "ui_print" > "$OUTFD";
|
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() {
|
cleanup() {
|
||||||
ui_print "Cleaning up files"
|
ui_print "Cleaning up files"
|
||||||
rm -rf $TMP/system
|
rm -rf $TMP/system
|
||||||
@@ -120,6 +138,15 @@ cd "$TMP"
|
|||||||
unzip -o "$ZIP"
|
unzip -o "$ZIP"
|
||||||
rm -rf META-INF
|
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"
|
ui_print "Setting up environment"
|
||||||
TOYBOX="${TMP}/toybox"
|
TOYBOX="${TMP}/toybox"
|
||||||
chmod +x "$TOYBOX"
|
chmod +x "$TOYBOX"
|
||||||
@@ -181,6 +208,15 @@ error_mounting "$SYSTEM_MNT"
|
|||||||
fi
|
fi
|
||||||
SYSTEM_OUT="${SYSTEM_MNT}/system"
|
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
|
# Ignore {product,system_ext} block devices in case they are symlinks
|
||||||
# This is common on devices where maintainers have chosen not to use
|
# This is common on devices where maintainers have chosen not to use
|
||||||
# real partitions because of their size being too small to be useful
|
# real partitions because of their size being too small to be useful
|
||||||
|
Reference in New Issue
Block a user