mirror of
https://github.com/lineageos4microg/docker-lineage-cicd
synced 2024-05-07 23:46:11 +02:00
Prepare for LineageOS 15.1
This commit is contained in:
parent
37c76f39f5
commit
426f63bf9c
57
src/build.sh
57
src/build.sh
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Docker build script
|
||||
# Copyright (c) 2017 Julian Xhokaxhiu
|
||||
# Copyright (C) 2017 Nicola Corna <nicola@corna.info>
|
||||
# Copyright (C) 2017-2018 Nicola Corna <nicola@corna.info>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -84,19 +84,14 @@ for branch in $BRANCH_NAME; do
|
|||
echo ">> [$(date)] Branch: $branch"
|
||||
echo ">> [$(date)] Devices: ${!device_list_cur_branch}"
|
||||
|
||||
# Reset the current git status of "vendor/cm" (remove previous changes) if the directory exists
|
||||
if [ -d "vendor/cm" ]; then
|
||||
cd vendor/cm
|
||||
git reset -q --hard
|
||||
cd ../..
|
||||
fi
|
||||
|
||||
# Reset the current git status of "frameworks/base" (remove previous changes) if the directory exists
|
||||
if [ -d "frameworks/base" ]; then
|
||||
cd frameworks/base
|
||||
git reset -q --hard
|
||||
cd ../..
|
||||
fi
|
||||
# Remove previous changes of vendor/cm, vendor/lineage and frameworks/base (if they exist)
|
||||
for path in "vendor/cm" "vendor/lineage" "frameworks/base"; do
|
||||
if [ -d "$path" ]; then
|
||||
cd "$path"
|
||||
git reset -q --hard
|
||||
cd "$SRC_DIR/$branch_dir"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d .repo ]; then
|
||||
echo ">> [$(date)] Initializing branch repository"
|
||||
|
@ -113,8 +108,10 @@ for branch in $BRANCH_NAME; do
|
|||
themuppets_branch=cm-13.0
|
||||
elif [[ $branch =~ .*cm-14\.1.* ]]; then
|
||||
themuppets_branch=cm-14.1
|
||||
elif [[ $branch =~ .*lineage-15\.1.* ]]; then
|
||||
themuppets_branch=lineage-15.1
|
||||
else
|
||||
themuppets_branch=cm-14.1
|
||||
themuppets_branch=lineage-15.1
|
||||
echo ">> [$(date)] Can't find a matching branch on github.com/TheMuppets, using $themuppets_branch"
|
||||
fi
|
||||
wget -q -O .repo/local_manifests/proprietary.xml "https://raw.githubusercontent.com/TheMuppets/manifests/$themuppets_branch/muppets.xml"
|
||||
|
@ -124,9 +121,23 @@ for branch in $BRANCH_NAME; do
|
|||
builddate=$(date +%Y%m%d)
|
||||
repo sync -q -c --force-sync
|
||||
|
||||
android_version=$(sed -n -e 's/^\s*PLATFORM_VERSION := //p' build/core/version_defaults.mk)
|
||||
android_version=$(sed -n -e 's/^\s*PLATFORM_VERSION\.OPM1 := //p' build/core/version_defaults.mk)
|
||||
if [ -z $android_version ]; then
|
||||
android_version=$(sed -n -e 's/^\s*PLATFORM_VERSION := //p' build/core/version_defaults.mk)
|
||||
fi
|
||||
android_version_major=$(cut -d '.' -f 1 <<< $android_version)
|
||||
|
||||
if [ "$android_version_major" -ge "8" ]; then
|
||||
vendor="lineage"
|
||||
else
|
||||
vendor="cm"
|
||||
fi
|
||||
|
||||
if [ ! -d "vendor/$vendor" ]; then
|
||||
echo ">> [$(date)] Missing \"vendor/$vendor\", aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If needed, apply the microG's signature spoofing patch
|
||||
if [ "$SIGNATURE_SPOOFING" = "yes" ] || [ "$SIGNATURE_SPOOFING" = "restricted" ]; then
|
||||
# Determine which patch should be applied to the current Android source tree
|
||||
|
@ -136,6 +147,7 @@ for branch in $BRANCH_NAME; do
|
|||
5.* ) patch_name="android_frameworks_base-KK-LP.patch" ;;
|
||||
6.* ) patch_name="android_frameworks_base-M.patch" ;;
|
||||
7.* ) patch_name="android_frameworks_base-N.patch" ;;
|
||||
8.* ) patch_name="android_frameworks_base-O.patch" ;;
|
||||
esac
|
||||
|
||||
if ! [ -z $patch_name ]; then
|
||||
|
@ -157,24 +169,23 @@ for branch in $BRANCH_NAME; do
|
|||
fi
|
||||
|
||||
echo ">> [$(date)] Setting \"$RELEASE_TYPE\" as release type"
|
||||
sed -i '/#.*Filter out random types/d' vendor/cm/config/common.mk
|
||||
sed -i '/$(filter .*$(CM_BUILDTYPE)/,+3d' vendor/cm/config/common.mk
|
||||
sed -i "/\$(filter .*\$(${vendor^^}_BUILDTYPE)/,+2d" "vendor/$vendor/config/common.mk"
|
||||
|
||||
# Set a custom updater URI if a OTA URL is provided
|
||||
if ! [ -z "$OTA_URL" ]; then
|
||||
echo ">> [$(date)] Adding OTA URL '$OTA_URL' to build.prop"
|
||||
sed -i "1s;^;PRODUCT_PROPERTY_OVERRIDES += $OTA_PROP=$OTA_URL\n\n;" vendor/cm/config/common.mk
|
||||
sed -i "1s;^;PRODUCT_PROPERTY_OVERRIDES += $OTA_PROP=$OTA_URL\n\n;" "vendor/$vendor/config/common.mk"
|
||||
fi
|
||||
|
||||
# Add custom packages to be installed
|
||||
if ! [ -z "$CUSTOM_PACKAGES" ]; then
|
||||
echo ">> [$(date)] Adding custom packages ($CUSTOM_PACKAGES)"
|
||||
sed -i "1s;^;PRODUCT_PACKAGES += $CUSTOM_PACKAGES\n\n;" vendor/cm/config/common.mk
|
||||
sed -i "1s;^;PRODUCT_PACKAGES += $CUSTOM_PACKAGES\n\n;" "vendor/$vendor/config/common.mk"
|
||||
fi
|
||||
|
||||
if [ "$SIGN_BUILDS" = true ]; then
|
||||
echo ">> [$(date)] Adding keys path ($KEYS_DIR)"
|
||||
sed -i "1s;^;PRODUCT_DEFAULT_DEV_CERTIFICATE := $KEYS_DIR/releasekey\nPRODUCT_OTA_PUBLIC_KEYS := $KEYS_DIR/releasekey\nPRODUCT_EXTRA_RECOVERY_KEYS := $KEYS_DIR/releasekey\n\n;" vendor/cm/config/common.mk
|
||||
sed -i "1s;^;PRODUCT_DEFAULT_DEV_CERTIFICATE := $KEYS_DIR/releasekey\nPRODUCT_OTA_PUBLIC_KEYS := $KEYS_DIR/releasekey\nPRODUCT_EXTRA_RECOVERY_KEYS := $KEYS_DIR/releasekey\n\n;" "vendor/$vendor/config/common.mk"
|
||||
fi
|
||||
|
||||
if [ "$android_version_major" -ge "7" ]; then
|
||||
|
@ -228,8 +239,8 @@ for branch in $BRANCH_NAME; do
|
|||
else
|
||||
logsubdir=
|
||||
fi
|
||||
los_ver_major=$(sed -n -e 's/^\s*PRODUCT_VERSION_MAJOR = //p' vendor/cm/config/common.mk)
|
||||
los_ver_minor=$(sed -n -e 's/^\s*PRODUCT_VERSION_MINOR = //p' vendor/cm/config/common.mk)
|
||||
los_ver_major=$(sed -n -e 's/^\s*PRODUCT_VERSION_MAJOR = //p' "vendor/$vendor/config/common.mk")
|
||||
los_ver_minor=$(sed -n -e 's/^\s*PRODUCT_VERSION_MINOR = //p' "vendor/$vendor/config/common.mk")
|
||||
DEBUG_LOG="$LOGS_DIR/$logsubdir/lineage-$los_ver_major.$los_ver_minor-$builddate-$RELEASE_TYPE-$codename.log"
|
||||
|
||||
if [ -f /root/userscripts/pre-build.sh ]; then
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
commit 4e9d677b35b9656c22c922c9abca4107ab95c9b4
|
||||
Author: Bernhard Rosenkränzer <bero@lindev.ch>
|
||||
Date: Tue Aug 29 00:34:27 2017 +0200
|
||||
|
||||
Add permission to allow an APK to fake a signature.
|
||||
|
||||
This is needed by GmsCore (https://microg.org/) to pretend
|
||||
the existence of the official Play Services to applications calling
|
||||
Google APIs.
|
||||
|
||||
Forward-ported from https://github.com/microg/android_packages_apps_GmsCore/blob/master/patches/android_frameworks_base-N.patch
|
||||
|
||||
Change-Id: I603fd09200432f7e1bf997072188cdfa6da1594f
|
||||
Signed-off-by: Bernhard Rosenkränzer <bero@lindev.ch>
|
||||
|
||||
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
|
||||
index 794d4f8b78b..b3189077256 100644
|
||||
--- a/core/res/AndroidManifest.xml
|
||||
+++ b/core/res/AndroidManifest.xml
|
||||
@@ -2075,6 +2075,13 @@
|
||||
android:description="@string/permdesc_getPackageSize"
|
||||
android:protectionLevel="normal" />
|
||||
|
||||
+ <!-- @hide Allows an application to change the package signature as
|
||||
+ seen by applications -->
|
||||
+ <permission android:name="android.permission.FAKE_PACKAGE_SIGNATURE"
|
||||
+ android:protectionLevel="dangerous"
|
||||
+ android:label="@string/permlab_fakePackageSignature"
|
||||
+ android:description="@string/permdesc_fakePackageSignature" />
|
||||
+
|
||||
<!-- @deprecated No longer useful, see
|
||||
{@link android.content.pm.PackageManager#addPackageToPreferred}
|
||||
for details. -->
|
||||
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
|
||||
index 3613acf44aa..d1636c862c5 100644
|
||||
--- a/core/res/res/values/config.xml
|
||||
+++ b/core/res/res/values/config.xml
|
||||
@@ -1385,6 +1385,8 @@
|
||||
<string-array name="config_locationProviderPackageNames" translatable="false">
|
||||
<!-- The standard AOSP fused location provider -->
|
||||
<item>com.android.location.fused</item>
|
||||
+ <!-- The (faked) microg fused location provider (a free reimplementation) -->
|
||||
+ <item>com.google.android.gms</item>
|
||||
</string-array>
|
||||
|
||||
<!-- This string array can be overriden to enable test location providers initially. -->
|
||||
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
|
||||
index 3eebe7eb68d..7405386cd49 100644
|
||||
--- a/core/res/res/values/strings.xml
|
||||
+++ b/core/res/res/values/strings.xml
|
||||
@@ -764,6 +764,10 @@
|
||||
|
||||
<!-- Permissions -->
|
||||
|
||||
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
+ <string name="permlab_fakePackageSignature">Spoof package signature</string>
|
||||
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
+ <string name="permdesc_fakePackageSignature">Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Legitimate uses include an emulator pretending to be what it emulates. Grant this permission with caution only!</string>
|
||||
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permlab_statusBar">disable or modify status bar</string>
|
||||
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
|
||||
index f36b762c5e9..048a057d39c 100644
|
||||
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
|
||||
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
|
||||
@@ -3571,8 +3571,9 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
flags |= MATCH_ANY_USER;
|
||||
}
|
||||
|
||||
- PackageInfo packageInfo = PackageParser.generatePackageInfo(p, gids, flags,
|
||||
- ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId);
|
||||
+ PackageInfo packageInfo = mayFakeSignature(p, PackageParser.generatePackageInfo(p, gids, flags,
|
||||
+ ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId),
|
||||
+ permissions);
|
||||
|
||||
if (packageInfo == null) {
|
||||
return null;
|
||||
@@ -3584,6 +3585,24 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
return packageInfo;
|
||||
}
|
||||
|
||||
+ private PackageInfo mayFakeSignature(PackageParser.Package p, PackageInfo pi,
|
||||
+ Set<String> permissions) {
|
||||
+ try {
|
||||
+ if (permissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE")
|
||||
+ && p.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1
|
||||
+ && p.mAppMetaData != null) {
|
||||
+ String sig = p.mAppMetaData.getString("fake-signature");
|
||||
+ if (sig != null) {
|
||||
+ pi.signatures = new Signature[] {new Signature(sig)};
|
||||
+ }
|
||||
+ }
|
||||
+ } catch (Throwable t) {
|
||||
+ // We should never die because of any failures, this is system code!
|
||||
+ Log.w("PackageManagerService.FAKE_PACKAGE_SIGNATURE", t);
|
||||
+ }
|
||||
+ return pi;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public void checkPackageStartable(String packageName, int userId) {
|
||||
final int callingUid = Binder.getCallingUid();
|
Loading…
Reference in New Issue