From b8854dea9420f6a8d97e88038b6a486a36cf5c65 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 6 Dec 2021 15:27:25 +0100 Subject: [PATCH 01/10] Build system app --- Dockerfile | 2 +- src/build.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 28c92dd..f3a43a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -148,7 +148,7 @@ RUN mkdir -p $USERSCRIPTS_DIR RUN apt-get -qq update RUN apt-get -qqy upgrade -RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang cron \ +RUN apt-get install -y apksigner bc bison bsdmainutils build-essential ccache cgpt clang cron \ curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ lib32ncurses5-dev libncurses5 lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ diff --git a/src/build.sh b/src/build.sh index b9add0c..fb47cba 100755 --- a/src/build.sh +++ b/src/build.sh @@ -215,6 +215,14 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then if lunch "${BRUNCH_DEVICE}" && mka && mka sdk_addon ; then build_success=true fi + elif [[ ! -z "${APP_NAME}" ]]; then + echo ">> [$(date)] Build ${APP_NAME} app" + if lunch "${BRUNCH_DEVICE}"; then + if make "${APP_NAME}"; then + build_success=true + fi + fi + fi elif brunch "${BRUNCH_DEVICE}"; then build_success=true fi @@ -275,6 +283,25 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then popd fi + if [[ ! -z "${APP_NAME}" ]];; then + APK_PATH="out/target/product/${DEVICE}/system/priv-app/${APP_NAME}/${APP_NAME}.apk" + if [ ! -f "$APK_PATH" ] ;then + echo "system priv app for pie or oreo" + APK_PATH="out/target/product/${DEVICE}/system/app/${APP_NAME}/${APP_NAME}.apk" + if [ ! -f "$APK_PATH" ] ; then + APK_PATH="out/target/product/${DEVICE}/system/product/priv-app/${APP_NAME}/${APP_NAME}.apk" + if [ ! -f "$APK_PATH" ] ;then + APK_PATH="out/target/product/${DEVICE}/system/product/app/${APP_NAME}/${APP_NAME}.apk" + fi + fi + fi + + echo ">> [$(date)] APK path: ${APK_PATH}" + echo ">> [$(date)] App signature" + java -jar /usr/bin/apksigner sign --key build/target/product/security/platform.pk8 --cert build/target/product/security/platform.x509.pem --out ${APK_PATH} ${APK_PATH} + mv ${APK_PATH} "$ZIP_DIR/$zipsubdir" + fi + cd "$source_dir" || return 1 build_successful=true else -- GitLab From 18f09a7ef9637817d170369a5aa06ce17104a0b1 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 6 Dec 2021 15:37:06 +0100 Subject: [PATCH 02/10] Remove unecessary fi --- src/build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/build.sh b/src/build.sh index fb47cba..fdfe6f7 100755 --- a/src/build.sh +++ b/src/build.sh @@ -222,7 +222,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then build_success=true fi fi - fi elif brunch "${BRUNCH_DEVICE}"; then build_success=true fi -- GitLab From 4796b9153263b5d8c4893c6905fa77862a8ffc97 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 6 Dec 2021 16:46:48 +0100 Subject: [PATCH 03/10] Fix syntax issue --- src/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build.sh b/src/build.sh index fdfe6f7..cce5779 100755 --- a/src/build.sh +++ b/src/build.sh @@ -282,7 +282,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then popd fi - if [[ ! -z "${APP_NAME}" ]];; then + if [[ ! -z "${APP_NAME}" ]]; then APK_PATH="out/target/product/${DEVICE}/system/priv-app/${APP_NAME}/${APP_NAME}.apk" if [ ! -f "$APK_PATH" ] ;then echo "system priv app for pie or oreo" -- GitLab From 63aa44923cfe914eeb50b0853a62af78727d943b Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 6 Dec 2021 17:26:59 +0100 Subject: [PATCH 04/10] Move signature next to the build --- src/build.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/build.sh b/src/build.sh index cce5779..87d4523 100755 --- a/src/build.sh +++ b/src/build.sh @@ -213,6 +213,21 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi elif [ "${USE_LUNCH}" = true ]; then if lunch "${BRUNCH_DEVICE}" && mka && mka sdk_addon ; then + APK_PATH="out/target/product/${DEVICE}/system/priv-app/${APP_NAME}/${APP_NAME}.apk" + if [ ! -f "$APK_PATH" ] ;then + echo "system priv app for pie or oreo" + APK_PATH="out/target/product/${DEVICE}/system/app/${APP_NAME}/${APP_NAME}.apk" + if [ ! -f "$APK_PATH" ] ; then + APK_PATH="out/target/product/${DEVICE}/system/product/priv-app/${APP_NAME}/${APP_NAME}.apk" + if [ ! -f "$APK_PATH" ] ;then + APK_PATH="out/target/product/${DEVICE}/system/product/app/${APP_NAME}/${APP_NAME}.apk" + fi + fi + fi + + echo ">> [$(date)] APK path: ${APK_PATH}" + echo ">> [$(date)] App signature" + java -jar /usr/bin/apksigner sign --key build/target/product/security/platform.pk8 --cert build/target/product/security/platform.x509.pem --out ${APK_PATH} ${APK_PATH} build_success=true fi elif [[ ! -z "${APP_NAME}" ]]; then @@ -283,21 +298,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi if [[ ! -z "${APP_NAME}" ]]; then - APK_PATH="out/target/product/${DEVICE}/system/priv-app/${APP_NAME}/${APP_NAME}.apk" - if [ ! -f "$APK_PATH" ] ;then - echo "system priv app for pie or oreo" - APK_PATH="out/target/product/${DEVICE}/system/app/${APP_NAME}/${APP_NAME}.apk" - if [ ! -f "$APK_PATH" ] ; then - APK_PATH="out/target/product/${DEVICE}/system/product/priv-app/${APP_NAME}/${APP_NAME}.apk" - if [ ! -f "$APK_PATH" ] ;then - APK_PATH="out/target/product/${DEVICE}/system/product/app/${APP_NAME}/${APP_NAME}.apk" - fi - fi - fi - - echo ">> [$(date)] APK path: ${APK_PATH}" - echo ">> [$(date)] App signature" - java -jar /usr/bin/apksigner sign --key build/target/product/security/platform.pk8 --cert build/target/product/security/platform.x509.pem --out ${APK_PATH} ${APK_PATH} mv ${APK_PATH} "$ZIP_DIR/$zipsubdir" fi -- GitLab From a2b9b90f66b5544c64c013da40c8c5729a29bd9d Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 6 Dec 2021 18:29:23 +0100 Subject: [PATCH 05/10] Fix the app signature --- src/build.sh | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/build.sh b/src/build.sh index 87d4523..a4b73fc 100755 --- a/src/build.sh +++ b/src/build.sh @@ -213,21 +213,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi elif [ "${USE_LUNCH}" = true ]; then if lunch "${BRUNCH_DEVICE}" && mka && mka sdk_addon ; then - APK_PATH="out/target/product/${DEVICE}/system/priv-app/${APP_NAME}/${APP_NAME}.apk" - if [ ! -f "$APK_PATH" ] ;then - echo "system priv app for pie or oreo" - APK_PATH="out/target/product/${DEVICE}/system/app/${APP_NAME}/${APP_NAME}.apk" - if [ ! -f "$APK_PATH" ] ; then - APK_PATH="out/target/product/${DEVICE}/system/product/priv-app/${APP_NAME}/${APP_NAME}.apk" - if [ ! -f "$APK_PATH" ] ;then - APK_PATH="out/target/product/${DEVICE}/system/product/app/${APP_NAME}/${APP_NAME}.apk" - fi - fi - fi - - echo ">> [$(date)] APK path: ${APK_PATH}" - echo ">> [$(date)] App signature" - java -jar /usr/bin/apksigner sign --key build/target/product/security/platform.pk8 --cert build/target/product/security/platform.x509.pem --out ${APK_PATH} ${APK_PATH} build_success=true fi elif [[ ! -z "${APP_NAME}" ]]; then @@ -298,7 +283,27 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi if [[ ! -z "${APP_NAME}" ]]; then + + echo ">> [$(date)] ===== TEST =====" + pwd + + APK_PATH="${DEVICE}/system/priv-app/${APP_NAME}/${APP_NAME}.apk" + if [ ! -f "$APK_PATH" ]; then + APK_PATH="${DEVICE}/system/app/${APP_NAME}/${APP_NAME}.apk" + if [ ! -f "$APK_PATH" ]; then + APK_PATH="${DEVICE}/system/product/priv-app/${APP_NAME}/${APP_NAME}.apk" + if [ ! -f "$APK_PATH" ]; then + APK_PATH="${DEVICE}/system/product/app/${APP_NAME}/${APP_NAME}.apk" + fi + fi + fi + mv ${APK_PATH} "$ZIP_DIR/$zipsubdir" + + echo ">> [$(date)] APK path: ${APK_PATH}" + echo ">> [$(date)] App signature" + java -jar /usr/bin/apksigner sign --key build/target/product/security/platform.pk8 --cert build/target/product/security/platform.x509.pem --out "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" + fi cd "$source_dir" || return 1 -- GitLab From 6cef154e8e05b00182cf0f3bdf61ddc4a54c933b Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 6 Dec 2021 23:03:57 +0100 Subject: [PATCH 06/10] Fix key path --- src/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build.sh b/src/build.sh index a4b73fc..b75b28a 100755 --- a/src/build.sh +++ b/src/build.sh @@ -302,7 +302,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then echo ">> [$(date)] APK path: ${APK_PATH}" echo ">> [$(date)] App signature" - java -jar /usr/bin/apksigner sign --key build/target/product/security/platform.pk8 --cert build/target/product/security/platform.x509.pem --out "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" + java -jar /usr/bin/apksigner sign --key $SRC_DIR/build/target/product/security/platform.pk8 --cert $SRC_DIR/build/target/product/security/platform.x509.pem --out "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" fi -- GitLab From 0f584fd888f68d23562604d426d7a3d55460ebb1 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 7 Dec 2021 00:12:43 +0100 Subject: [PATCH 07/10] Fix again path for keys --- src/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build.sh b/src/build.sh index b75b28a..b1d2854 100755 --- a/src/build.sh +++ b/src/build.sh @@ -302,7 +302,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then echo ">> [$(date)] APK path: ${APK_PATH}" echo ">> [$(date)] App signature" - java -jar /usr/bin/apksigner sign --key $SRC_DIR/build/target/product/security/platform.pk8 --cert $SRC_DIR/build/target/product/security/platform.x509.pem --out "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" + java -jar /usr/bin/apksigner sign --key "$source_dir"/build/target/product/security/platform.pk8 --cert "$source_dir"/build/target/product/security/platform.x509.pem --out "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" fi -- GitLab From 3aabf415fe2e1b7ab46db5fadc01dfc152ddc098 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 7 Dec 2021 15:39:20 +0100 Subject: [PATCH 08/10] Fix app name --- src/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build.sh b/src/build.sh index b1d2854..60630ad 100755 --- a/src/build.sh +++ b/src/build.sh @@ -302,7 +302,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then echo ">> [$(date)] APK path: ${APK_PATH}" echo ">> [$(date)] App signature" - java -jar /usr/bin/apksigner sign --key "$source_dir"/build/target/product/security/platform.pk8 --cert "$source_dir"/build/target/product/security/platform.x509.pem --out "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" "$ZIP_DIR/$zipsubdir/${APK_PATH}.apk" + java -jar /usr/bin/apksigner sign --key "$source_dir"/build/target/product/security/platform.pk8 --cert "$source_dir"/build/target/product/security/platform.x509.pem --out "$ZIP_DIR/$zipsubdir/${APP_NAME}.apk" "$ZIP_DIR/$zipsubdir/${APP_NAME}.apk" fi -- GitLab From 4aee2fdbe0b96af9af5360afb2b821b28abd5a0b Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 7 Dec 2021 17:39:10 +0100 Subject: [PATCH 09/10] Update APK path proposal --- src/build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/build.sh b/src/build.sh index 60630ad..f685d94 100755 --- a/src/build.sh +++ b/src/build.sh @@ -287,13 +287,13 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then echo ">> [$(date)] ===== TEST =====" pwd - APK_PATH="${DEVICE}/system/priv-app/${APP_NAME}/${APP_NAME}.apk" + APK_PATH="$source_dir/system/priv-app/${APP_NAME}/${APP_NAME}.apk" if [ ! -f "$APK_PATH" ]; then - APK_PATH="${DEVICE}/system/app/${APP_NAME}/${APP_NAME}.apk" + APK_PATH="$source_dir/system/app/${APP_NAME}/${APP_NAME}.apk" if [ ! -f "$APK_PATH" ]; then - APK_PATH="${DEVICE}/system/product/priv-app/${APP_NAME}/${APP_NAME}.apk" + APK_PATH="$source_dir/system/product/priv-app/${APP_NAME}/${APP_NAME}.apk" if [ ! -f "$APK_PATH" ]; then - APK_PATH="${DEVICE}/system/product/app/${APP_NAME}/${APP_NAME}.apk" + APK_PATH="$source_dir/system/product/app/${APP_NAME}/${APP_NAME}.apk" fi fi fi -- GitLab From 7595f8855ad4df3a8d14bed6fe7e7abb58e69cce Mon Sep 17 00:00:00 2001 From: Alexandre Roux Date: Thu, 17 Mar 2022 16:31:00 +0000 Subject: [PATCH 10/10] include git-lfs --- Dockerfile | 2 +- Dockerfile.community | 2 +- src/build.sh | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f3a43a6..28a6098 100644 --- a/Dockerfile +++ b/Dockerfile @@ -149,7 +149,7 @@ RUN apt-get -qq update RUN apt-get -qqy upgrade RUN apt-get install -y apksigner bc bison bsdmainutils build-essential ccache cgpt clang cron \ - curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ + curl flex g++-multilib gcc-multilib git git-lfs gnupg gperf imagemagick kmod \ lib32ncurses5-dev libncurses5 lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ diff --git a/Dockerfile.community b/Dockerfile.community index 1444d9c..b06f7f8 100644 --- a/Dockerfile.community +++ b/Dockerfile.community @@ -153,7 +153,7 @@ RUN apt-get -qq update RUN apt-get -qqy upgrade RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang cron \ - curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ + curl flex g++-multilib gcc-multilib git git-lfs gnupg gperf imagemagick kmod \ lib32ncurses5-dev libncurses5 lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ diff --git a/src/build.sh b/src/build.sh index f685d94..bef55e7 100755 --- a/src/build.sh +++ b/src/build.sh @@ -113,7 +113,10 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then if ! repo sync -c --force-sync then sync_successful=false + else + repo forall -c 'git lfs pull' fi + if [ ! -d "vendor/$vendor" ]; then echo ">> [$(date)] Missing \"vendor/$vendor\", aborting" -- GitLab