blob: 13231db63ddda46b9e7f87f36105ca32839dc2b3 [file] [log] [blame]
notsyncing712311c2018-08-02 23:07:07 +08001#!/system/bin/sh
2
3if [ -n "$(grep phh.device.namechanged /system/build.prop)" ]; then
4 exit 0
5fi
6
7if [ ! -f /vendor/build.prop ]; then
8 exit 0
9fi
10
11VENDOR_FINGERPRINT="$(grep ro.vendor.build.fingerprint /vendor/build.prop | cut -d'=' -f 2)"
12echo "Vendor fingerprint: $VENDOR_FINGERPRINT"
13
14modify_on_match() {
15 match_result=`echo $VENDOR_FINGERPRINT | grep $1`
16 brand=$2
17 model=$3
18 name=$4
19 device=$5
20
21 if [ -n "$match_result" ]; then
22 sed -i "s/ro\.product\.brand=.*/ro.product.brand=${brand}/" /system/build.prop
23 sed -i "s/ro\.product\.model=.*/ro.product.model=${model}/" /system/build.prop
24 sed -i "s/ro\.product\.name=.*/ro.product.name=${name}/" /system/build.prop
25 sed -i "s/ro\.product\.device=.*/ro.product.device=${device}/" /system/build.prop
26 sed -i "s/ro\.lineage\.device=.*/ro.lineage.device=${device}/" /system/build.prop
27
28 echo "Device name changed! Match: $2 $3 $4 $5"
29 fi
30}
31
32mount -o remount,rw /system
33
34# Add devices here, e.g.
35# modify_on_match <pattern> <brand> <model> <name> <device>
36
37modify_on_match "Xiaomi/polaris/polaris.*" "Xiaomi" "MIX 2S" "polaris" "polaris"
38modify_on_match "Xiaomi/clover/clover.*" "Xiaomi" "MI PAD 4" "clover" "clover"
Jon West47c31602018-08-04 19:17:52 -040039modify_on_match "essential/mata/mata.*" "Essential" "PH1" "mata" "mata"
sixohtew7e36f732018-08-06 04:49:24 +053040modify_on_match "google/taimen/taimen.*" "google" "Pixel 2 XL" "taimen" "taimen"
notsyncing712311c2018-08-02 23:07:07 +080041
42# End of devices
43
44if [ -z "$(grep phh.device.namechanged /system/build.prop)" ]; then
45 echo -e "\nphh.device.namechanged=true\n" >> /system/build.prop
46fi
47
48mount -o remount,ro /system