From fd59136e29ece9216a247049c97d0ba939b378aa Mon Sep 17 00:00:00 2001 From: Nicola Corna Date: Wed, 3 May 2017 17:32:18 +0200 Subject: [PATCH] Multiple changes * Add MicroG's signature spoofing patch * Add ENVs for custom packages, custom Java libraries and keys path * Change git protocol from git:// to https:// * Increase ccache limit to 100 GB --- Dockerfile | 13 +++++++++++-- src/build.sh | 32 +++++++++++++++++++++++++++++++- src/init.sh | 2 +- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0cf8aee..95f24c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM finalduty/archlinux -MAINTAINER Julian Xhokaxhiu +MAINTAINER Nicola Corna # Environment variables ####################### @@ -54,6 +54,15 @@ ENV WITH_SU true # Provide a default JACK configuration in order to avoid out-of-memory issues ENV ANDROID_JACK_VM_ARGS "-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G" +# Custom packages to be installed +ENV CUSTOM_PACKAGES '' + +# Custom static Java libraries to be installed +ENV CUSTOM_STATIC_JAVA_LIBRARY '' + +# Key path (from the root of the android source) +ENV RELEASEKEY_PATH '' + # Create Volume entry points ############################ @@ -159,4 +168,4 @@ RUN yes | pacman -Scc # Set the entry point to init.sh ########################################### -ENTRYPOINT /root/init.sh \ No newline at end of file +ENTRYPOINT /root/init.sh diff --git a/src/build.sh b/src/build.sh index be15d8b..f304407 100644 --- a/src/build.sh +++ b/src/build.sh @@ -19,7 +19,7 @@ if ! [ -z "$DEVICE_LIST" ]; then if ! [ "$(ls -A $SRC_DIR)" ]; then # Initialize repository echo ">> [$(date)] Initializing repository" >> $DOCKER_LOG - yes | repo init -u git://github.com/lineageos/android.git -b $BRANCH_NAME 2>&1 >&$DEBUG_LOG + yes | repo init -u https://github.com/lineageos/android.git -b $BRANCH_NAME 2>&1 >&$DEBUG_LOG fi # Copy local manifests to the appropriate folder in order take them into consideration @@ -37,6 +37,18 @@ if ! [ -z "$DEVICE_LIST" ]; then echo ">> [$(date)] Syncing repository" >> $DOCKER_LOG repo sync 2>&1 >&$DEBUG_LOG + # If not yet done, apply the MicroG's signature spoofing patch + cd frameworks/base + if [ $(git rev-parse --abbrev-ref HEAD) != "signature_spoofing" ]; then + echo ">> [$(date)] Applying signature spoofing patch to frameworks/base" >> $DOCKER_LOG + repo start signature_spoofing + wget -qO- https://raw.githubusercontent.com/microg/android_packages_apps_GmsCore/master/patches/android_frameworks_base-N.patch | patch -p1 + git clean -f + git add . + git commit -m "Add signature spoofing patch" + fi + cd $SRC_DIR + # If requested, clean the OUT dir in order to avoid clutter if [ "$CLEAN_OUTDIR" = true ]; then echo ">> [$(date)] Cleaning '$ZIP_DIR'" >> $DOCKER_LOG @@ -55,6 +67,24 @@ if ! [ -z "$DEVICE_LIST" ]; then sed -i "1s;^;PRODUCT_PROPERTY_OVERRIDES += cm.updater.uri=$OTA_URL\n\n;" vendor/cm/config/common.mk >&$DEBUG_LOG fi + # Add custom packages to be installed + if ! [ -z "$CUSTOM_PACKAGES" ]; then + echo ">> [$(date)] Adding custom packages ($CUSTOM_PACKAGES)" >> $DOCKER_LOG + echo "PRODUCT_PACKAGES += $CUSTOM_PACKAGES" >> vendor/cm/config/common.mk + fi + + # Add custom static Java libraries to be installed + if ! [ -z "$CUSTOM_STATIC_JAVA_LIBRARY" ]; then + echo ">> [$(date)] Adding custom static Java libraries ($CUSTOM_STATIC_JAVA_LIBRARY)" >> $DOCKER_LOG + echo "LOCAL_STATIC_JAVA_LIBRARIES += $CUSTOM_STATIC_JAVA_LIBRARY" >> vendor/cm/config/common.mk + fi + + # Add keys + if ! [ -z "$RELEASEKEY_PATH" ]; then + echo ">> [$(date)] Adding keys path ($SRC_DIR/$RELEASEKEY_PATH)" >> $DOCKER_LOG + echo "PRODUCT_DEFAULT_DEV_CERTIFICATE := $SRC_DIR/$RELEASEKEY_PATH" >> vendor/cm/config/common.mk + fi + # Cycle DEVICE_LIST environment variable, to know which one may be executed next IFS=',' for codename in $DEVICE_LIST; do diff --git a/src/init.sh b/src/init.sh index 0d981ca..5e930db 100644 --- a/src/init.sh +++ b/src/init.sh @@ -12,7 +12,7 @@ fi # Initialize CCache if it will be used if [ "$USE_CCACHE" = 1 ]; then - ccache -M 50G 2>&1 >&$DEBUG_LOG + ccache -M 100G 2>&1 >&$DEBUG_LOG fi # Initialize Git user information