Browse Source

Use better func names and convert ltalabel:lower

master
Felix 3 years ago
parent
commit
63e81bd54c
  1. 98
      tmp/patch_dualsim.sh

98
tmp/patch_dualsim.sh

@ -5,7 +5,7 @@ device_variant=
default_network=
# If we have system-as-root the system is mounted at /system/system in twrp
function check_if_system_as_root() {
function check_system_as_root() {
echo "Checking if system-as-root"
if [ -d ${system_path}/system ]
then
@ -14,7 +14,7 @@ function check_if_system_as_root() {
}
# Sanity check - was this patch already flashed?
function check_if_already_patched() {
function check_already_patched() {
echo "Checking if already patched"
if [ ! -z "$(cat ${system_path}/vendor/etc/vintf/manifest.xml | grep slot2)" ]
then
@ -25,9 +25,11 @@ function check_if_already_patched() {
# Detect the exact model from the LTALabel partition
# This looks something like:
# 1284-8432_5-elabel-F8332-row.html
# Output will be e.g. F8332
function get_the_LTA_Label() {
# 1284-8432_5-elabel-f8332-row.html
# Output will be e.g. f8332
# (Not 100% sure about the lowercase f8332 though,
# so use tr to convert to all-lowercase to make sure)
function get_lta_label() {
echo "Mounting LTALabel partition"
mkdir /lta-label
mount -t ext4 /dev/block/bootdevice/by-name/LTALabel /lta-label
@ -35,14 +37,15 @@ function get_the_LTA_Label() {
ls /lta-label/*.html | \
sed 's/.*-elabel-//' | \
sed 's/-.*.html//' | \
tr -d '\n\r' \
tr -d '\n\r' | \
tr '[:upper:]' '[:lower:]' \
);
umount /lta-label
rm /lta-label
echo "Device variant is ${device_variant}"
}
function get_the_default_network_from_device_variant() {
function get_default_network_from_device_variant() {
case ${device_variant} in
# voyager, pioneer, discovery, kirin(2x), mermaid(2x)
h4413|h4113|h4213|i4113|i4193|i4213|i4293)
@ -63,7 +66,7 @@ function get_the_default_network_from_device_variant() {
echo "Setting default_network to $default_network"
}
function set_the_build_prop_dual_sim_values() {
function set_build_prop_dual_sim_values() {
rm -f /tmp/build.prop
echo "persist.vendor.radio.multisim.config=dsds" >> /tmp/build.prop
echo "ro.telephony.default_network=$default_network" >> /tmp/build.prop
@ -92,71 +95,78 @@ function set_the_build_prop_dual_sim_values() {
done
}
function set_the_build_prop_device_model_values() {
function set_build_prop_device_model_values() {
sed -i "s/$1/$2/g" ${system_path}/build.prop
sed -i "s/$1/$2/g" ${system_path}/vendor/build.prop
}
# VINTF manifest patching
# Add a second instance of every needed HAL
function patch_VINTF_manifest() {
function patch_vintf_manifest() {
echo "Patching VINTF manifest"
sed -i -r 's/( +<(fqname|instance)>[^<>]*(slot)[^<>]*)1(<\/[^<>]+>)/\11\4\n\12\4/i' ${system_path}/vendor/etc/vintf/manifest.xml
sed -i -r 's/( +<(fqname|instance)>[^<>]*(hook|radio|ril|uim)[^<>]*)0(<\/[^<>]+>)/\10\4\n\11\4/i' ${system_path}/vendor/etc/vintf/manifest.xml
}
check_if_system_as_root;
check_if_already_patched;
get_the_LTA_Label;
get_the_default_network_from_device_variant;
set_the_build_prop_dual_sim_values;
check_system_as_root;
check_already_patched;
get_lta_label;
get_default_network_from_device_variant;
set_build_prop_dual_sim_values;
# griffin
set_build_prop_device_model_values j8110 j9110;
set_build_prop_device_model_values J8110 J9110;
# bahamut
set_build_prop_device_model_values j8210 j9210;
set_build_prop_device_model_values J8210 J9210;
# kirin
set_the_build_prop_device_model_values i3113 i4113;
set_the_build_prop_device_model_values I3113 I4113;
set_build_prop_device_model_values i3113 i4113;
set_build_prop_device_model_values I3113 I4113;
# mermaid
set_the_build_prop_device_model_values i3213 i4213;
set_the_build_prop_device_model_values I3213 I4213;
set_build_prop_device_model_values i3213 i4213;
set_build_prop_device_model_values I3213 I4213;
# akari
set_the_build_prop_device_model_values h8216 h8266;
set_the_build_prop_device_model_values H8216 H8266;
set_build_prop_device_model_values h8216 h8266;
set_build_prop_device_model_values H8216 H8266;
# apollo
set_the_build_prop_device_model_values h8314 h8324;
set_the_build_prop_device_model_values H8314 H8324;
set_build_prop_device_model_values h8314 h8324;
set_build_prop_device_model_values H8314 H8324;
# akatsuki
set_the_build_prop_device_model_values h8416 h9436;
set_the_build_prop_device_model_values H8416 H9436;
set_build_prop_device_model_values h8416 h9436;
set_build_prop_device_model_values H8416 H9436;
# pioneer
set_the_build_prop_device_model_values h3113 h4113;
set_the_build_prop_device_model_values H3113 H4113;
set_build_prop_device_model_values h3113 h4113;
set_build_prop_device_model_values H3113 H4113;
# discovery
set_the_build_prop_device_model_values h3213 h4213;
set_the_build_prop_device_model_values H3213 H4213;
set_build_prop_device_model_values h3213 h4213;
set_build_prop_device_model_values H3213 H4213;
# voyager
set_the_build_prop_device_model_values h3413 h4413;
set_the_build_prop_device_model_values H3413 H4413;
set_build_prop_device_model_values h3413 h4413;
set_build_prop_device_model_values H3413 H4413;
# maple
set_the_build_prop_device_model_values g8131 g8142;
set_the_build_prop_device_model_values G8131 G8142;
set_build_prop_device_model_values g8131 g8142;
set_build_prop_device_model_values G8131 G8142;
# poplar
set_the_build_prop_device_model_values g8341 g8342;
set_the_build_prop_device_model_values G8341 G8342;
set_build_prop_device_model_values g8341 g8342;
set_build_prop_device_model_values G8341 G8342;
# dora
set_the_build_prop_device_model_values f8131 f8132;
set_the_build_prop_device_model_values F8131 F8132;
set_build_prop_device_model_values f8131 f8132;
set_build_prop_device_model_values F8131 F8132;
# kagura
set_the_build_prop_device_model_values f8331 f8332;
set_the_build_prop_device_model_values F8331 F8332;
set_build_prop_device_model_values f8331 f8332;
set_build_prop_device_model_values F8331 F8332;
# keyaki
set_the_build_prop_device_model_values g8231 g8232;
set_the_build_prop_device_model_values G8231 G8232;
set_build_prop_device_model_values g8231 g8232;
set_build_prop_device_model_values G8231 G8232;
# suzu
set_the_build_prop_device_model_values f5121 f5122;
set_the_build_prop_device_model_values F5121 F5122;
set_build_prop_device_model_values f5121 f5122;
set_build_prop_device_model_values F5121 F5122;
patch_VINTF_manifest;
patch_vintf_manifest;

Loading…
Cancel
Save