Browse Source

implementing system-as-root support

Signed-off-by: Martin Dünkelmann <nc-duenkekl3@netcologne.de>
pull/3/head
Martin Dünkelmann 3 years ago
parent
commit
c494e6155d
Signed by untrusted user: MartinX3 GPG Key ID: 992977C753423FB8
  1. 182
      tmp/patch_dualsim.sh

182
tmp/patch_dualsim.sh

@ -1,12 +1,11 @@
#!/sbin/sh
sbp="/system/build.prop"
vbp="/vendor/build.prop"
svbp="/system/vendor/build.prop"
# Check whether the vendor parts lie in /system/vendor
# If /system/vendor points at vendor, we have a real /vendor partition
[[ $(readlink /system/vendor) == "/vendor" ]] && vendor_on_system=false || vendor_on_system=true
# If we have system-as-root the system is mounted at /system/system in twrp
system_path=/system
if [ -d ${system_path}/system ]
then
system_path=${system_path}/system
fi
# Sanity check - was this patch already flashed?
if $vendor_on_system
@ -39,19 +38,14 @@ variant_lower=$(\
tr -d '\n\r' \
);
variant_upper=$(\
echo $variant_lower | \
echo ${variant_lower} | \
tr '[a-z]' '[A-Z]' \
);
umount /lta-label
echo "Model variant is ${variant_upper}"
# Will be overriden later anyway
#sed -i -r "s/(ro.product.board=).+/\1${variant_upper}/" $sbp
#sed -i -r "s/(ro.product.board=).+/\1${variant_upper}/" $vbp
#sed -i -r "s/(ro.product.board=).+/\1${variant_upper}/" $svbp
case $variant_lower in
case ${variant_lower} in
# voyager, pioneer, discovery, kirin, mermaid
h4413|h4113|h4213|i4113|i4213)
default_network="9,0"
@ -74,20 +68,15 @@ echo "persist.vendor.radio.multisim.config=dsds" >> /tmp/build.prop
echo "ro.telephony.default_network=${default_network}" >> /tmp/build.prop
model=$(\
cat /system/build.prop /system/vendor/build.prop /vendor/build.prop | \
cat ${system_path}/build.prop ${system_path}/vendor/build.prop /vendor/build.prop | \
grep "ro.product.vendor.model" | \
head -n 1 \
)
model=$(echo $model | sed 's/(AOSP)/Dual (AOSP)/')
model=$(echo ${model} | sed 's/(AOSP)/Dual (AOSP)/')
echo "$model" >> /tmp/build.prop
echo "Substituting props in /system/build.prop"
if $vendor_on_system
then
echo "Substituting props in /system/vendor/build.prop"
else
echo "Substituting props in /vendor/build.prop"
fi
echo "Substituting props in ${system_path}/build.prop"
echo "Substituting props in ${system_path}/vendor/build.prop"
_ifs_backup="$IFS"
# Prevent prop names with spaces in them being split into multiple fields
@ -96,113 +85,92 @@ for prop in `cat /tmp/build.prop`
do
propname=$(echo "$prop" | cut -d '=' -f 1)
sed -i "/$propname/d" $sbp
echo "$prop" >> $sbp
if $vendor_on_system
then
sed -i "/$propname/d" $svbp
echo "$prop" >> $svbp
else
sed -i "/$propname/d" $vbp
echo "$prop" >> $vbp
fi
sed -i "/$propname/d" ${system_path}/build.prop
echo "$prop" >> ${system_path}/build.prop
sed -i "/$propname/d" ${system_path}/vendor/build.prop
echo "$prop" >> ${system_path}/vendor/build.prop
done
IFS="$_ifs_backup"
# kirin
sed -i "s/i3113/i4113/g" /system/build.prop
sed -i "s/I3113/I4113/g" /system/build.prop
sed -i "s/i3113/i4113/g" /vendor/build.prop
sed -i "s/I3113/I4113/g" /vendor/build.prop
sed -i "s/i3113/i4113/g" ${system_path}/build.prop
sed -i "s/I3113/I4113/g" ${system_path}/build.prop
sed -i "s/i3113/i4113/g" ${system_path}/vendor/build.prop
sed -i "s/I3113/I4113/g" ${system_path}/vendor/build.prop
# mermaid
sed -i "s/i3213/i4213/g" /system/build.prop
sed -i "s/I3213/I4213/g" /system/build.prop
sed -i "s/i3213/i4213/g" /vendor/build.prop
sed -i "s/I3213/I4213/g" /vendor/build.prop
sed -i "s/i3213/i4213/g" ${system_path}/build.prop
sed -i "s/I3213/I4213/g" ${system_path}/build.prop
sed -i "s/i3213/i4213/g" ${system_path}/vendor/build.prop
sed -i "s/I3213/I4213/g" ${system_path}/vendor/build.prop
# akari
sed -i "s/h8216/h8266/g" /system/build.prop
sed -i "s/H8216/H8266/g" /system/build.prop
sed -i "s/h8216/h8266/g" /vendor/build.prop
sed -i "s/H8216/H8266/g" /vendor/build.prop
sed -i "s/h8216/h8266/g" ${system_path}/build.prop
sed -i "s/H8216/H8266/g" ${system_path}/build.prop
sed -i "s/h8216/h8266/g" ${system_path}/vendor/build.prop
sed -i "s/H8216/H8266/g" ${system_path}/vendor/build.prop
# apollo
sed -i "s/h8314/h8324/g" /system/build.prop
sed -i "s/H8314/H8324/g" /system/build.prop
sed -i "s/h8314/h8324/g" /vendor/build.prop
sed -i "s/h8314/h8324/g" /vendor/build.prop
sed -i "s/h8314/h8324/g" ${system_path}/build.prop
sed -i "s/H8314/H8324/g" ${system_path}/build.prop
sed -i "s/h8314/h8324/g" ${system_path}/vendor/build.prop
sed -i "s/h8314/h8324/g" ${system_path}/vendor/build.prop
# akatsuki
sed -i "s/h8416/h9436/g" /system/build.prop
sed -i "s/H8416/H9436/g" /system/build.prop
sed -i "s/h8416/h9436/g" /vendor/build.prop
sed -i "s/h8416/h9436/g" /vendor/build.prop
sed -i "s/h8416/h9436/g" ${system_path}/build.prop
sed -i "s/H8416/H9436/g" ${system_path}/build.prop
sed -i "s/h8416/h9436/g" ${system_path}/vendor/build.prop
sed -i "s/h8416/h9436/g" ${system_path}/vendor/build.prop
# pioneer
sed -i "s/h3113/h4113/g" /system/build.prop
sed -i "s/H3113/H4113/g" /system/build.prop
sed -i "s/h3113/h4113/g" /vendor/build.prop
sed -i "s/H3113/H4113/g" /vendor/build.prop
sed -i "s/h3113/h4113/g" ${system_path}/build.prop
sed -i "s/H3113/H4113/g" ${system_path}/build.prop
sed -i "s/h3113/h4113/g" ${system_path}/vendor/build.prop
sed -i "s/H3113/H4113/g" ${system_path}/vendor/build.prop
# discovery
sed -i "s/h3213/h4213/g" /system/build.prop
sed -i "s/H3213/H4213/g" /system/build.prop
sed -i "s/h3213/h4213/g" /vendor/build.prop
sed -i "s/H3213/H4213/g" /vendor/build.prop
sed -i "s/h3213/h4213/g" ${system_path}/build.prop
sed -i "s/H3213/H4213/g" ${system_path}/build.prop
sed -i "s/h3213/h4213/g" ${system_path}/vendor/build.prop
sed -i "s/H3213/H4213/g" ${system_path}/vendor/build.prop
# voyager
sed -i "s/h3413/h4413/g" /system/build.prop
sed -i "s/H3413/H4413/g" /system/build.prop
sed -i "s/h3413/h4413/g" /vendor/build.prop
sed -i "s/H3413/H4413/g" /vendor/build.prop
sed -i "s/h3413/h4413/g" ${system_path}/build.prop
sed -i "s/H3413/H4413/g" ${system_path}/build.prop
sed -i "s/h3413/h4413/g" ${system_path}/vendor/build.prop
sed -i "s/H3413/H4413/g" ${system_path}/vendor/build.prop
# maple
sed -i "s/g8131/g8142/g" /system/build.prop
sed -i "s/G8131/G8142/g" /system/build.prop
sed -i "s/g8131/g8142/g" /system/vendor/build.prop
sed -i "s/G8131/G8142/g" /system/vendor/build.prop
sed -i "s/g8131/g8142/g" /vendor/build.prop
sed -i "s/G8131/G8142/g" /vendor/build.prop
sed -i "s/g8131/g8142/g" ${system_path}/build.prop
sed -i "s/G8131/G8142/g" ${system_path}/build.prop
sed -i "s/g8131/g8142/g" ${system_path}/vendor/build.prop
sed -i "s/G8131/G8142/g" ${system_path}/vendor/build.prop
# poplar
sed -i "s/g8341/g8342/g" /system/build.prop
sed -i "s/G8341/G8342/g" /system/build.prop
sed -i "s/g8341/g8342/g" /vendor/build.prop
sed -i "s/G8341/G8342/g" /vendor/build.prop
sed -i "s/g8341/g8342/g" ${system_path}/build.prop
sed -i "s/G8341/G8342/g" ${system_path}/build.prop
sed -i "s/g8341/g8342/g" ${system_path}/vendor/build.prop
sed -i "s/G8341/G8342/g" ${system_path}/vendor/build.prop
# dora
sed -i "s/f8131/f8132/g" /system/build.prop
sed -i "s/F8131/F8132/g" /system/build.prop
sed -i "s/f8131/f8132/g" /system/vendor/build.prop
sed -i "s/f8131/f8132/g" /system/vendor/build.prop
sed -i "s/f8131/f8132/g" /vendor/build.prop
sed -i "s/f8131/f8132/g" /vendor/build.prop
sed -i "s/f8131/f8132/g" ${system_path}/build.prop
sed -i "s/F8131/F8132/g" ${system_path}/build.prop
sed -i "s/f8131/f8132/g" ${system_path}/vendor/build.prop
sed -i "s/f8131/f8132/g" ${system_path}/vendor/build.prop
# kagura
sed -i "s/f8331/f8332/g" /system/build.prop
sed -i "s/F8331/F8332/g" /system/build.prop
sed -i "s/f8331/f8332/g" /system/vendor/build.prop
sed -i "s/F8331/F8332/g" /system/vendor/build.prop
sed -i "s/f8331/f8332/g" /vendor/build.prop
sed -i "s/F8331/F8332/g" /vendor/build.prop
sed -i "s/f8331/f8332/g" ${system_path}/build.prop
sed -i "s/F8331/F8332/g" ${system_path}/build.prop
sed -i "s/f8331/f8332/g" ${system_path}/vendor/build.prop
sed -i "s/F8331/F8332/g" ${system_path}/vendor/build.prop
# keyaki
sed -i "s/g8231/g8232/g" /system/build.prop
sed -i "s/G8231/G8232/g" /system/build.prop
sed -i "s/g8231/g8232/g" /system/vendor/build.prop
sed -i "s/G8231/G8232/g" /system/vendor/build.prop
sed -i "s/g8231/g8232/g" /vendor/build.prop
sed -i "s/G8231/G8232/g" /vendor/build.prop
sed -i "s/g8231/g8232/g" ${system_path}/build.prop
sed -i "s/G8231/G8232/g" ${system_path}/build.prop
sed -i "s/g8231/g8232/g" ${system_path}/vendor/build.prop
sed -i "s/G8231/G8232/g" ${system_path}/vendor/build.prop
# suzu
sed -i "s/f5121/f5122/g" /system/build.prop
sed -i "s/F5121/F5122/g" /system/build.prop
sed -i "s/f5121/f5122/g" /system/vendor/build.prop
sed -i "s/F5121/F5122/g" /system/vendor/build.prop
sed -i "s/f5121/f5122/g" /vendor/build.prop
sed -i "s/F5121/F5122/g" /vendor/build.prop
sed -i "s/f5121/f5122/g" ${system_path}/build.prop
sed -i "s/F5121/F5122/g" ${system_path}/build.prop
sed -i "s/f5121/f5122/g" ${system_path}/vendor/build.prop
sed -i "s/F5121/F5122/g" ${system_path}/vendor/build.prop
# VINTF manifest patching
# Add a second instance of every needed HAL
echo "Patching VINTF manifest"
if $vendor_on_system
then
sed -i -r 's/( +<(fqname|instance)>[^<>]*(slot)[^<>]*)1(<\/[^<>]+>)/\11\4\n\12\4/i' /system/vendor/etc/vintf/manifest.xml
sed -i -r 's/( +<(fqname|instance)>[^<>]*(hook|radio|ril|uim)[^<>]*)0(<\/[^<>]+>)/\10\4\n\11\4/i' /system/vendor/etc/vintf/manifest.xml
else
sed -i -r 's/( +<(fqname|instance)>[^<>]*(slot)[^<>]*)1(<\/[^<>]+>)/\11\4\n\12\4/i' /vendor/etc/vintf/manifest.xml
sed -i -r 's/( +<(fqname|instance)>[^<>]*(hook|radio|ril|uim)[^<>]*)0(<\/[^<>]+>)/\10\4\n\11\4/i' /vendor/etc/vintf/manifest.xml
fi
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

Loading…
Cancel
Save