[Q] scripts for change build.prop - Android Q&A, Help & Troubleshooting

hi
i need a script for edit build.prop
i want a script that change lines and add them if they don't exist
http://forum.xda-developers.com/showpost.php?p=19093919&postcount=20
http://forum.xda-developers.com/showpost.php?p=25977898&postcount=15
but i can't understand why they don't work
i find this way and this works good with gscript but not work from cwm
simple sed method:
Code:
#!/bin/bash
sed -i '/linetobereplaced/c\replacedline.' /system/build.prop

please help

Related

[Q] edit build.prop with flashable zip

im made a flashable zip but i need it to be able to edit some lines in the build.prop and edit a line in /system/customize/mns/default.xml can that be done i seen a zip for the evo 4g that did it but how to on the evo 3d can someone help pls
oakieville said:
im made a flashable zip but i need it to be able to edit some lines in the build.prop and edit a line in /system/customize/mns/default.xml can that be done i seen a zip for the evo 4g that did it but how to on the evo 3d can someone help pls
Click to expand...
Click to collapse
As far as I know, your only real option is to include the edited build.prop/default.xml in your flashable zip. Obviously, this would make your mod ROM (and ROM version) specific, however.
If you can find the evo 4g zip that you're referring to, and link it here, I may be able to figure out how they had done it for you
Its the metrodroid script http://www.uploadking.com/NVX96MXX1R they do it with a .sh file they link to in the updater-script then the .sh runs a .sql file i dont need the .sql part tho
I might be able to help with a workaround flashable, depending on what you're editing in the build prop. What are you trying to edit? Like what lines exactly?
oakieville said:
Its the metrodroid script http://www.uploadking.com/NVX96MXX1R they do it with a .sh file they link to in the updater-script then the .sh runs a .sql file i dont need the .sql part tho
Click to expand...
Click to collapse
The "sed" command used in their script is the stream editor command. From your limited explanation in your OP, it seems like this would be what you'd need. If you want, I could probably make a script for you, but I'd need you to pm me exactly which line(s) need changed/what you're trying to accomplish. I'm at work for the next two and a half hours, but I could maybe get to it after work tonight.
I also may need your entire zip if you want me to set up the updater script too. I'm not incredibly experienced in scripting, but I can fake it till I make it
Vinchenzop said:
The "sed" command used in their script is the stream editor command. From your limited explanation in your OP, it seems like this would be what you'd need. If you want, I could probably make a script for you, but I'd need you to pm me exactly which line(s) need changed/what you're trying to accomplish. I'm at work for the next two and a half hours, but I could maybe get to it after work tonight.
I also may need your entire zip if you want me to set up the updater script too. I'm not incredibly experienced in scripting, but I can fake it till I make it
Click to expand...
Click to collapse
He sent me a PM with all the lines, so let me know if you get one too. I told him of the magic of a local.prop in /data/local and how you can override any line in the build.prop so long as it doesn't begin with ro. Part of it was a default.xml which of course can be edited and then put in the zip - easy. It's the ro (read-only) lines that I can't help with, since I'm no script maker. I told him freeza knew how, since I used a freeza .sh script on my heroc to get bootsound on aosp ROMs. Cool to see people still being helpful around here
I have a flashable zip that will edit anything in the build.prop file. At work till midnight, but I'll shoot it your way in the morning.
Sent from my PG86100 using XDA App
Originally Posted by oakieville
im trying to edit these lines
ro.cdma.home.operator.alpha=sprint
gsm.sim.operator.alpha=sprint
gsm.operator.alpha=sprint
ro.cdma.home.operator.numeric=310120
gsm.sim.operator.numeric=310120
gsm.operator.numeric=310120
ro.product.brand=sprint
ro.product.brand=sprint(YES THERE ARE TWO OF THESE)
and make them this
ro.cdma.home.operator.alpha=MetroPCS
gsm.sim.operator.alpha=MetroPCS
gsm.operator.alpha=MetroPCS
ro.cdma.home.operator.numeric=310027
gsm.sim.operator.numeric=310027
gsm.operator.numeric=310027
ro.product.brand=metropcs
ro.product.brand=metropcs
i also need to edit /system/customize/mns/default.xml
this line
<item name="MMS_Msg_Size_Choose">5M</item>
and make it this
<item name="MMS_Msg_Size_Choose">500k</item>
can you help thanks
Well, for anything in the build prop that DOESN'T start with ro (read only), you can add the lines you want into local.prop in /data/local and it will override the lines in build prop, and since it's in /data it will survive flashovers. You probably need to create the local.prop file.
For the xml you can change those lines in yours and then copy the modded file into a flashable zip.
The duplicate line is unnecessary and you can simply delete it (using an sh).
Unfortunately the only way to modify ro lines in the bp is with the sh method you mentioned and i don't know how to do those. But freeza does, so send a pm to him/her.
Please copy paste this response into the thread so others may benefit from the info.
Peace
il Duce said:
He sent me a PM with all the lines, so let me know if you get one too. I told him of the magic of a local.prop in /data/local and how you can override any line in the build.prop so long as it doesn't begin with ro. Part of it was a default.xml which of course can be edited and then put in the zip - easy. It's the ro (read-only) lines that I can't help with, since I'm no script maker. I told him freeza knew how, since I used a freeza .sh script on my heroc to get bootsound on aosp ROMs. Cool to see people still being helpful around here
Click to expand...
Click to collapse
You know me Luke...always trying to help someone. I'll try to write him the script, then maybe post it here, for others benefit (of knowledge)
unCoRrUpTeD said:
I have a flashable zip that will edit anything in the build.prop file. At work till midnight, but I'll shoot it your way in the morning.
Sent from my PG86100 using XDA App
Click to expand...
Click to collapse
unCoRrUpTeD always ftw
This is a .sh file that is run by the updater-script (in the meta folder) when an update.zip is flashed. It uses a shell script to tell the phone to target the build.prop, find the "to be edited" lines and changes them to the new value. I modded the one that was part of the zip linked earlier in the thread for oak's specific needs
Code:
#!/sbin/sh
mount system
mount data
sed 's/^ro.cdma.home.operator.numeric.*/ro.cdma.home.operator.numeric=310027/g' /system/build.prop > /tmp/build.prop
mv /tmp/build.prop /system/build.prop
sed 's/^ro.cdma.home.operator.alpha.*/ro.cdma.home.operator.alpha=MetroPCS/g' /system/build.prop > /tmp/build.prop
mv /tmp/build.prop /system/build.prop
sed 's/^gsm.sim.operator.alpha.*/gsm.sim.operator.alpha=MetroPCS/g' /system/build.prop > /tmp/build.prop
mv /tmp/build.prop /system/build.prop
sed 's/^gsm.sim.operator.numeric.*/gsm.sim.operator.numeric=310027/g' /system/build.prop > /tmp/build.prop
mv /tmp/build.prop /system/build.prop
sed 's/^gsm.operator.alpha.*/gsm.operator.alpha=MetroPCS/g' /system/build.prop > /tmp/build.prop
mv /tmp/build.prop /system/build.prop
sed 's/^gsm.operator.numeric.*/gsm.operator.numeric=310027/g' /system/build.prop > /tmp/build.prop
mv /tmp/build.prop /system/build.prop
sed 's/^ro.product.brand.*/ro.product.brand=metropcs/g' /system/build.prop > /tmp/build.prop
mv /tmp/build.prop /system/build.prop
The following line needs to be added to the updater-script before the system and data are unmounted (usually one of the last couple of lines in the updater-script), to tell the phone to run the *.sh script.
Code:
run_program("metropcs.sh");
I'll send you the file you need via pm Oakieville
The "sed" command used in the script is the command to edit the stream. It will find the line(s) with the specified target, and change them to reflect the user's desire
There's no need to move the file. Just take that line out and remove all the > tmp/build.prop. It will just edit the build.prop
Sent from my PG86100 using XDA App
unCoRrUpTeD said:
There's no need to move the file. Just take that line out and remove all the > tmp/build.prop. It will just edit the build.prop
Sent from my PG86100 using XDA App
Click to expand...
Click to collapse
Can you still upload your generic script tonight though? Hoping to use it myself
unCoRrUpTeD said:
There's no need to move the file. Just take that line out and remove all the > tmp/build.prop. It will just edit the build.prop
Sent from my PG86100 using XDA App
Click to expand...
Click to collapse
Thanks for the tip man. I'm not extremely experienced in scripting. Like I said in a previous post, I just edited a file that was linked earlier in the post to include the "ro.product.brand". Since the first part was done including the move and the > tmp/build.prop setup, I just left it all the same for uniformity and figured it may be easier for inexperienced users to understand what the script is doing, since it more or less explains itself.
Does it look correct though uncorrupt? I don't want to give oak a bad file
And uncorrupted, are you referring to just do it this way?
Code:
#!/sbin/sh
mount system
mount data
sed 's/^ro.cdma.home.operator.numeric.*/ro.cdma.home.operator.numeric=310027/g' /system/build.prop
sed 's/^ro.cdma.home.operator.alpha.*/ro.cdma.home.operator.alpha=MetroPCS/g' /system/build.prop
sed 's/^gsm.sim.operator.alpha.*/gsm.sim.operator.alpha=MetroPCS/g' /system/build.prop
sed 's/^gsm.sim.operator.numeric.*/gsm.sim.operator.numeric=310027/g' /system/build.prop
sed 's/^gsm.operator.alpha.*/gsm.operator.alpha=MetroPCS/g' /system/build.prop
sed 's/^gsm.operator.numeric.*/gsm.operator.numeric=310027/g' /system/build.prop
sed 's/^ro.product.brand.*/ro.product.brand=metropcs/g' /system/build.prop
After relooking at the file, I noticed a few errors in the script...
first...
Code:
#!/sbin/sh
This line was changed to
Code:
#!/bin/sh
since "sh" is located in /system/bin not "sbin"
Removed the mount system and mount data, since the updater script will already do this.
Upon advice of uncorrupted and viper, removed the
Code:
> /tmp/build.prop
mv /tmp/build.prop /system/build.prop
. Viper says using that line would actually wipe the build prop every time it appears in the script.
i tried it with the second file vinchenzop sent and it still dont work this is my update-script
ui_print("*************************************************");
ui_print("* *");
ui_print("* *");
ui_print("* HTC EVO 3D *");
ui_print("* METROPCS MMS FIX *");
ui_print("* 2.08.651.2 *");
ui_print("* by -OAKIEVILLE * *");
ui_print("* *");
ui_print("* *");
ui_print("*************************************************");
show_progress(1.000000, 0);
mount("ext4", "EMMC", "/dev/block/mmcblk0p23", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p24", "/data");
ui_print("Metroizing system...");
delete("/system/app/mms.apk");
delete("/system/app/mms.odex");
delete("/system/app/Mms.apk");
delete("/system/app/Mms.odex");
delete("/system/app/MMS.apk");
delete("/system/app/MMS.odex");
package_extract_dir("system", "/system");
ui_print("done...");
ui_print("Metroizing data...");
delete("/data/data/com.android.providers.telephony/databases/telephony.db");
delete_recursive ("/data/data/com.android.mms");
delete("/data/dalvik-cache/[email protected]@[email protected]");
delete("/data/dalvik-cache/[email protected]@[email protected]");
delete("/data/dalvik-cache/[email protected]@[email protected]");
package_extract_dir("data", "/data");
run_program("metropcs.sh");
unmount("/system");
unmount("/data");
ui_print("done...");
ui_print("*************************************************");
ui_print("* *");
ui_print("* *");
ui_print("* u've been Metroized *");
ui_print("* oakieville style *");
ui_print("* E.S.O.V *");
ui_print("* *");
ui_print("* *");
ui_print("* *");
ui_print("*************************************************");
set_progress(1.000000);
do you see anything wrong there
also you guy are awesome for all this help
What folder is metropcs.sh in. You have to extract the file. I would extract it to /tmp and then chmod it and then run /tmp/metropcs.sh
I'll try and upload my script tonight if I can locate it tonight. Been through a couple if computers and hard drives, but I should have at least one online, too.
Sent from my PG86100 using XDA App
unCoRrUpTeD said:
What folder is metropcs.sh in. You have to extract the file. I would extract it to /tmp and then chmod it and then run /tmp/metropcs.sh
I'll try and upload my script tonight if I can locate it tonight. Been through a couple if computers and hard drives, but I should have at least one online, too.
Sent from my PG86100 using XDA App
Click to expand...
Click to collapse
Metropcs.sh is on the root of my zip
FIRST: The location of shell in recovery should be /sbin/sh. But when you are booted into the ROM it will be /system/bin/sh. Recovery and the ROM are 2 seperate partitions and setup.
SECOND: The script linked WILL NOT add the lines you want if it doesn't exist in the build.prop to begin with.
I removed some things from this as it was used for something else. I haven't tested it but all I did was remove some extra things that were in it and renamed some things.
First thing to note is that in the updater-script you need to extract the files. We will get to that in a second. There are 2 files that are used. Create a folder inside the zip called tmp. Inside the tmp folder should be 2 files. The first one is called mytweaks.sh and the second one is called misc.
mytweaks.sh
Code:
#!/sbin/sh
bp="/system/build.prop"
busybox mount /system
busybox mount /data
if [ -f /system/build.prop.bak ];
then
rm -rf $bp
cp $bp.bak $bp
else
cp $bp $bp.bak
fi
echo " " >> $bp
echo "# unCoRrUpTeD build.prop editor" >> $bp
echo " " >> $bp
for mod in misc;
do
for prop in `cat /tmp/$mod`;do
export newprop=$(echo ${prop} | cut -d '=' -f1)
sed -i "/${newprop}/d" /system/build.prop
echo $prop >> /system/build.prop
done
done
misc
Code:
dalvik.vm.startheapsize=24m
windowsmgr.max_events_per_sec=60
ro.product.multi_touch_enabled=true
ro.product.max_num_touch=2
keyguard.no_require_sim=true
debug.sf.hw=1
ro.opengles.version=131072
ro.default_usb_mode=2
ro.qualcomm.proprietary_obex=false
ro.display.width=320
ro.display.height=960
ro.telephony.call_ring.delay=1000
ro.mot.eri.losalert.delay=1000
There should be no reason to mess with mytweaks.sh unless "#!/sbin/sh" needs to be changed.
Inside the misc file you can delete what I have posted and add the lines you want to add or modify in the build.prop. Make sure that each setting is on it's own line.
The script should run through each line and if it found a line that has the same text before the "=" it will remove that line and then add the contents of misc to the bottom of the build.prop file. This way, even if the line is not present in the build.prop it will still be added.
Now back to the updater script. You will need to extract the tmp folder so that you can access the files. Add the following lines in the updater-script
updater-script
Code:
package_extract_dir("tmp", "/tmp");
set_perm(0, 0, 0777, "/tmp/mytweaks.sh");
run_program("/tmp/mytweaks.sh", "mytweak");
Attached is the zip with everything setup.
The script also creates a backup of the original build.prop in /system/build.prop.bak just in case there is a problem.

My update for AIO Automatic Installation Script

Hello, Im useing this script http://forum.xda-developers.com/showthread.php?t=951274 to install JIT, DualTouch, etc.
I have some update for .sh script.
In JIT installation part:
Code:
echo "Backing up build.prob file"
busybox cp -f /system/build.prop /system/build.prop.stock
echo "Copying build.prop to /system/"
busybox cp -f data/jit/build.prop /system/build.prop
Here script rename system build.prop file to build.prop.stock and copy new build.prop from script folder to system.
And in JIT deinstallation part:
Code:
echo "Copying libraries and build.prop to /system/"
...
busybox cp -f data/jit/disable/build.prop /system/build.prop
And here script copy new build.prop from script folder to system.
BUT!
In deinstallation we need to get back our stock build.prop what was renamed in installation part!
So, i suggest to change
Code:
busybox cp -f data/jit/disable/build.prop /system/build.prop
to
Code:
busybox mv -f system/build.prop.stock system/build.prop
to rename build.prop.stock to build.prop.
And why did we copy/past this build.prop files? Why we cant copy stock build.prop and edit it this way:
Code:
echo "#DEVICE_PROVISIONED=1" >> /system/build.prop
echo "dalvik.vm.heapsize=30m" >> /system/build.prop
echo "#kernel.log=default" >> /system/build.prop
echo "dalvik.vm.execution-mode=int:jit" >> /system/build.prop
What do you think?
And sorry, I cant post this to Development forum because I have < 10 posts.
Iam searching in Google for help and so i find your Post here.
Maybe u can help me a bit.
I have a GalaxyNexus.
I have a Build.prop with and one without Tablet Mode.
I like to use sometimes TabletMode and sometimes not.
I think with a Script like u use here i can change what build.prop to use.
Lets say i have the "build.prop" with TabletMode and a "build.prop.stock" without that Mode.
How can i make it possible to activate the .stock and dissable the TabletMode. And then again the other way arround. ???

[Q] Init.d Script partially not working. Need help

Hello,
I'm using a CM9 ROM with support to init.d scripts, there's a lot of them working (including a test script that i created to make a text file and write Hello Android on it when i boot up), but there's one particular script that I can't make it work properly. I'm trying to make the tip provided by the user tiwag on his post here to work on init.d.
But when I created a script named 11roaming on my init.d with the following sintax:
Code:
#!/system/bin/sh
getprop | grep operator
echo OiBrT start
setprop gsm.sim.operator.alpha "BRA BrTCelular"
setprop gsm.operator.isroaming false
getprop | grep operator
echo OiBrT done
The only thing that work is the setprop gsm.operator.isroaming false but the code
setprop gsm.sim.operator.alpha "BRA BrTCelular" doesn't. My gsm.sim.operator.alpha continues to be the default "Oi" and not "BRA BrTCelular" on bootup.
Any specift reason for it not to work? This same script works fully with the app SManager.
I created the script file with Root Explorer Text Editor, so I think there isn't characters mistakes.
I need help to fix this since I'm new to linux/android scripting.
Thank you

Pulling my hair out regarding shell scripts

Last night, I had a pair of working scripts that
a) Added a string to the build.prop
b) Removed that very string from the build.prop
Here they are:
Code:
#!/sbin/sh
chmod 777 /system/build.prop
echo "debug.sf.nobootanimation=1" >> /system/build.prop
Code:
#!/sbin/sh
busybox mount -o remount,rw /system
busybox sed -i '/debug.sf.nobootanimation=1/d' /system/build.prop
As you can see, it enables and disables the boot animation.
Now, these very same scripts causes a bootloop and corrupts the build.prop
I cannot figure out why... or why it should even do that in the first place. One minute it works, the next it's breaking things in a way that makes zero sense.
Does chmod work on a readonly filesystem? You might try to mount it readwrite in the first script just like you did in the second.
By the way what does "corrupts the build.prop" mean exactly?
You could also try booting the phone and start "adb logcat" so you can see the debug messages on your PC.

