Add LiteGapps

Co-Authored-By: Syuugo <pub@s1204.me>
This commit is contained in:
sn-o-w 2024-02-16 16:45:34 +02:00
parent d44a77be84
commit 078583d2d1
4 changed files with 80 additions and 7 deletions

View file

@ -42,6 +42,7 @@
- Keep each build up to date
- Support both ARM64 and x64
- Support MindTheGapps
- Support LiteGapps
- Remove Amazon Appstore
- Fix VPN dialog not showing (use our [VpnDialogs app](https://github.com/LSPosed/VpnDialogs))
- Add device administration feature
@ -65,10 +66,11 @@
6. Select the version of Magisk.
7. Choose which brand of GApps you want to install:
- MindTheGapps
- LiteGapps
There is no other variant we can choose.
There is no other variant we can choose from MindTheGapps.
8. Select the root solution (none means no root).
9. If you are running the script for the first time, it will take some time to complete. After the script completes, two new folders named `output` and `download` will be generated in the `MagiskOnWSALocal` folder. Go to the `output` folder. While running the `./run.sh` script in the step 3, if you selected `Yes` for `Do you want to compress the output?` then in `output` folder you will see a compressed file called `WSA-with-magisk-stable-MindTheGapps_2207.40000.8.0_x64_Release-Nightly`or else there will be folder with the `WSA-with-magisk-stable-MindTheGapps_2207.40000.8.0_x64_Release-Nightly`. If there is a folder open it and skip to step 10. NOTE: The name of compressed file or the folder generated in the `output` folder may be different for you. It will be dependent on the choices made when executing `./run.sh`.
9. If you are running the script for the first time, it will take some time to complete. After the script completes, two new folders named `output` and `download` will be generated in the `MagiskOnWSALocal` folder. Go to the `output` folder. While running the `./run.sh` script in the step 3, if you selected `Yes` for `Do you want to compress the output?`, you will find a compressed file in the `output` folder. Depending on the GApps brand you chose earlier, the compressed file will be named either `WSA-with-magisk-stable-MindTheGapps_2311.40000.5.0_x64_Release-Nightly` or `WSA-with-magisk-stable-LiteGapps_2311.40000.5.0_x64_Release-Nightly`. Otherwise, there will be a folder with any of these names. If a folder exists, open it and proceed to step 10. NOTE: The name of the compressed file or the folder generated in the `output` folder may be a little bit different for you, depending on the choices you made when executing `./run.sh`.
10. Extract the compressed file and open the folder created after the extraction of the file.
11. Here look for file `Run.bat` and run it.
- If you previously have a MagiskOnWSA installation, it will automatically uninstall the previous one while **preserving all user data** and install the new one, so don't worry about your data.
@ -151,13 +153,17 @@
Or you can download the built package for 12.1 and 13 for x86_64 from [this page](https://sourceforge.net/projects/wsa-mtg/files/x86_64/).
- Can I switch OpenGApps to MindTheGapps and keep user data in a previous build?
- Where can I download LiteGapps?
You can download the built packages for multiple Android versions for x86_64 from [this page](https://sourceforge.net/projects/litegapps/files/litegapps/x86_64/).
- Can I switch OpenGApps to MindTheGapps or LiteGapps and keep user data in a previous build?
No. You should wipe data after changing the GApps brand. Otherwise, you will find that the installed GApps are not recognized.
- WSA with OpenGApps integrated fails to start.
OpenGApps has not yet released a version built for Android 12L and 13, only built for Android 11, which may not be compatible and thus cause crashes. Consider switching to MindTheGapps.
OpenGApps has not yet released a version built for Android 12L and 13, only built for Android 11, which may not be compatible and thus cause crashes. Consider switching to MindTheGapps or LiteGapps.
- How to install KernelSU?
@ -172,6 +178,7 @@
- [StoreLib](https://github.com/StoreDev/StoreLib): API for downloading WSA
- [Magisk](https://github.com/topjohnwu/Magisk): The most famous root solution on Android
- [The Open GApps Project](https://opengapps.org): One of the most famous Google Apps packages solution
- [LiteGapps](https://litegapps.github.io): A compact, user-friendly, and comprehensive custom GApps package
- [WSA-Kernel-SU](https://github.com/LSPosed/WSA-Kernel-SU) and [kernel-assisted-superuser](https://git.zx2c4.com/kernel-assisted-superuser/): The kernel `su` for debugging Magisk Integration
- [WSAGAScript](https://github.com/ADeltaX/WSAGAScript): The first GApps integration script for WSA
- [erofs-utils](https://github.com/sekaiacg/erofs-utils): Pre-build `erofs-utils` with erofsfuse enabled

View file

@ -257,6 +257,7 @@ MAGISK_VER_MAP=(
GAPPS_BRAND_MAP=(
"OpenGApps"
"MindTheGapps"
"LiteGapps"
"none"
)
@ -270,6 +271,12 @@ GAPPS_VARIANT_MAP=(
"pico"
"tvstock"
"tvmini"
"pixel"
"basic"
"user"
"go"
"core"
"lite"
)
ROOT_SOL_MAP=(
@ -483,6 +490,8 @@ update_gapps_zip_name() {
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
ANDROID_API=30
GAPPS_ZIP_NAME=$GAPPS_BRAND-$ARCH-${ANDROID_API_MAP[$ANDROID_API]}-$GAPPS_VARIANT.zip
elif [ "$GAPPS_BRAND" = "LiteGapps" ]; then
GAPPS_ZIP_NAME=$GAPPS_BRAND-$ARCH-${ANDROID_API_MAP[$ANDROID_API]}-$GAPPS_VARIANT.zip
else
GAPPS_ZIP_NAME=$GAPPS_BRAND-$ARCH-${ANDROID_API_MAP[$ANDROID_API]}.zip
fi
@ -639,6 +648,19 @@ if [ "$GAPPS_BRAND" != 'none' ]; then
CLEAN_DOWNLOAD_GAPPS=1
abort "Unzip OpenGApps failed, is the download incomplete?"
fi
elif [ "$GAPPS_BRAND" = "LiteGapps" ]; then
if ! unzip -p "$GAPPS_PATH" files/files.tar.xz | tar -xJf - -C "$WORK_DIR/gapps" --strip-components=3 "x86_64/${ANDROID_API}/system"; then
CLEAN_DOWNLOAD_GAPPS=1
abort "Unzip LiteGapps failed, is the download incomplete?"
fi
if unzip -l "$GAPPS_PATH" | grep -q "modules/"; then
for module_zip in $(unzip -l "$GAPPS_PATH" | awk '/modules\/.*\.zip/ && !/[-_]MarkupGoogle|[-_]PixelLauncher|[-_]PixelSetupWizard|[-_]SetupWizard/ { print $4 }'); do
unzip -j -o "$GAPPS_PATH" "$module_zip" -d "$WORK_DIR/litegapps-modules"
unzip -o "$WORK_DIR/litegapps-modules/$(basename "$module_zip")" 'system/*' -d "$WORK_DIR/litegapps-modules"
rsync -a "$WORK_DIR/litegapps-modules/system/" "$WORK_DIR/gapps/"
done
rm -rf "$WORK_DIR/litegapps-modules/"
fi
else
if ! unzip "$GAPPS_PATH" "system/*" -x "system/addon.d/*" "system/product/priv-app/VelvetTitan/*" "system/system_ext/priv-app/SetupWizard/*" -d "$WORK_DIR/gapps"; then
CLEAN_DOWNLOAD_GAPPS=1
@ -867,7 +889,7 @@ if [ "$GAPPS_BRAND" != 'none' ]; then
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
find "$WORK_DIR/gapps/" -maxdepth 1 -mindepth 1 -type d -exec sudo cp --preserve=all -r {} "$SYSTEM_MNT" \; || abort
elif [ "$GAPPS_BRAND" = "MindTheGapps" ]; then
elif [ "$GAPPS_BRAND" = "MindTheGapps" ] || [ "$GAPPS_BRAND" = "LiteGapps" ]; then
sudo cp --preserve=all -r "$WORK_DIR/gapps/system_ext/"* "$SYSTEM_EXT_MNT/" || abort
if [ -e "$SYSTEM_EXT_MNT/priv-app/SetupWizard" ]; then
rm -rf "${SYSTEM_EXT_MNT:?}/priv-app/Provision"
@ -888,6 +910,20 @@ if [ "$GAPPS_BRAND" != 'none' ]; then
find "$WORK_DIR/gapps/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/priv-app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
find "$WORK_DIR/gapps/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/etc/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
find "$WORK_DIR/gapps/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/etc/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
elif [ "$GAPPS_BRAND" = "LiteGapps" ]; then
sudo setfattr -n security.selinux -v "u:object_r:system_file:s0" "$PRODUCT_MNT/framework" || abort
find "$WORK_DIR/gapps/product/app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
find "$WORK_DIR/gapps/product/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/priv-app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
find "$WORK_DIR/gapps/product/framework/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/framework/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
find "$WORK_DIR/gapps/product/app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
find "$WORK_DIR/gapps/product/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/priv-app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
find "$WORK_DIR/gapps/product/framework/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/framework/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
find "$WORK_DIR/gapps/system_ext/etc/permissions/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_EXT_MNT/etc/permissions/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
find "$WORK_DIR/gapps/system_ext/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_EXT_MNT/priv-app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
find "$WORK_DIR/gapps/system_ext/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_EXT_MNT/etc/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
find "$WORK_DIR/gapps/system_ext/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_EXT_MNT/priv-app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
else
sudo setfattr -n security.selinux -v "u:object_r:system_file:s0" "$PRODUCT_MNT/framework" || abort
find "$WORK_DIR/gapps/product/app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
@ -981,7 +1017,7 @@ fi
if [ "$GAPPS_BRAND" = "none" ]; then
name2="-NoGApps"
else
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
if [ "$GAPPS_BRAND" = "OpenGApps" ] || [ "$GAPPS_BRAND" = "LiteGapps" ]; then
name2=-$GAPPS_BRAND-${ANDROID_API_MAP[$ANDROID_API]}-${GAPPS_VARIANT}
else
name2=-$GAPPS_BRAND-${ANDROID_API_MAP[$ANDROID_API]}

View file

@ -78,6 +78,14 @@ elif brand == "MindTheGapps":
ratelimit_reset = datetime.fromtimestamp(int(ratelimit_reset))
print(f"The current rate limit window resets in {ratelimit_reset}", flush=True)
exit(1)
elif brand == "LiteGapps":
res = requests.get(
f'https://sourceforge.net/projects/litegapps/rss?path=/litegapps/{abi_map[arch]}/{android_api}/{variant}&limit=100')
# In the past, the variant name was capitalized in the zip's filename, that's why I added "flags=re.IGNORECASE"; I'll just leave it, in case it would be necessary again in the future
matched = re.search(f'https://.*AUTO-LiteGapps-(?:{variant}-)?{abi_map[arch]}-{release}-(v[\d.]+|\d{{8}})-official\.zip/download', res.text, flags=re.IGNORECASE)
if matched:
link = matched.group().replace(
'.zip/download', '.zip').replace('sourceforge.net/projects/litegapps/files', 'downloads.sourceforge.net/project/litegapps')
print(f"download link: {link}", flush=True)

View file

@ -103,7 +103,8 @@ if (YesNoBox '([title]="Install GApps" [text]="Do you want to install GApps?")')
# GAPPS_BRAND=$(
# Radiolist '([title]="Which GApps do you want to install?"
# [default]="MindTheGapps")' \
# 'MindTheGapps' "Recommend" 'on' \
# 'LiteGapps' "GApps provided by LiteGapps" 'off' \
# 'MindTheGapps' "GApps provided by MindTheGapps" 'on' \
# 'OpenGApps' "This flavor may cause startup failure" 'off'
# )
GAPPS_BRAND="MindTheGapps"
@ -111,6 +112,27 @@ else
GAPPS_BRAND="none"
fi
if [ "$GAPPS_BRAND" = "LiteGapps" ]; then
if [ "$DEBUG" = "1" ]; then
GAPPS_VARIANT=$(
Radiolist '([title]="Variants of GApps"
[default]="lite")' \
'pixel' "" 'off' \
'micro' "" 'off' \
'nano' "" 'off' \
'basic' "" 'off' \
'user' "" 'off' \
'go' "" 'off' \
'core' "" 'off' \
'lite' "" 'on'
)
else
GAPPS_VARIANT=""
fi
else
GAPPS_VARIANT=""
fi
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
# TODO: Keep it pico since other variants of opengapps are unable to boot successfully
if [ "$DEBUG" = "1" ]; then