notsyncing | 712311c | 2018-08-02 23:07:07 +0800 | [diff] [blame] | 1 | #!/system/bin/sh |
| 2 | |
| 3 | if [ -n "$(grep phh.device.namechanged /system/build.prop)" ]; then |
| 4 | exit 0 |
| 5 | fi |
| 6 | |
| 7 | if [ ! -f /vendor/build.prop ]; then |
| 8 | exit 0 |
| 9 | fi |
| 10 | |
| 11 | VENDOR_FINGERPRINT="$(grep ro.vendor.build.fingerprint /vendor/build.prop | cut -d'=' -f 2)" |
| 12 | echo "Vendor fingerprint: $VENDOR_FINGERPRINT" |
| 13 | |
| 14 | modify_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 | |
| 32 | mount -o remount,rw /system |
| 33 | |
| 34 | # Add devices here, e.g. |
| 35 | # modify_on_match <pattern> <brand> <model> <name> <device> |
| 36 | |
| 37 | modify_on_match "Xiaomi/polaris/polaris.*" "Xiaomi" "MIX 2S" "polaris" "polaris" |
| 38 | modify_on_match "Xiaomi/clover/clover.*" "Xiaomi" "MI PAD 4" "clover" "clover" |
Jon West | 47c3160 | 2018-08-04 19:17:52 -0400 | [diff] [blame] | 39 | modify_on_match "essential/mata/mata.*" "Essential" "PH1" "mata" "mata" |
sixohtew | 7e36f73 | 2018-08-06 04:49:24 +0530 | [diff] [blame] | 40 | modify_on_match "google/taimen/taimen.*" "google" "Pixel 2 XL" "taimen" "taimen" |
notsyncing | 712311c | 2018-08-02 23:07:07 +0800 | [diff] [blame] | 41 | |
| 42 | # End of devices |
| 43 | |
| 44 | if [ -z "$(grep phh.device.namechanged /system/build.prop)" ]; then |
| 45 | echo -e "\nphh.device.namechanged=true\n" >> /system/build.prop |
| 46 | fi |
| 47 | |
| 48 | mount -o remount,ro /system |