[WIP] Gapps integrate

This commit is contained in:
Howard Wu 2024-02-09 03:05:42 +08:00
parent 85db04bdc8
commit cef9ef4a54
19 changed files with 37 additions and 116 deletions
arm64
gapps/product
system/priv-app/VpnDialogs
bin
linker
scripts
x64
gapps/product
system/priv-app/VpnDialogs

View file

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This file is part of MagiskOnWSALocal.
MagiskOnWSALocal is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
MagiskOnWSALocal is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with MagiskOnWSALocal. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2023 LSPosed Contributors
-->
<config>
<component-override package="com.android.vending">
<!-- Conflicts with WSA's built-in package verifier, disable to prevent boot loops. -->
<component class="com.google.android.finsky.verifier.impl.PackageVerificationReceiver" enabled="false" />
<!-- Disable stock OTA components if installed -->
<component class="com.google.android.finsky.systemupdate.SystemUpdateSettingsContentProvider" enabled="false" />
<component class="com.google.android.finsky.systemupdateactivity.SettingsSecurityEntryPoint" enabled="false" />
<component class="com.google.android.finsky.systemupdateactivity.SystemUpdateActivity" enabled="false" />
</component-override>
<component-override package="com.google.android.gms">
<component class="com.google.android.gms.update.phone.PopupDialog" enabled="false" />
<component class="com.google.android.gms.update.OtaSuggestionSummaryProvider" enabled="false" />
<component class="com.google.android.gms.update.SystemUpdateActivity" enabled="false" />
<component class="com.google.android.gms.update.SystemUpdateGcmTaskService" enabled="false" />
<component class="com.google.android.gms.update.SystemUpdateService" enabled="false" />
</component-override>
</config>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -246,7 +246,7 @@ while [[ $# -gt 0 ]]; do
shift shift
;; ;;
--magisk-custom) --magisk-custom)
CUSTOM_MAGISK="debug" CUSTOM_MAGISK=true
shift shift
;; ;;
--magisk-ver) --magisk-ver)
@ -272,12 +272,6 @@ while [[ $# -gt 0 ]]; do
esac esac
done done
if [ "$CUSTOM_MAGISK" ]; then
if [ -z "$MAGISK_VER" ]; then
MAGISK_VER=$CUSTOM_MAGISK
fi
fi
check_list() { check_list() {
local input=$1 local input=$1
if [ -n "$input" ]; then if [ -n "$input" ]; then
@ -308,13 +302,6 @@ if [ "$DEBUG" ]; then
set -x set -x
fi fi
require_su() {
if test "$(id -u)" != "0"; then
if [ "$(sudo id -u)" != "0" ]; then
abort "sudo is required to run this script"
fi
fi
}
# shellcheck disable=SC1091 # shellcheck disable=SC1091
[ -f "$PYTHON_VENV_DIR/bin/activate" ] && { [ -f "$PYTHON_VENV_DIR/bin/activate" ] && {
source "$PYTHON_VENV_DIR/bin/activate" || abort "Failed to activate virtual environment, please re-run install_deps.sh" source "$PYTHON_VENV_DIR/bin/activate" || abort "Failed to activate virtual environment, please re-run install_deps.sh"
@ -344,7 +331,7 @@ if [ "$CUSTOM_MAGISK" ]; then
fi fi
ANDROID_API=33 ANDROID_API=33
update_gapps_file_name() { update_gapps_file_name() {
GAPPS_FILE_NAME=GApps-$ARCH-${ANDROID_API_MAP[$ANDROID_API]}.apex GAPPS_FILE_NAME=GApps-$ARCH-${ANDROID_API_MAP[$ANDROID_API]}.img
GAPPS_PATH=$DOWNLOAD_DIR/$GAPPS_FILE_NAME GAPPS_PATH=$DOWNLOAD_DIR/$GAPPS_FILE_NAME
} }
WSA_MAJOR_VER=0 WSA_MAJOR_VER=0
@ -379,7 +366,6 @@ update_ksu_zip_name() {
if [ -z ${OFFLINE+x} ]; then if [ -z ${OFFLINE+x} ]; then
echo "Generating WSA Download Links" echo "Generating WSA Download Links"
require_su
if [ "$DOWN_WSA" != "no" ]; then if [ "$DOWN_WSA" != "no" ]; then
python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
echo "Downloading WSA" echo "Downloading WSA"
@ -387,14 +373,16 @@ if [ -z ${OFFLINE+x} ]; then
python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$DOWN_WSA" || abort python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$DOWN_WSA" || abort
echo "Skip download WSA, downloading WSA depends" echo "Skip download WSA, downloading WSA depends"
fi fi
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity=true --continue=true --allow-overwrite=true --conditional-get=true -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR/$DOWNLOAD_CONF_NAME"; then if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 \
--async-dns=false --check-integrity=true --continue=true --allow-overwrite=true --conditional-get=true \
-d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR/$DOWNLOAD_CONF_NAME"; then
echo "We have encountered an error while downloading files." echo "We have encountered an error while downloading files."
exit 1 exit 1
fi fi
rm -f "${DOWNLOAD_DIR:?}/$DOWNLOAD_CONF_NAME" rm -f "${DOWNLOAD_DIR:?}/$DOWNLOAD_CONF_NAME"
fi fi
echo "Extract WSA" echo "Extracting WSA"
if [ -f "$WSA_ZIP_PATH" ]; then if [ -f "$WSA_ZIP_PATH" ]; then
if ! python3 extractWSA.py "$ARCH" "$WSA_ZIP_PATH" "$WORK_DIR" "$WSA_WORK_ENV"; then if ! python3 extractWSA.py "$ARCH" "$WSA_ZIP_PATH" "$WORK_DIR" "$WSA_WORK_ENV"; then
CLEAN_DOWNLOAD_WSA=1 CLEAN_DOWNLOAD_WSA=1
@ -431,7 +419,9 @@ if [ -z ${OFFLINE+x} ]; then
fi fi
echo "Downloading Artifacts" echo "Downloading Artifacts"
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity=true --continue=true --allow-overwrite=true --conditional-get=true -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR/$DOWNLOAD_CONF_NAME"; then if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 \
--async-dns=false --check-integrity=true --continue=true --allow-overwrite=true --conditional-get=true \
-d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR/$DOWNLOAD_CONF_NAME"; then
echo "We have encountered an error while downloading files." echo "We have encountered an error while downloading files."
exit 1 exit 1
fi fi
@ -450,19 +440,18 @@ else # Offline mode
fi fi
for i in "${FILES_CHECK_LIST[@]}"; do for i in "${FILES_CHECK_LIST[@]}"; do
if [ ! -f "$i" ]; then if [ ! -f "$i" ]; then
echo "Offline mode: missing [$i]." echo "Offline mode: missing [$i]"
OFFLINE_ERR="1" OFFLINE_ERR="1"
fi fi
done done
if [ "$OFFLINE_ERR" ]; then if [ "$OFFLINE_ERR" ]; then
echo "Offline mode: Some files are missing, please disable offline mode." echo "Offline mode: Some files are missing, please disable offline mode"
exit 1 exit 1
fi fi
require_su
fi fi
if [ "$HAS_GAPPS" ] || [ "$ROOT_SOL" = "magisk" ]; then if [ "$HAS_GAPPS" ] || [ "$ROOT_SOL" = "magisk" ]; then
echo "Extract Magisk" echo "Extracting Magisk"
if [ -f "$MAGISK_PATH" ]; then if [ -f "$MAGISK_PATH" ]; then
MAGISK_VERSION_NAME="" MAGISK_VERSION_NAME=""
MAGISK_VERSION_CODE=0 MAGISK_VERSION_CODE=0
@ -486,17 +475,29 @@ if [ "$HAS_GAPPS" ] || [ "$ROOT_SOL" = "magisk" ]; then
echo -e "done\n" echo -e "done\n"
fi fi
if [ "$ROOT_SOL" = "magisk" ]; then if [ "$HAS_GAPPS" ] || [ "$ROOT_SOL" = "magisk" ]; then
echo "Integrate Magisk" echo "Integrating Magisk"
"$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk64" "$WORK_DIR/magisk/magisk64.xz" "$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk64" "$WORK_DIR/magisk/magisk64.xz"
"$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk32" "$WORK_DIR/magisk/magisk32.xz" "$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk32" "$WORK_DIR/magisk/magisk32.xz"
"$WORK_DIR/magisk/magiskboot" compress=xz "$MAGISK_PATH" "$WORK_DIR/magisk/stub.xz" "$WORK_DIR/magisk/magiskboot" compress=xz "$MAGISK_PATH" "$WORK_DIR/magisk/stub.xz"
echo "KEEPFORCEENCRYPT=true" >>"$WORK_DIR/magisk/config" echo "KEEPFORCEENCRYPT=true" >>"$WORK_DIR/magisk/config"
echo "PREINITDEVICE=sde" >>"$WORK_DIR/magisk/config" echo "PREINITDEVICE=sde" >>"$WORK_DIR/magisk/config"
"$WORK_DIR/magisk/magiskboot" cpio "$WORK_DIR/wsa/$ARCH/Tools/initrd.img" "mv /init /wsainit" "add 0750 /lspinit ../bin/$ARCH/lspinit" "ln /lspinit /init" "add 0750 /magiskinit $WORK_DIR/magisk/magiskinit" "mkdir 0750 overlay.d" "mkdir 0750 overlay.d/sbin" "add 0644 overlay.d/sbin/magisk64.xz $WORK_DIR/magisk/magisk64.xz" "add 0644 overlay.d/sbin/magisk32.xz $WORK_DIR/magisk/magisk32.xz" "add 0644 overlay.d/sbin/stub.xz $WORK_DIR/magisk/stub.xz" "mkdir 000 .backup" "add 000 .backup/.magisk $WORK_DIR/magisk/config" || abort "Unable to patch initrd" "$WORK_DIR/magisk/magiskboot" cpio "$WORK_DIR/wsa/$ARCH/Tools/initrd.img" \
"mv /init /wsainit" \
"add 0750 /lspinit ../bin/$ARCH/lspinit" \
"ln /lspinit /init" \
"add 0750 /magiskinit $WORK_DIR/magisk/magiskinit" \
"mkdir 0750 overlay.d" \
"mkdir 0750 overlay.d/sbin" \
"add 0644 overlay.d/sbin/magisk64.xz $WORK_DIR/magisk/magisk64.xz" \
"add 0644 overlay.d/sbin/magisk32.xz $WORK_DIR/magisk/magisk32.xz" \
"add 0644 overlay.d/sbin/stub.xz $WORK_DIR/magisk/stub.xz" \
"mkdir 000 .backup" \
"add 000 .backup/.magisk $WORK_DIR/magisk/config" \
|| abort "Unable to patch initrd"
echo -e "Integrate Magisk done\n" echo -e "Integrate Magisk done\n"
elif [ "$ROOT_SOL" = "kernelsu" ]; then elif [ "$ROOT_SOL" = "kernelsu" ]; then
echo "Extract KernelSU" echo "Extracting KernelSU"
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${KERNELSU_INFO:?}" || abort source "${KERNELSU_INFO:?}" || abort
echo "WSA Kernel Version: $KERNEL_VER" echo "WSA Kernel Version: $KERNEL_VER"
@ -516,27 +517,22 @@ elif [ "$ROOT_SOL" = "kernelsu" ]; then
echo -e "done\n" echo -e "done\n"
fi fi
if [ "$HAS_GAPPS" ] && [ "$ROOT_SOL" != "magisk" ]; then
"$WORK_DIR/magisk/magiskboot" cpio "$WORK_DIR/wsa/$ARCH/Tools/initrd.img" "mv /init /wsainit" "add 0750 /lspinit ../bin/$ARCH/lspinit" "ln /lspinit /init" || abort "Unable to patch initrd"
fi
if [ "$HAS_GAPPS" ]; then if [ "$HAS_GAPPS" ]; then
update_gapps_file_name update_gapps_file_name
if [ -f "$GAPPS_PATH" ]; then if [ -f "$GAPPS_PATH" ]; then
if ! unzip -t "$GAPPS_PATH"; then echo "Integrating GApps"
CLEAN_DOWNLOAD_GAPPS=1 "$WORK_DIR/magisk/magiskboot" cpio "$WORK_DIR/wsa/$ARCH/Tools/initrd.img" \
abort "Unzip GApps failed, package is corrupted?" "add 000 overlay.d/init.lsp.cust.rc init.lsp.cust.rc" \
fi "add 000 overlay.d/sbin/cust.img $GAPPS_PATH" \
echo "Integrate GApps" || abort "Unable to patch initrd"
cp "$GAPPS_PATH" "$WORK_DIR/wsa/$ARCH/apex/" || abort
echo -e "done\n" echo -e "done\n"
else else
abort "The GApps package does not exist." abort "The GApps package does not exist."
fi fi
fi fi
echo "Remove signature and add scripts" echo "Removing signature and add scripts"
sudo rm -rf "${WORK_DIR:?}"/wsa/"$ARCH"/\[Content_Types\].xml "$WORK_DIR/wsa/$ARCH/AppxBlockMap.xml" "$WORK_DIR/wsa/$ARCH/AppxSignature.p7x" "$WORK_DIR/wsa/$ARCH/AppxMetadata" || abort rm -rf "${WORK_DIR:?}"/wsa/"$ARCH"/\[Content_Types\].xml "$WORK_DIR/wsa/$ARCH/AppxBlockMap.xml" "$WORK_DIR/wsa/$ARCH/AppxSignature.p7x" "$WORK_DIR/wsa/$ARCH/AppxMetadata" || abort
cp "$vclibs_PATH" "$xaml_PATH" "$WORK_DIR/wsa/$ARCH" || abort cp "$vclibs_PATH" "$xaml_PATH" "$WORK_DIR/wsa/$ARCH" || abort
cp "$UWPVCLibs_PATH" "$xaml_PATH" "$WORK_DIR/wsa/$ARCH" || abort cp "$UWPVCLibs_PATH" "$xaml_PATH" "$WORK_DIR/wsa/$ARCH" || abort
cp "../bin/$ARCH/makepri.exe" "$WORK_DIR/wsa/$ARCH" || abort cp "../bin/$ARCH/makepri.exe" "$WORK_DIR/wsa/$ARCH" || abort
@ -547,8 +543,7 @@ cp ../installer/Run.bat "$WORK_DIR/wsa/$ARCH" || abort
find "$WORK_DIR/wsa/$ARCH" -maxdepth 1 -mindepth 1 -printf "%P\n" >"$WORK_DIR/wsa/$ARCH/filelist.txt" || abort find "$WORK_DIR/wsa/$ARCH" -maxdepth 1 -mindepth 1 -printf "%P\n" >"$WORK_DIR/wsa/$ARCH/filelist.txt" || abort
echo -e "Remove signature and add scripts done\n" echo -e "Remove signature and add scripts done\n"
echo "Generate info" echo "Generating info"
if [[ "$ROOT_SOL" = "none" ]]; then if [[ "$ROOT_SOL" = "none" ]]; then
name1="" name1=""
elif [ "$ROOT_SOL" = "magisk" ]; then elif [ "$ROOT_SOL" = "magisk" ]; then
@ -566,7 +561,7 @@ artifact_name=WSA_${WSA_VER}_${ARCH}_${WSA_REL}${name1}${name2}
echo "$artifact_name" echo "$artifact_name"
echo -e "\nFinishing building...." echo -e "\nFinishing building...."
if [ -f "$OUTPUT_DIR" ]; then if [ -f "$OUTPUT_DIR" ]; then
sudo rm -rf ${OUTPUT_DIR:?} rm -rf ${OUTPUT_DIR:?}
fi fi
if [ ! -d "$OUTPUT_DIR" ]; then if [ ! -d "$OUTPUT_DIR" ]; then
mkdir -p "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR"
@ -593,8 +588,4 @@ else
rm -rf "${OUTPUT_PATH:?}" || abort rm -rf "${OUTPUT_PATH:?}" || abort
cp -r "$WORK_DIR/wsa/$ARCH" "$OUTPUT_PATH" || abort cp -r "$WORK_DIR/wsa/$ARCH" "$OUTPUT_PATH" || abort
fi fi
echo -e "done\n"
echo "Cleanup Work Directory"
sudo rm -rf "${WORK_DIR:?}"
echo "done" echo "done"

View file

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This file is part of MagiskOnWSALocal.
MagiskOnWSALocal is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
MagiskOnWSALocal is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with MagiskOnWSALocal. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2023 LSPosed Contributors
-->
<config>
<component-override package="com.android.vending">
<!-- Conflicts with WSA's built-in package verifier, disable to prevent boot loops. -->
<component class="com.google.android.finsky.verifier.impl.PackageVerificationReceiver" enabled="false" />
<!-- Disable stock OTA components if installed -->
<component class="com.google.android.finsky.systemupdate.SystemUpdateSettingsContentProvider" enabled="false" />
<component class="com.google.android.finsky.systemupdateactivity.SettingsSecurityEntryPoint" enabled="false" />
<component class="com.google.android.finsky.systemupdateactivity.SystemUpdateActivity" enabled="false" />
</component-override>
<component-override package="com.google.android.gms">
<component class="com.google.android.gms.update.phone.PopupDialog" enabled="false" />
<component class="com.google.android.gms.update.OtaSuggestionSummaryProvider" enabled="false" />
<component class="com.google.android.gms.update.SystemUpdateActivity" enabled="false" />
<component class="com.google.android.gms.update.SystemUpdateGcmTaskService" enabled="false" />
<component class="com.google.android.gms.update.SystemUpdateService" enabled="false" />
</component-override>
</config>