Skip to content

Commit

Permalink
Add new GApps brand: LiteGapps
Browse files Browse the repository at this point in the history
  • Loading branch information
s1204IT committed Feb 1, 2024
1 parent 9da6a3d commit 7050989
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/custom_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ on:
type: choice
description: Google Apps brand
required: true
options: ["MindTheGapps v13.0","No GApps"]
options: ["MindTheGapps v13.0","LiteGapps", "No GApps"]
default: "MindTheGapps v13.0"
custom_model:
type: choice
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
- name: Build WSA 🏗️
id: wsa
run: |
declare -A opts=( ["RELEASE_TYPE,Retail"]="retail" ["RELEASE_TYPE,Release Preview"]="RP" ["RELEASE_TYPE,Insider Slow"]="WIS" ["RELEASE_TYPE,Insider Fast"]="WIF" ["RELEASE_TYPE,Insider Private"]="latest" ["ROOT_SOL,Magisk Official"]="topjohnwu" ["ROOT_SOL,Magisk Delta (HuskyDG)"]="HuskyDG" ["ROOT_SOL,Magisk Alpha (vvb2060)"]="vvb2060" ["ROOT_SOL,KernelSU"]="kernelsu" ["ROOT_SOL,Non-root"]="none" ["MAGISK_TYPE,Magisk Stable"]="stable" ["MAGISK_TYPE,Magisk Beta"]="beta" ["MAGISK_TYPE,Magisk Canary"]="canary" ["MAGISK_TYPE,Magisk Debug"]="debug" ["GAPPS_BRAND,MindTheGapps v13.0"]="MindTheGapps" ["GAPPS_BRAND,No GApps"]="none" ["CUSTOM_MODEL,WSA Default"]="none" ["CUSTOM_MODEL,Pixel 4a"]="sunfish" ["CUSTOM_MODEL,Pixel 4a (5G)"]="bramble" ["CUSTOM_MODEL,Pixel 5"]="redfin" ["CUSTOM_MODEL,Pixel 5a"]="barbet" ["CUSTOM_MODEL,Pixel 6 Pro"]="raven" ["CUSTOM_MODEL,Pixel 6"]="oriole" ["CUSTOM_MODEL,Pixel 6a"]="bluejay" ["CUSTOM_MODEL,Pixel 7"]="panther" ["CUSTOM_MODEL,Pixel 7 Pro"]="cheetah" ["CUSTOM_MODEL,Pixel 7a"]="lynx" ["CUSTOM_MODEL,Pixel Tablet"]="tangorpro" ["CUSTOM_MODEL,Pixel Fold"]="felix" ["REMOVE_AMAZON,true"]="--remove-amazon" ["COMPRESSION,.zip"]="zip" ["COMPRESSION,.7z"]="7z" )
declare -A opts=( ["RELEASE_TYPE,Retail"]="retail" ["RELEASE_TYPE,Release Preview"]="RP" ["RELEASE_TYPE,Insider Slow"]="WIS" ["RELEASE_TYPE,Insider Fast"]="WIF" ["RELEASE_TYPE,Insider Private"]="latest" ["ROOT_SOL,Magisk Official"]="topjohnwu" ["ROOT_SOL,Magisk Delta (HuskyDG)"]="HuskyDG" ["ROOT_SOL,Magisk Alpha (vvb2060)"]="vvb2060" ["ROOT_SOL,KernelSU"]="kernelsu" ["ROOT_SOL,Non-root"]="none" ["MAGISK_TYPE,Magisk Stable"]="stable" ["MAGISK_TYPE,Magisk Beta"]="beta" ["MAGISK_TYPE,Magisk Canary"]="canary" ["MAGISK_TYPE,Magisk Debug"]="debug" ["GAPPS_BRAND,MindTheGapps v13.0"]="MindTheGapps" ["GAPPS_BRAND,LiteGapps"]="LiteGapps" ["GAPPS_BRAND,No GApps"]="none" ["CUSTOM_MODEL,WSA Default"]="none" ["CUSTOM_MODEL,Pixel 4a"]="sunfish" ["CUSTOM_MODEL,Pixel 4a (5G)"]="bramble" ["CUSTOM_MODEL,Pixel 5"]="redfin" ["CUSTOM_MODEL,Pixel 5a"]="barbet" ["CUSTOM_MODEL,Pixel 6 Pro"]="raven" ["CUSTOM_MODEL,Pixel 6"]="oriole" ["CUSTOM_MODEL,Pixel 6a"]="bluejay" ["CUSTOM_MODEL,Pixel 7"]="panther" ["CUSTOM_MODEL,Pixel 7 Pro"]="cheetah" ["CUSTOM_MODEL,Pixel 7a"]="lynx" ["CUSTOM_MODEL,Pixel Tablet"]="tangorpro" ["CUSTOM_MODEL,Pixel Fold"]="felix" ["REMOVE_AMAZON,true"]="--remove-amazon" ["COMPRESSION,.zip"]="zip" ["COMPRESSION,.7z"]="7z" )
if [[ "${{ inputs.root_sol }}" == *Magisk* ]]; then
MAGISK_BRANCH="${opts[ROOT_SOL,${{ inputs.root_sol }}]}"
Expand Down
33 changes: 22 additions & 11 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ MAGISK_VER_MAP=(

GAPPS_BRAND_MAP=(
"MindTheGapps"
"LiteGapps"
"none"
)

Expand Down Expand Up @@ -291,7 +292,7 @@ UWPVCLibs_PATH="$DOWNLOAD_DIR/Microsoft.VCLibs.140.00.UWPDesktop_$ARCH.appx"
xaml_PATH="$DOWNLOAD_DIR/Microsoft.UI.Xaml.2.8_$ARCH.appx"
MAGISK_ZIP=magisk-$MAGISK_VER.zip
MAGISK_PATH=$DOWNLOAD_DIR/$MAGISK_ZIP
GAPPS_ZIP_NAME=MindTheGapps-$ARCH-13.0.zip
GAPPS_ZIP_NAME=$GAPPS_BRAND-$ARCH.zip
GAPPS_PATH=$DOWNLOAD_DIR/$GAPPS_ZIP_NAME
WSA_MAJOR_VER=0

Expand All @@ -308,7 +309,7 @@ update_ksu_zip_name() {
KERNELSU_INFO="$KERNELSU_PATH.info"
}
update_gapps_zip_name() {
GAPPS_ZIP_NAME=MindTheGapps-$ARCH-13.0.zip
GAPPS_ZIP_NAME=$GAPPS_BRAND-$ARCH.zip
GAPPS_PATH=$DOWNLOAD_DIR/$GAPPS_ZIP_NAME
}

Expand Down Expand Up @@ -347,7 +348,7 @@ if [ "$ROOT_SOL" = "kernelsu" ]; then
fi
if [ "$GAPPS_BRAND" != "none" ]; then
update_gapps_zip_name
python3 generateGappsLink.py "$ARCH" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$GAPPS_ZIP_NAME" || abort
python3 generateGappsLink.py "$GAPPS_BRAND" "$ARCH" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$GAPPS_ZIP_NAME" || abort
fi

echo "Download Artifacts"
Expand Down Expand Up @@ -405,15 +406,23 @@ fi

if [ "$GAPPS_BRAND" != 'none' ]; then
update_gapps_zip_name
echo "Extract MindTheGapps"
echo "Extract $GAPPS_BRAND"
mkdir -p "$WORK_DIR/gapps" || abort
if [ -f "$GAPPS_PATH" ]; then
if ! unzip "$GAPPS_PATH" "system/*" -d "$WORK_DIR/gapps"; then
abort "Unzip MindTheGapps failed, package is corrupted?"
if [ "$GAPPS_BRAND" == "MindTheGapps" ]; then
if ! unzip "$GAPPS_PATH" "system/*" -d "$WORK_DIR/gapps"; then
abort "Extract $GAPPS_BRAND failed, package is corrupted?"
fi
mv "$WORK_DIR/gapps/system/"* "$WORK_DIR/gapps" || abort
else # LiteGapps
if ! unzip -p "$GAPPS_PATH" "files/files.tar.xz" | tar -xJf - -C "$WORK_DIR/gapps" --strip-components=3 "x86_64/33/system"; then
abort "Extract $GAPPS_BRAND failed, package is corrupted?"
fi
rm -rfv "$WORK_DIR/gapps/product/"{etc/permissions/com.google.android.dialer.support.xml,etc/preferred-apps,etc/sysconfig,framework}
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
mv "$WORK_DIR/gapps/system/"* "$WORK_DIR/gapps" || abort
else
abort "The MindTheGapps zip package does not exist."
abort "The $GAPPS_BRAND zip package does not exist."
fi
echo -e "Extract done\n"
fi
Expand Down Expand Up @@ -649,7 +658,9 @@ find "../cacerts/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder
echo -e "Permissions management Netfree and Netspark security certificates done\n"

if [ "$GAPPS_BRAND" != 'none' ]; then
echo "Integrate MindTheGapps"
echo "Integrate $GAPPS_BRAND"
#if [ "$GAPPS_BRAND" == "LiteGapps" ]; then sudo rm -rfv "$SYSTEM_EXT_MNT/priv-app/UserApp"; fi
if [ "$GAPPS_BRAND" == "LiteGapps" ]; then sudo sed -e '/<\/component-override>/a \ <component-override package="com.microsoft.windows.userapp" >\n <component class="com.microsoft.windows.installer.PackageVerificationReceiver" enabled="false" \/>\n <\/component-override>' -i "$SYSTEM_EXT_MNT/etc/sysconfig/component-overrides.xml"; fi
find "$WORK_DIR/gapps/" -mindepth 1 -type d -exec sudo chmod 0755 {} \;
find "$WORK_DIR/gapps/" -mindepth 1 -type d -exec sudo chown root:root {} \;
file_list="$(find "$WORK_DIR/gapps/" -mindepth 1 -type f)"
Expand Down Expand Up @@ -678,7 +689,7 @@ if [ "$GAPPS_BRAND" != 'none' ]; then
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
sudo LD_LIBRARY_PATH="../linker" "$WORK_DIR/magisk/magiskpolicy" --load "$VENDOR_MNT/etc/selinux/precompiled_sepolicy" --save "$VENDOR_MNT/etc/selinux/precompiled_sepolicy" "allow gmscore_app gmscore_app vsock_socket { create connect write read }" "allow gmscore_app device_config_runtime_native_boot_prop file read" "allow gmscore_app system_server_tmpfs dir search" "allow gmscore_app system_server_tmpfs file open" "allow gmscore_app system_server_tmpfs filesystem getattr" "allow gmscore_app gpu_device dir search" "allow gmscore_app media_rw_data_file filesystem getattr" || abort
echo -e "Integrate MindTheGapps done\n"
echo -e "Integrate $GAPPS_BRAND done\n"
fi

if [[ "$CUSTOM_MODEL" != "none" ]]; then
Expand Down Expand Up @@ -791,7 +802,7 @@ fi
if [ "$GAPPS_BRAND" = "none" ]; then
name2="-NoGApps"
else
name2=-MindTheGapps-13.0
name2="-$GAPPS_BRAND"
fi
if [[ "$MODEL_NAME" != "default" ]]; then
name3="-as-$MODEL_NAME"
Expand Down
43 changes: 26 additions & 17 deletions scripts/generateGappsLink.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,39 @@
"Accept": "application/vnd.github.v3+json",
"Authorization" : authorization,
}
arch = sys.argv[1]
arg4 = sys.argv[2]
brand = sys.argv[1]
arch = sys.argv[2]
arg4 = sys.argv[3]
download_dir = Path.cwd().parent / "download" if arg4 == "" else Path(arg4)
tempScript = sys.argv[3]
file_name = sys.argv[4]
tempScript = sys.argv[4]
file_name = sys.argv[5]
print(f"Generating MindTheGapps download link: arch={arch}", flush=True)
abi_map = {"x64": "x86_64", "arm64": "arm64"}
res = requests.get(f"https://api.github.com/repos/YT-Advanced/MindTheGappsBuilder/releases/latest", headers=reqheaders)
json_data = json.loads(res.content)
headers = res.headers
x_ratelimit_remaining = headers["x-ratelimit-remaining"]
if res.status_code == 200:
assets = json_data["assets"]
for asset in assets:
if re.match(f'.*13\\.0\\.0.{abi_map[arch]}.*.zip$', asset["name"]):
link = asset["url"]
break
elif res.status_code == 403 and x_ratelimit_remaining == '0':
message = json_data["message"]
print(f"Github API Error: {message}", flush=True)
ratelimit_reset = headers["x-ratelimit-reset"]
ratelimit_reset = datetime.fromtimestamp(int(ratelimit_reset))
print(f"The current rate limit window resets in {ratelimit_reset}", flush=True)
exit(1)
if brand == "MindTheGapps":
if res.status_code == 200:
assets = json_data["assets"]
for asset in assets:
if re.match(f'.*13\\.0\\.0.{abi_map[arch]}.*.zip$', asset["name"]):
link = asset["url"]
break
elif res.status_code == 403 and x_ratelimit_remaining == '0':
message = json_data["message"]
print(f"Github API Error: {message}", flush=True)
ratelimit_reset = headers["x-ratelimit-reset"]
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]}/33/lite&limit=100')
matched = re.search(f'https://.*AUTO-LiteGapps-{abi_map[arch]}-13.0-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

0 comments on commit 7050989

Please sign in to comment.