2021-03-22 19:59:15 -04:00
|
|
|
#!/bin/bash
|
2024-04-22 07:48:54 -04:00
|
|
|
#DivestOS: A mobile operating system divested from the norm.
|
|
|
|
#Copyright (c) 2017-2023 Divested Computing Group
|
2021-03-22 19:59:15 -04:00
|
|
|
#
|
|
|
|
#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/>.
|
2021-10-16 19:15:19 -04:00
|
|
|
umask 0022;
|
2021-10-16 15:28:15 -04:00
|
|
|
set -euo pipefail;
|
2021-10-16 19:15:19 -04:00
|
|
|
source "$DOS_SCRIPTS_COMMON/Shell.sh";
|
2021-03-22 19:59:15 -04:00
|
|
|
|
|
|
|
#Updates select user facing strings
|
2021-10-16 16:28:41 -04:00
|
|
|
#Last verified: 2021-10-16
|
2021-03-22 19:59:15 -04:00
|
|
|
|
|
|
|
echo "Rebranding...";
|
|
|
|
|
2021-07-08 20:41:33 -04:00
|
|
|
if enter "bootable/recovery"; then
|
2021-03-29 17:09:12 -04:00
|
|
|
git revert --no-edit c4071b4f; #use standard animation
|
2021-03-22 19:59:15 -04:00
|
|
|
awk -i inplace '!/DrawSurface\(logo.get\(\)/' recovery_ui/screen_ui.cpp; #Hide logo
|
|
|
|
mogrify -format png -fill "#FF5722" -opaque "#167C80" -fuzz 10% res-*/images/*sel.png; #Recolor icons
|
|
|
|
mogrify -format png -fill "#FF5722" -opaque "#7c4dff" -fuzz 10% res-*/images/ic_back_sel.png;
|
|
|
|
sed -i 's|0x7c, 0x4d, 0xff|0xff, 0x57, 0x22|' recovery_ui/*ui.cpp; #Recolor accents (recovery primary)
|
2022-04-18 17:42:32 -04:00
|
|
|
sed -i 's|0xf8, 0x90, 0xff|0xff, 0x98, 0x00|' recovery_ui/*ui.cpp; #Recolor accents (recovery secondary)
|
2021-03-22 19:59:15 -04:00
|
|
|
sed -i 's|0xe6, 0x51, 0x00|0x4c, 0xaf, 0x50|' recovery_ui/*ui.cpp; #Recolor accents (fastboot primary)
|
|
|
|
sed -i 's|0xfd, 0xd8, 0x35|0x8b, 0xc3, 0x4a|' recovery_ui/*ui.cpp; #Recolor accents (fastboot secondary)
|
|
|
|
sed -i 's|0xfd, 0xd8,0x35|0x8b, 0xc3, 0x4a|' recovery_ui/*ui.cpp; #Recolor accents (fastboot secondary typo)
|
|
|
|
sed -i 's|0x16, 0x7c, 0x80|0x03, 0xa9, 0xf4|' recovery_ui/*ui.cpp; #Recolor text
|
|
|
|
sed -i 's|Android Recovery|'"$DOS_BRANDING_NAME"' Recovery|' recovery_ui/*ui.cpp;
|
|
|
|
sed -i 's|LineageOS|'"$DOS_BRANDING_NAME"'|' recovery_ui/*ui.cpp;
|
|
|
|
sed -i 's|Lineage |'"$DOS_BRANDING_NAME"' |' recovery.cpp;
|
2021-07-08 20:41:33 -04:00
|
|
|
fi;
|
2021-03-22 19:59:15 -04:00
|
|
|
|
2021-07-08 20:41:33 -04:00
|
|
|
if enter "build/make"; then
|
2021-03-22 19:59:15 -04:00
|
|
|
sed -i 's|echo "ro.build.user=$BUILD_USERNAME"|echo "ro.build.user=emy"|' tools/buildinfo.sh; #Override build user
|
|
|
|
sed -i 's|echo "ro.build.host=$BUILD_HOSTNAME"|echo "ro.build.host=dosbm"|' tools/buildinfo.sh; #Override build host
|
2021-07-08 20:41:33 -04:00
|
|
|
fi;
|
2021-03-22 19:59:15 -04:00
|
|
|
|
2021-07-08 20:41:33 -04:00
|
|
|
if enter "frameworks/base"; then
|
2021-03-22 19:59:15 -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;
|
2021-03-22 19:59:15 -04:00
|
|
|
|
2021-07-08 20:41:33 -04:00
|
|
|
if enter "lineage-sdk"; then
|
2021-03-22 19:59:15 -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;
|
2021-03-22 19:59:15 -04:00
|
|
|
|
2021-07-08 20:41:33 -04:00
|
|
|
if enter "packages/apps/LineageParts"; then
|
2021-03-22 19:59:15 -04:00
|
|
|
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;
|
|
|
|
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;
|
2021-03-22 19:59:15 -04:00
|
|
|
|
2021-07-08 20:41:33 -04:00
|
|
|
if enter "packages/apps/Settings"; then
|
2021-03-22 19:59:15 -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-03-22 19:59:15 -04:00
|
|
|
|
2021-07-08 20:41:33 -04:00
|
|
|
if enter "packages/apps/SetupWizard"; then
|
2021-12-11 00:12:00 -05:00
|
|
|
sed -i 's|https://lineageos.org/legal|'"$DOS_BRANDING_LINK_PRIVACY"'|' src/org/lineageos/setupwizard/LineageSettingsActivity.java;
|
2021-03-22 19:59:15 -04:00
|
|
|
sed -i '/.*intro_restore/s/LineageOS/'"$DOS_BRANDING_NAME"'/' res/values*/strings.xml;
|
|
|
|
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;
|
|
|
|
sed -i '/.*update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml;
|
2021-07-08 20:41:33 -04:00
|
|
|
fi;
|
2021-03-22 19:59:15 -04:00
|
|
|
|
2021-07-08 20:41:33 -04:00
|
|
|
if enter "packages/apps/Updater"; then
|
2024-05-18 12:50:02 -04:00
|
|
|
sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
|
|
|
|
sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
|
2021-03-22 19:59:15 -04:00
|
|
|
sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml;
|
2021-04-01 10:55:23 -04:00
|
|
|
sed -i '/.*toast_forced_update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml;
|
2022-02-14 03:03:49 -05:00
|
|
|
sed -i '/.*info_dialog_message/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml;
|
2023-10-20 18:43:51 -04:00
|
|
|
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;
|
2021-03-22 19:59:15 -04:00
|
|
|
|
2022-03-19 12:41:49 -04:00
|
|
|
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
|
2021-03-22 19:59:15 -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;
|
2021-08-07 14:49:28 -04:00
|
|
|
sed -i '/.*config_mms_user_agent/s/LineageOS/'"$DOS_BRANDING_NAME"'/g' overlay/common/frameworks/base/core/res/res/values*/config.xml
|
2021-03-22 19:59:15 -04:00
|
|
|
rm -rf bootanimation;
|
2021-07-08 20:41:33 -04:00
|
|
|
fi;
|
2021-03-22 19:59:15 -04:00
|
|
|
|
|
|
|
cd "$DOS_BUILD_BASE";
|
2021-10-16 15:28:15 -04:00
|
|
|
echo -e "\e[0;32m[SCRIPT COMPLETE] Rebranding complete\e[0m";
|