DivestOS/Scripts/LineageOS-15.1/Rebrand.sh

92 lines
4.5 KiB
Bash
Raw Normal View History

#!/bin/bash
#DivestOS: A mobile operating system divested from the norm.
#Copyright (c) 2017-2023 Divested Computing Group
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program 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 General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <https://www.gnu.org/licenses/>.
umask 0022;
set -euo pipefail;
source "$DOS_SCRIPTS_COMMON/Shell.sh";
#Updates select user facing strings
#Last verified: 2021-10-16
2018-04-23 08:59:18 -04:00
echo "Rebranding...";
2021-07-08 20:41:33 -04:00
if enter "bootable/recovery"; then
2020-01-08 21:22:35 -05:00
git revert --no-edit bc57208dfcd0958d03a00bbcf5345be6ceac9988 6ac3bb48f9d10e604d4b2d6c4152be9d35d17ea0;
applyPatch "$DOS_PATCHES/android_bootable_recovery/0001-Remove_Logo.patch"; #Remove logo rendering code
rm res*/images/logo_image.png || true; #Remove logo images
2018-06-24 08:18:14 -04:00
mogrify -format png -fill "#FF5722" -opaque "#167C80" -fuzz 10% res-*/images/*sel.png; #Recolor icons
sed -i 's|grid_h \* 2 / 3|grid_h * 0.25|' screen_ui.cpp; #Center icons
sed -i 's|0x16, 0x7c, 0x80|0x03, 0xa9, 0xf4|' screen_ui.cpp; #Recolor text
sed -i 's|Android Recovery|'"$DOS_BRANDING_NAME"' Recovery|' ./*ui.cpp;
2018-06-29 00:55:21 -04:00
sed -i 's|LineageOS|'"$DOS_BRANDING_NAME"'|' ui.cpp;
2021-07-08 20:41:33 -04:00
fi;
2021-07-08 20:41:33 -04:00
if enter "build/make"; then
sed -i 's|echo "ro.build.user=$USER"|echo "ro.build.user=emy"|' tools/buildinfo.sh; #Override build user
sed -i 's|echo "ro.build.host=`hostname`"|echo "ro.build.host=dosbm"|' tools/buildinfo.sh; #Override build host
2021-07-08 20:41:33 -04:00
fi;
2021-07-08 20:41:33 -04:00
if enter "frameworks/base"; then
2018-06-29 00:55:21 -04:00
generateBootAnimationMask "$DOS_BRANDING_NAME" "$DOS_BRANDING_BOOTANIMATION_FONT" core/res/assets/images/android-logo-mask.png;
generateBootAnimationShine "$DOS_BRANDING_BOOTANIMATION_COLOR" "$DOS_BRANDING_BOOTANIMATION_STYLE" core/res/assets/images/android-logo-shine.png;
2021-07-08 20:41:33 -04:00
fi;
2018-06-24 04:26:59 -04:00
2021-07-08 20:41:33 -04:00
if enter "lineage-sdk"; then
2018-06-29 00:55:21 -04:00
sed -i '/.*lineage_version/s/LineageOS/'"$DOS_BRANDING_NAME"'/' lineage/res/res/values*/strings.xml;
sed -i '/.*lineage_updates/s/LineageOS/'"$DOS_BRANDING_NAME"'/' lineage/res/res/values*/strings.xml;
sed -i '/.*lineageos_system_label/s/LineageOS/'"$DOS_BRANDING_NAME"'/' lineage/res/res/values*/strings.xml;
2021-07-08 20:41:33 -04:00
fi;
2018-04-03 09:10:49 -04:00
2021-07-08 20:41:33 -04:00
if enter "packages/apps/LineageParts"; then
sed -i '/.*egg_title/s/LineageOS/'"$DOS_BRANDING_NAME"'/' res/values*/strings.xml;
sed -i '/.*lineageparts_title/s/LineageOS/'"$DOS_BRANDING_NAME"'/' res/values*/strings.xml;
sed -i '/.*privacy_settings_category/s/LineageOS/'"$DOS_BRANDING_NAME"'/' res/values*/strings.xml;
2018-06-29 00:55:21 -04:00
sed -i '/.*trust_feature_security_patches_explain/s/LineageOS/'"$DOS_BRANDING_NAME"'/' res/values*/strings.xml;
2021-07-08 20:41:33 -04:00
fi;
2018-04-22 02:41:18 -04:00
2021-07-08 20:41:33 -04:00
if enter "packages/apps/Settings"; then
2018-06-29 00:55:21 -04:00
sed -i '/.*lineagelicense_title/s/LineageOS/'"$DOS_BRANDING_NAME"'/' res/values*/cm_strings.xml;
2021-07-08 20:41:33 -04:00
fi;
2021-07-08 20:41:33 -04:00
if enter "packages/apps/SetupWizard"; then
2018-06-29 00:55:21 -04:00
sed -i 's|http://lineageos.org/legal|'"$DOS_BRANDING_LINK_PRIVACY"'|' src/org/lineageos/setupwizard/LineageSettingsActivity.java;
sed -i '/.*os_name/s/LineageOS/'"$DOS_BRANDING_NAME"'/' res/values*/strings.xml;
sed -i '/.*services/s/LineageOS/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml;
sed -i '/.*setup_services/s/LineageOS/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml;
2021-07-08 20:41:33 -04:00
fi;
2021-07-08 20:41:33 -04:00
if enter "packages/apps/Updater"; then
2018-09-20 17:41:19 -04:00
sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_BRANDING_SERVER_OTA"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|0OTA_SERVER_ONION0|'"$DOS_BRANDING_SERVER_OTA_ONION"'|' src/org/lineageos/updater/misc/Utils.java;
2018-06-29 00:55:21 -04:00
sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml;
sed -i 's|https://download.lineageos.org/<xliff:g id="device_name">%1$s</xliff:g>/changes|'"$DOS_BRANDING_LINK_NEWS"'|g' res/values*/strings.xml;
2021-07-08 20:41:33 -04:00
fi;
if enter "system/core"; then
sed -i 's/LineageOS/'"$DOS_BRANDING_NAME"'/' debuggerd/libdebuggerd/tombstone.cpp;
fi;
2021-07-08 20:41:33 -04:00
if enter "vendor/lineage"; then
2018-06-29 00:55:21 -04:00
sed -i 's|https://lineageos.org/legal|'"$DOS_BRANDING_LINK_ABOUT"'|' build/core/main_version.mk
sed -i '/.*ZIPPATH=/s/lineage/'"$DOS_BRANDING_ZIP_PREFIX"'/' build/envsetup.sh;
sed -i '/LINEAGE_TARGET_PACKAGE/s/lineage/'"$DOS_BRANDING_ZIP_PREFIX"'/' build/tasks/bacon.mk;
sed -i '/.*config_mms_user_agent/s/LineageOS/'"$DOS_BRANDING_NAME"'/g' overlay/common/frameworks/base/core/res/res/values*/config.xml
2018-06-24 04:26:59 -04:00
rm -rf bootanimation;
2021-07-08 20:41:33 -04:00
fi;
2018-06-29 00:55:21 -04:00
cd "$DOS_BUILD_BASE";
echo -e "\e[0;32m[SCRIPT COMPLETE] Rebranding complete\e[0m";