Jump to content


Photo

Changing impersonations etc. without replacing whole build.prop


  • Please log in to reply
4 replies to this topic

#1 Steve8x8

Steve8x8

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 261 posts

Posted 17 October 2012 - 05:12 AM

I found this thread on xda-developers discussing a means to change build.prop from within a running Android, but this (by using a shell script unpacked into /tmp, ran in "run_program") could also be applied from an updater-script.
This way, impersonation setups would _only_ consist of information relevant to the impersonation (ro.build.* and ro.product.*).
Likewise, localization setups would only sport persist.sys.timezone and ro.product.locale.* entries.
There could be an upgrade zip that switches hw.nophone on/off, same for gps.enable ... etc pp

Eventually, by using file_getprop() on a config file provided on the SDcard (and erroring out if that one doesn't exist!), it would even be possible to choose the right boot and recovery kernels - obsoleting the need to duplicate the whole userspace and providing two firmware install packages...
(It would be even smarter to read the device configuration from the bootloader, dunno whether that's possible at all, but it would stop users from using the wrong display drivers.)

Any opinions?

#2 Christian Troy

Christian Troy

    Advanced Member

  • FW Developer
  • PipPipPip
  • 6,700 posts

Posted 17 October 2012 - 07:58 AM

you can use sed... on my aosp roms you can use a "cm10_nexus7_to_sgs2.zip" file that will convert nexus7 to sgs2; using sed is pretty easy

#!/sbin/sh

sed -i 's,ro.product.brand=Google,ro.product.brand=samsung,g' /system/build.prop
sed -i 's,ro.product.model=Nexus 7,ro.product.model=GT-I9100,g' /system/build.prop
sed -i 's,ro.product.manufacturer=Asus,ro.product.manufacturer=samsung,g' /system/build.prop
sed -i 's,ro.product.name=nakasi,ro.product.name=GT-I9100,g' /system/build.prop
sed -i 's,ro.product.device=grouper,ro.product.device=GT-I9100,g' /system/build.prop
sed -i 's,ro.build.fingerprint=google/nakasi/grouper:4.1.1/JRO03D/402395:user/release-keys,ro.build.fingerprint=samsung/GT-I9100/GT-I9100:4.0.3/IML74K/XXLPQ:user/release-keys,g' /system/build.prop
sed -i 's,ro.build.description=nakasi-user 4.1.1 JRO03D 402395 release-keys,ro.build.description=GT-I9100-user 4.0.3 IML74K XXLPQ release-keys,g' /system/build.prop

you just have to create an updater-script like this

package_extract_file("nexus7_to_sgs2", "/tmp/nexus7_to_sgs2");
set_perm(0, 0, 0777, "/tmp/nexus7_to_sgs2");

mount("ubifs", "UBI", "system", "/system");
run_program("/tmp/nexus7_to_sgs2");
unmount("/system");

mount("ubifs", "UBI", "data", "/data");
delete_recursive("/data/data/com.android.vending");
delete_recursive("/data/data/com.google.android.gsf");
unmount("/data");

Edited by Christian Troy, 17 October 2012 - 07:59 AM.

If you appreciate my work and would like to support me with a donation you can follow this link. Thank you very much.

* Actions ATM7029 - CM10.2 - CM10.1 - AOKP (4.3) - AOKP (4.2) - ParanoidAndroid (4.3)
* Allwinner A31 - OmniRom 4.4 - CM11 - CM10.2 - CM10.1 - CM10 - AOKP (4.3) - AOKP (4.2) - ParanoidAndroid (4.3) - ParanoidAndroid (4.2)
* Amlogic 8726-MX - OmniRom 4.4 - CM11 - CM10.2 - CM10.1 - CM10 - CM9 - AOKP (4.3) - AOKP (4.2) - ParanoidAndroid (4.3) - ParanoidAndroid (4.2)
* Allwinner A10 - CM10 - CM9 - AOKP

tmF4C.png


#3 Steve8x8

Steve8x8

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 261 posts

Posted 17 October 2012 - 10:19 AM

But: sed would _not_ add entries which don't exist yet. Instead, (used as above) it would replace commented-out entries...
Both issues can be addressed properly: by using grep (does busybox grep know about -q?), and sed matching on line starts (use ^).

What I'd prefer: an impersonation.prop file which just contains the entries which define the fake platform, and an algorithm to merge them into the build.prop properly. With some error fallbacks in place.

Since I'm pretty new to Edify, it will take a while until I can come up with a solution. Got to do some reading...

#4 nognir

nognir

    Newbie

  • Jr. Member
  • Pip
  • 6 posts

Posted 19 January 2013 - 04:00 PM

Does the impersonation work properly in stock rom? I'm running 1212/TM/Freescale.

Should I just paste the build.prop from a custom rom or is it a stupid idea?

#5 maniacmansion

maniacmansion

    Member

  • Jr. Member
  • PipPip
  • 13 posts

Posted 13 February 2013 - 08:35 AM

sed -i 's,ro.product.brand=Google,ro.product.brand=samsung,g' /system/build.prop
sed -i 's,ro.product.model=Nexus 7,ro.product.model=GT-I9100,g' /system/build.prop
sed -i 's,ro.product.manufacturer=Asus,ro.product.manufacturer=samsung,g' /system/build.prop
sed -i 's,ro.product.name=nakasi,ro.product.name=GT-I9100,g' /system/build.prop
sed -i 's,ro.product.device=grouper,ro.product.device=GT-I9100,g' /system/build.prop
sed -i 's,ro.build.fingerprint=google/nakasi/grouper:4.1.1/JRO03D/402395:user/release-keys,ro.build.fingerprint=samsung/GT-I9100/GT-I9100:4.0.3/IML74K



Hi,
I want to switch from Samsung Galaxy 2 back to Nexus 7
as I are not able to install some apps from the store.

If I change the build.prop file manually with editor,
will I screw up my system (play store)?

Thank you.

Best regards
Mirco






Recent blog entries on this topic

Photo

From: Changing impersonations etc. without replacing whole build.prop

By Hyo in Hyo's Blog, on 22 February 2014 - 07:57 AM

Source: Changing impersonations etc. without replacing whole build.prop

Read Full Entry →