[Q] init.d support on Cyanogenmod 12.1

Hi,
I'm trying to run a custom init.d script on my HTC One (m7) which is running on Cyanogemod 12.1 (The problem existed already in 12.0). The problem is that none of the scripts are executed at boot time.
Looking at the "init.cm.rc" script i found the following snippets that look like the "sysinit" command should be triggered at boot time.
Code:
[...]
on post-fs-data
[...]
# Run sysinit
start sysinit
[...]
# sysinit (/system/etc/init.d)
service sysinit /system/bin/sysinit
user root
oneshot
disabled
I even tried removing the "disabled" parameter but the "sysinit" command is still not executed at boot time.
If I run the "sysinit" command on a root shell the scripts are executed as the should.
Anybody an idea what I'm missing?
Thanks in advance!
Hi.
I am also running CM12.1 on a w7dsn device, and init.d wasn't working. I was able to get it running by using the init.sh script as described here:
http://techtrickz.com/how-to/fix-xposed-framework-installation-issue-on-nexus-6/
I've just downloaded the script and run it from my sdcard, no other steps are necessary.
lfom said:
Hi.
I am also running CM12.1 on a w7dsn device, and init.d wasn't working. I was able to get it running by using the init.sh script as described here:
http://techtrickz.com/how-to/fix-xposed-framework-installation-issue-on-nexus-6/
I've just downloaded the script and run it from my sdcard, no other steps are necessary.
Click to expand...
Click to collapse
I am trying to get init.d working on d2vzw, and no luck. The script you linked to works by replacing /system/etc/install-recovery.sh, but my build has no such file. What a drag with CM...
galets said:
I am trying to get init.d working on d2vzw, and no luck. The script you linked to works by replacing /system/etc/install-recovery.sh, but my build has no such file. What a drag with CM...
Click to expand...
Click to collapse
Mine didn't have either, but after installing the script (and creating install-recovery.sh) then my scripts in init.d started to be run after every boot.
You must turn off selinux in order for init.d to work
Sent from my LG-LS980 using XDA Free mobile app
I'm using CyanogenMod 12.1 ROM on my phone, to enable the init.d you have to remove the /system/bin/sysinit then recreate the similar filename with the same content and permissions (755, root, shell).
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
run-parts /system/etc/init.d
Was it the init.rc from the boot.img initrd, or the one from the rootfs /boot.img?
Just change the permissions of all files in /etc/init.d folder to 755.
Also if you use the /data/local/userinit.sh change that to 755.
Leave the /system/bin/sysinit file as it is.
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
for i in /system/etc/init.d/*; do
if [ -x $i ]; then
/system/bin/log -t sysinit Running $i
$i
fi
done
Cheers

Categories

Resources