Skip to content

Commit

Permalink
MicroG: Don't apply signature spoofing patches
Browse files Browse the repository at this point in the history
This is now integrated into LOS.
Also the overlay is no longer required as those values are the default now.
  • Loading branch information
Flamefire committed Dec 28, 2024
1 parent dbaf08a commit 5a36ba8
Showing 1 changed file with 5 additions and 48 deletions.
53 changes: 5 additions & 48 deletions build_scripts/buildMicroG.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,15 @@ function printStatus () {

export WITH_GMS="true"
export RELEASE_TYPE="MICROG"
#export SKIP_EXTRACT="1"

if [ ! -e "vendor/partner_gms/products/gms.mk" ]; then
printStatus "Missing GMS files!"
exit 1
fi

branch=$(grep -F '<default revision=' .repo/manifests/default.xml | sed -E 's|.*"refs/heads/(.*)"|\1|')

vendor=lineage
case "$branch" in
lineage-17.1)
frameworks_base_patch="android_frameworks_base-Q.patch"
;;
lineage-18.1)
frameworks_base_patch="" # "android_frameworks_base-R.patch"
;;
lineage-19.1)
frameworks_base_patch="" #"android_frameworks_base-S.patch"
;;
*)
printStatus "Building branch $branch is not (yet) suppported"
exit 1
;;
esac

printStatus "Branch: $branch"

PATCH_DIR="/tmp/docker-lineage-cicd-master/src"
if [ ! -d "$PATCH_DIR" ]; then
printStatus "Downloading lineageos4microg"
wget https://github.com/lineageos4microg/docker-lineage-cicd/archive/refs/heads/master.tar.gz -O /tmp/master.tar.gz
(cd /tmp && tar xf master.tar.gz)
printStatus "Downloaded lineageos4microg"
fi


function reset_patches {
# Remove previous changes (if they exist)
for path in "vendor/lineage" "frameworks/base"; do
for path in "vendor/lineage"; do
if [ -d "$path" ]; then
printStatus "Removing changes to $path"
(cd "$path"; git reset -q --hard; git clean -q -fd)
Expand All @@ -57,29 +26,17 @@ function reset_patches {

reset_patches

printStatus "Set up MicroG overlay"
_microgOverlayPath="vendor/lineage/overlay/microg"
mkdir -p "$_microgOverlayPath"
sed -i "1s;^;PRODUCT_PACKAGE_OVERLAYS := $_microgOverlayPath\n;" "vendor/lineage/config/common.mk"
# Override device-specific settings for the location providers
_microgOverlayPath+="/frameworks/base/core/res/res/values"
mkdir -p "$_microgOverlayPath"
cp $PATCH_DIR/signature_spoofing_patches/frameworks_base_config.xml "$_microgOverlayPath/config.xml"

makefile_containing_version="vendor/lineage/config/common.mk"
if [ -f "vendor/lineage/config/version.mk" ]; then
makefile_containing_version="vendor/lineage/config/version.mk"
fi
printStatus "Patching build type check in $makefile_containing_version"
sed -i "/\$(filter .*\$(LINEAGE_BUILDTYPE)/,/endif/d" "$makefile_containing_version"

if [[ -n $frameworks_base_patch ]]; then
printStatus "Applying the restricted signature spoofing patch (based on $frameworks_base_patch) to frameworks/base"
patchPath="$PATCH_DIR/signature_spoofing_patches/$frameworks_base_patch"
sed 's/android:protectionLevel="dangerous"/android:protectionLevel="signature|privileged"/' "$patchPath" | patch -d frameworks/base --quiet --force -p1 --no-backup-if-mismatch
fi

set +e
"$(dirname "${BASH_SOURCE[0]}")/build.sh" "$@"

exit_code=$?
printStatus "Build done"
reset_patches

exit $exit_code

0 comments on commit 5a36ba8

Please sign in to comment.