Skip to content

Commit

Permalink
Add LiteGapps
Browse files Browse the repository at this point in the history
Co-Authored-By: Syuugo <[email protected]>
  • Loading branch information
sn-o-w and s1204IT committed Feb 16, 2024
1 parent d44a77b commit bc5a8ac
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 7 deletions.
16 changes: 12 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -65,10 +66,12 @@
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.
At this time of writing this, for Android 13, x86-64 architecture, there are `core` and `lite` variants from LiteGapps.
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.
Expand Down Expand Up @@ -151,13 +154,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?
Expand All @@ -172,6 +179,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
Expand Down
39 changes: 37 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ MAGISK_VER_MAP=(
GAPPS_BRAND_MAP=(
"OpenGApps"
"MindTheGapps"
"LiteGapps"
"none"
)

Expand All @@ -270,6 +271,8 @@ GAPPS_VARIANT_MAP=(
"pico"
"tvstock"
"tvmini"
"core"
"lite"
)

ROOT_SOL_MAP=(
Expand Down Expand Up @@ -483,6 +486,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
Expand Down Expand Up @@ -639,6 +644,22 @@ 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
if ! grep -q '<permission name="android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS" />' "$WORK_DIR/gapps/product/etc/permissions/litegapps-permissions.xml"; then
sudo sed -e '/NOTIFY_PENDING_SYSTEM_UPDATE/i \ <permission name="android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS" />' -i "$WORK_DIR/gapps/product/etc/permissions/litegapps-permissions.xml"
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
Expand Down Expand Up @@ -867,7 +888,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"
Expand All @@ -888,6 +909,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
Expand Down Expand Up @@ -981,7 +1016,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]}
Expand Down
7 changes: 7 additions & 0 deletions scripts/generateGappsLink.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@
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')
matched = re.search(f'https://.*AUTO-LiteGapps-(?:{variant}-)?{abi_map[arch]}-{release}-v([\d.]+)-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)

Expand Down
18 changes: 17 additions & 1 deletion scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -134,6 +135,21 @@ else
GAPPS_VARIANT=""
fi

if [ "$GAPPS_BRAND" = "LiteGapps" ]; then
if [ "$DEBUG" = "1" ]; then
GAPPS_VARIANT=$(
Radiolist '([title]="Variants of GApps"
[default]="lite")' \
'core' "" 'off' \
'lite' "" 'on'
)
else
GAPPS_VARIANT=""
fi
else
GAPPS_VARIANT=""
fi

if (YesNoBox '([title]="Remove Amazon Appstore" [text]="Do you want to keep Amazon Appstore?")'); then
REMOVE_AMAZON=""
else
Expand Down

0 comments on commit bc5a8ac

Please sign in to comment.