diff options
Diffstat (limited to 'scripts/configs')
| -rwxr-xr-x | scripts/configs/main.sh | 20 | ||||
| -rwxr-xr-x | scripts/configs/modify_configs.sh | 57 | ||||
| -rwxr-xr-x | scripts/configs/remove_configs.sh | 95 |
3 files changed, 172 insertions, 0 deletions
diff --git a/scripts/configs/main.sh b/scripts/configs/main.sh new file mode 100755 index 0000000..55ebc46 --- /dev/null +++ b/scripts/configs/main.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ "$#" -ne 2 ]; then + echo "[x] Incorrect arguments!" + echo " Using: $0 <BASE_DIR> <TMP_DIR>" + exit 1 +fi + +BASE_DIR=$1 +TMP_DIR=$2 +SCRIPT_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")") + +cp -L "$TMP_DIR/res/configs/preferred-apps/preferred-apps-driedlamu.xml" "${BASE_DIR}"/product_a/etc/preferred-apps +./utils/scripts/add_to_fs.sh product_a "preferred-apps-driedlamu.xml" etc/preferred-apps 1 + +cp -L -r "$TMP_DIR/res/configs/sysconfig/app.lawnchair-hiddenapi-package-whitelist.xml" "${BASE_DIR}/product_a/etc/sysconfig" +./utils/scripts/add_to_fs.sh product_a app.lawnchair-hiddenapi-package-whitelist.xml etc/sysconfig + +"${SCRIPT_DIR}"/modify_configs.sh "$BASE_DIR" +"${SCRIPT_DIR}"/remove_configs.sh "$BASE_DIR" diff --git a/scripts/configs/modify_configs.sh b/scripts/configs/modify_configs.sh new file mode 100755 index 0000000..d400346 --- /dev/null +++ b/scripts/configs/modify_configs.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +if [ "$#" -ne 1 ]; then + echo "[x] Incorrect arguments!" + echo " Using: $0 <BASE_DIR>" + exit 1 +fi + +BASE_DIR=$1 + +SYSTEM_DIR="${BASE_DIR}/system_a" +PRODUCT_DIR="${BASE_DIR}/product_a" +SYSTEM_EXT_DIR="${BASE_DIR}/system_ext_a" + +modify_default_assistant() { + local apk_name="GmsConfigOverlayGSA" + local apk_location="${PRODUCT_DIR}/overlay" + local working_dir="/tmp/driedlamu/modify_apk/${apk_name}/decompile" + local assistant_package_name="me.kasesag.driedlamu.assistant" + + ./utils/scripts/modify_apk.sh unpack "$apk_location"/${apk_name}.apk + xml ed -L -u "/resources/string[@name='config_defaultAssistant']" -v "${assistant_package_name}" "$working_dir/res/values/strings.xml" + ./utils/scripts/modify_apk.sh repack "$apk_location"/${apk_name}.apk "$apk_location" +} + +modify_default_launcher() { + local apk_name="LauncherFrameworkRRO" + local apk_location="${PRODUCT_DIR}/overlay" + local working_dir="/tmp/driedlamu/modify_apk/${apk_name}/decompile" + local launcher_package_name="app.lawnchair" + + ./utils/scripts/modify_apk.sh unpack "$apk_location"/${apk_name}.apk + sed -i "s/com.motorola.launcher3/${launcher_package_name}/g" "$working_dir/res/values/strings.xml" + ./utils/scripts/modify_apk.sh repack "$apk_location"/${apk_name}.apk "$apk_location" +} + +echo "[=] Modifying default assistant to 'me.kasesag.driedlamu.asistant'" +modify_default_assistant + +echo "[=] Modifying default launcher activity to 'app.lawnchair'" +modify_default_launcher + +echo "[=] Writing an empty config to ${SYSTEM_DIR}/system/etc/sysconfig/enable-disable-preload-apps.xml" +echo -e '<?xml version="1.0" encoding="utf-8"?>\n<config>\n\n</config>' > "${SYSTEM_DIR}/system/etc/sysconfig/enable-disable-preload-apps.xml" +./utils/scripts/add_to_fs.sh system_a "enable-disable-preload-apps.xml" system/etc/sysconfig + +echo "[=] Writing an empty config to ${SYSTEM_DIR}/system/etc/appmanager.conf" +touch "${SYSTEM_DIR}/system/etc/appmanager.conf" +./utils/scripts/add_to_fs.sh system_a "appmanager.conf" system/etc + +echo "[=] Patching 'system_ext_property_contexts' in ${SYSTEM_EXT_DIR}/etc/selinux/system_ext_property_contexts" +sed -i -e "/facebook/d" \ + -e "/spotify/d" \ + -e "/booking/d" \ + -e "/inmobi/d" \ + -e "/zero_touch/d" \ + "${SYSTEM_EXT_DIR}/etc/selinux/system_ext_property_contexts"
\ No newline at end of file diff --git a/scripts/configs/remove_configs.sh b/scripts/configs/remove_configs.sh new file mode 100755 index 0000000..6940b2e --- /dev/null +++ b/scripts/configs/remove_configs.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +if [ "$#" -ne 1 ]; then + echo "[x] Incorrect arguments!" + echo " Using: $0 <BASE_DIR>" + exit 1 +fi + +BASE_DIR=$1 + +SYSTEM_DIR="${BASE_DIR}/system_a" +PRODUCT_DIR="${BASE_DIR}/product_a" +SYSTEM_EXT_DIR="${BASE_DIR}/system_ext_a" + +REMOVE_CONFIGS=( + "${PRODUCT_DIR}/etc/sysconfig/bugreport-whitelist-com.motorola.help.xml" + "${PRODUCT_DIR}/etc/sysconfig/hiddenapi-whitelist-com.motorola.gamemode.xml" + "${PRODUCT_DIR}/etc/sysconfig/hiddenapi-whitelist-com.motorola.help.xml" + "${PRODUCT_DIR}/etc/sysconfig/hiddenapi-whitelist-com.motorola.timeweatherwidget.xml" + "${PRODUCT_DIR}/etc/sysconfig/preinstalled-packages-platform-overlays.xml" + "${PRODUCT_DIR}/etc/sysconfig/shortcut-com.motorola.gamemode.xml" + "${PRODUCT_DIR}/etc/sysconfig/whitelist_com.dti.motorola.xml" + "${PRODUCT_DIR}/etc/preferred-apps/google.xml" + "${PRODUCT_DIR}/etc/tn_app_delay.xml" + "${PRODUCT_DIR}/etc/perf_config_common.xml" + + "${SYSTEM_EXT_DIR}/etc/init/init.spotifyprops.rc" + "${SYSTEM_EXT_DIR}/etc/sysconfig/com.motorola.ccc.devicemanagement.powersave.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/com.motorola.ccc.mainplm.powersave.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/com.motorola.ccc.notification.powersave.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/com.motorola.installer.powersave.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/com.motorola.paks.powersave.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/hiddenapi-allowlist-com.motorola.paks.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/hiddenapi-whitelist-com.motorola.ccc.devicemanagement.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/hiddenapi-whitelist-com.motorola.ccc.notification.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/hiddenapi-whitelist-com.motorola.demo.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/hiddenapi-whitelist-com.motorola.livewallpaper.xml" + # "${SYSTEM_EXT_DIR}/etc/sysconfig/hiddenapi-whitelist-com.motorola.securevault.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/hiddenapi-whitelist-com.motorola.launcher3.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/initial-package-stopped-states-com.motorola.securityhub.xml" + "${SYSTEM_EXT_DIR}/etc/sysconfig/whitelist_com.motorola.motocare.xml" + "${SYSTEM_EXT_DIR}/etc/nondisable/com.motorola.ccc.devicemanagement.nondisable.xml" + "${SYSTEM_EXT_DIR}/etc/nondisable/com.motorola.installer.xml" + "${SYSTEM_EXT_DIR}/etc/enable-disable-packages/enable-disable-com.motorola.installer.xml" + + "${SYSTEM_DIR}/system/etc/sysconfig/facebook-hiddenapi-package-allowlist.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/hiddenapi-moto-ota-package-whitelist.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/hiddenapi-whitelist-com.motorola.brapps.xml" + "${SYSTEM_DIR}/system/etc/enable-disable-packages/enable-disable-com.motorola.brapps.xml" + "${SYSTEM_DIR}/system/etc/enable-disable-packages/enable-disable-com.motorola.enterprise.adapter.service.xml" + + "${SYSTEM_DIR}/system/etc/init/facebook-appmanager.rc" + "${SYSTEM_DIR}/system/etc/sysconfig/afw-com.aura.oobe.motorola.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/afw-com.dti.motorola.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/afw-com.inmobi.installer.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/business-edition-disabled-apps.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/com.motorola.brapps.powersave.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/com.motorola.enterprise.adapter.service.powersave.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/hiddenapi-whitelist-cco.sitic.pp.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/hiddenapi-whitelist-com.android.providers.partnerbookmarks.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/hiddenapi-whitelist-com.motorola.android.providers.chromehomepage.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/hiddenapi-whitelist-moto.xml" # MotoOTA package + "${SYSTEM_DIR}/system/etc/sysconfig/initial-package-stopped-states-orange.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/meta-hiddenapi-package-allowlist.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/sysconfig-orange.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/whitelist_aura.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/whitelist_com.claroColombia.contenedor.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/whitelist_com.ironsource.appcloud.oobe.hutchison.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/whitelist_com.motorola.spaces.xml" + "${SYSTEM_DIR}/system/etc/sysconfig/whitelist_com.telcel.contenedor.xml" + "${SYSTEM_DIR}/system/etc/appmanager.conf" +) + +REMOVE_DIRS=( + "${PRODUCT_DIR}/media-poland-play" + "${PRODUCT_DIR}/etc/sku_RU" + "${PRODUCT_DIR}/etc/sku_INDIA" + "${PRODUCT_DIR}/etc/sku_EEA" + "${PRODUCT_DIR}/etc/motorola" + "${PRODUCT_DIR}/etc/MotoDesktopAppConfig" + + # "${SYSTEM_DIR}/system/etc/duraspeed" +) + +echo "[i] Removing system configs..." +for config in "${REMOVE_CONFIGS[@]}"; do + echo -e "\t[-] ${config}" + rm -rf "$config" +done + +echo "[i] Removing system directories..." +for config in "${REMOVE_DIRS[@]}"; do + echo -e "\t[-] ${config}" + rm -rf "$config" +done |
