[ZIP] Dynamic automated build.prop editing

What about an app? See post #90 for more infos, let me know what you think!


  • Total voters
    146
Search This thread

m0han

Senior Member
Apr 30, 2012
5,454
2,559
Changelog.....version 0.5.9(a):

Error handling fixed, script properly exits now if anything failes and won't make further changes
More verbose output
Date and tweak.prop version added to backup files to keep track of them
Special characters like / are now escaped and handled correctly by sed
Slight changes in coding style as it's good practise
Can someone reupload version 0.5.4a zip ?
no idea if what i'm doing is right. i downloaded from git and got a file named tweakprop-3e33ec320f.zip having md5 59fa0bc96e6d92f854c5b473128c5397.
is this the latest version? or is 0.5.9(a) mentioned in post#2 a newer version? anyway, could someone upload the very latest release and share the link? @kl3?

---------- Post added at 12:41 PM ---------- Previous post was at 12:01 PM ----------

1. Place your tweak.prop file on your internal sdcard
2. Flash the zip file
If it didn't work, place the tweak.prop file on you external sdcard and flash again......
your file has a 'Example_tweak.prop' file inside the zip. should that remain even after placing tweak.prop file on internal or external sdcard? will there be any conflict?
better would be this: can your zip file be modified in such a manner that tweak.prop file can be placed inside the zip file itself and flashed in one go?
 

sohailhind

Member
Apr 24, 2015
23
4
LS675 i was editng build.prop and the screen goes blank.
i have copy of build.prop on my desktop.
is there anyway to make update to zip to replace modded build.prop with original build.prop.
only available option are adb side load recovery and update via sd card.
 

tofu

Senior Member
Apr 30, 2015
536
202
1. The command "zipit a" results in flashable zip that has /a/ -root folder. It doesn't work.

2. I moved manually the contents of /a/ into root within the zip, and then flashed it. Nothing happened to my build.prop, even though I had edited the tweak.prop -file.

Inside tweak.prop I had this:

BACKUP=n
$ro.qc.sdk.audio.fluencetype|none

Any idea where's the problem?
 
Last edited:

BillGoss

Senior Member
Sep 2, 2010
5,563
4,909
Sydney
OnePlus 8T
OnePlus 9 Pro
1. The command "zipit a" results in flashable zip that has /a/ -root folder. It doesn't work.

2. I moved manually the contents of /a/ into root within the zip, and then flashed it. Nothing happened to my build.prop, even though I had edited the tweak.prop -file.

Inside tweak.prop I had this:

BACKUP=n
$ro.qc.sdk.audio.fluencetype|none

Any idea where's the problem?
Did you get this error shown in last_log?

/tmp/tweakprop.sh: line 13: can't create /proc/self/fd/: Is a directory

Because I find that the script runs fine if used as update-binary, but not if it's invoked as a shell script, as done in the "a" form. The error is due to the fact that definition of ui_print() writes to "/proc/self/fd/$OUTFD" which gives the error when invoked in a shell.
Sent from my SM-N9005 using XDA Labs
 
Last edited:

vladniko

Senior Member
Aug 15, 2012
167
32
Did you get this error shown in last_log?

/tmp/tweakprop.sh: line 13: can't create /proc/self/fd/: Is a directory

Because I find that the script runs fine if used as update-binary, but not if it's invoked as a shell script, as done in the "a" form. The error is due to the fact that definition of ui_print() writes to "/proc/self/fd/$OUTFD" which gives the error when invoked in a shell.
Sent from my SM-N9005 using XDA Labs

So how do I go about getting

persist.audio.fluence.voicecall=false

in my tweak.prop file to actually edit the build.prop? I've tried both that command and

$persist.audio.fluence.voicecall|false

and neither of them work
 

BillGoss

Senior Member
Sep 2, 2010
5,563
4,909
Sydney
OnePlus 8T
OnePlus 9 Pro
So how do I go about getting

persist.audio.fluence.voicecall=false

in my tweak.prop file to actually edit the build.prop? I've tried both that command and

$persist.audio.fluence.voicecall|false

and neither of them work
So many questions!
Did you see any helpful information in your TWRP log file?
Does it work for other changes to your build.prop file?
Have you successfully used this tool before?
Where did you put your tweak.prop file?
What does your tweak.prop file look like?
Are you running the "normal" version or the "a" (script) version?

Sent from my SM-N9005 using XDA Labs
 

vladniko

Senior Member
Aug 15, 2012
167
32
Nothing out of the ordinary in the TWRP terminal.

It works for adding Google Assistant

tweak.prop is in a folder on internal storage

I have the a but it doesn't seem to work. It works if I have my tweak.prop on the device
 

BillGoss

Senior Member
Sep 2, 2010
5,563
4,909
Sydney
OnePlus 8T
OnePlus 9 Pro
Nothing out of the ordinary in the TWRP terminal.

It works for adding Google Assistant

tweak.prop is in a folder on internal storage

I have the a but it doesn't seem to work. It works if I have my tweak.prop on the device
I have no problem installing the line you wanted. Did you check that the line isn't already in your build.prop?

Sent from my SM-N9005 using XDA Labs
 

vladniko

Senior Member
Aug 15, 2012
167
32
I have no problem installing the line you wanted. Did you check that the line isn't already in your build.prop?

Sent from my SM-N9005 using XDA Labs

The voice call line is in my build.prop and always will be as its a toggle. I'm just trying to get the program to change the end of the argument from true to false
 

vladniko

Senior Member
Aug 15, 2012
167
32
If you attach your tweak.prop I'll try it out on my phone, which also has that property set to true.

Sent from my SM-N9005 using XDA Labs

Sure, thanks so much!
It wouldn't allow me to upload the .prop extension so when you download it, just change the file extension from .txt to .prop
 

Attachments

  • tweak.txt
    74 bytes · Views: 120

Top Liked Posts

  • There are no posts matching your filters.
  • 103
    Hey,

    since I'm flashing nightlies on a regular basis and also want to use my own custom /system/build.prop file, there are a few ways to accomplish both things as easy as possible:

    Backing up /system/build.prop through a script in /system/addon.d
    Flashing my own file using a zip after every update
    Restoring previous build.prop using a Editor app and reboot
    Manually change or add every desired entry and reboot

    For most of you one of these ways should absolutely do the trick, but my problem was either things like build version, date, etc. got stuck at my custom file's one or I had to reboot after manually updating it, which got really annoying after several times.

    So I decided to create my own flashable zip which works as follows:

    Somewhere on the device is a simple text file in which are all those entries that shall be changed,added to or removed from /system/build.prop (In my case it's /sdcard/tweak.prop)
    After mounting /system and /data (not if they are already) and setting write permissions to /system/build.prop the zip extracts a shell script to /tmp/tweakprop.sh
    It This script scans the text file (aborts if not found) and looks for changed, new or unwanted entries in /system/build.prop in order to apply them. Changed entries will be overridden, new ones will be added, unwanted get removed and entries existing in /system/build.prop but not in your personal file will be ignored
    When tweaking is done, it just removes /tmp/tweakprop.sh and unmounts /system and /data (only if they weren't mounted before) and reverts /system/build.prop's permissions to rw-r--r--

    -> (See content of example.txt for more detailed examples and syntax!)

    Using this method, you can not only forget about manually updating versions and/or lame reboots after updates for changes to take effect, but also edit your personal text file at any time without root rights beeing required. Once set up to be flashed after every update, your /system/build.prop is always tweaked as you wish and looks like a stock one (ROM version, etc. under About Phone).

    The zip flashes well on all recoveries. Make sure your tweak.prop file ends with an empty line, otherwise the last line will be ignored!

    I hope some of you can use this zip, it's free to modify. If you have any suggestions, let me know.

    This project has been moved to a git repo at https://notabug.org/kl3/tweakprop. Please refer to it in the future to get updates as this is much easier for me to maintain. Upcoming changelog can be found here.
    20
    Changelog

    Changelog
    version 0.1:

    • initial release


    version 0.2:

    • ignore lines in personal file not matching a valid entry pattern (someVAR=someVAL) to not mess up /system/build.prop and support personal structuring inside the file like "# media tweaks #", "# dalvik section #", etc.
    • code cleaned up


    version 0.2.1:

    • typo fixed in line 24 of tweakprop.sh so the if-statement asks for the correct file (thanks to the_pirate_predator)


    version 0.3:

    • changed the while-loop to get it's input directly from sed, which makes a second buffer file obsolete


    version 0.3.5:

    • example.txt provided as tweak.prop template
    • ignore lines beginning with # or being empty


    version 0.4:

    • instead of a fixed path, the personal file gets searched on internal storage (file name can be set in the script) so you can put your file anywhere - no more problems with /sdcard/ or /sdcard/0/ on different devices
    • personal file must not be empty, otherwise script aborts#
    • only override really different entry values in order to prevent "... value of someVAR overridden" spam in recovery log


    version 0.4.5:

    • fixed last line of personal file being ignored due to deleting all empty lines before
    • speed up search for personal file, now looking on internal storage and even on external SD card if nothing was found before (ext. SD neither gets checked if present, nor mounted or unmounted, just trying to search on it silently)


    version 0.4.5a:

    • same as 0.4.5a, but personal file is inside the zip and gets extracted to /tmp/tweak.prop, no need to have one on the internal storage


    version 0.4.6(a):

    • output not shown in TWRP fixed, now works as it should


    version 0.5:


    • code cleanup: everything's now in the update-binary, resulting in much less code and faster execution time
    • output to recovery should now work on all device-recovery combinations


    version 0.5.1:


    • lines beginning with ! will be removed globally
    • little code-cleanup


    version 0.5.2
    :


    • lines beginning with @ will append the string after | to values of existent entries
    • slight changes in code structure


    version 0.5.3
    :


    • lines beginning with $ will change the value to the string after | only if the entry already exists, hence $telephony.lteCdmaDevice|1 is nothing but a more explicit approach of telephony.lteCdmaDevice=1, as the first one will only make changes but no new entries


    version 0.5.4
    :


    • the build.prop file can now be backed up before editing using a BACKUP= line, see example.txt for details
    • tiny bug fixed


    version 0.5.4a
    :


    • tweak.prop file (example.txt) is included, no personal file on your device's storage is used. Edit the zip's content before flashing!


    version 0.5.9(a)
    :


    • Error handling fixed, script properly exits now if anything failes and won't make further changes
    • More verbose output
    • Date and tweak.prop version added to backup files to keep track of them
    • Special characters like / are now escaped and handled correctly by sed
    • Slight changes in coding style as it's good practise
    3
    Well, this was way easier than I thought at first glance, so why not supporting xda folks instead of gaming, right? :D

    Version 0.5.3 was released, just a minor syntax case added for fixing problems that might occour when flashing the same tweak.prop file on different devices. See the changelog for more infos!

    As usual:
    55132479.jpg
    3
    Thanks for your great feedback, guys! Finally it should really work, I found some typos inside the sed-commands breaking the syntax. Version 0.5.1 is reuploaded again. :eek:

    If you like my work, please share it, name it in your signature or donate some cents - every support is highly appreciated!

    Maybe an additional app to easily edit your tweak.prop file, toggle adding/removing/overriding lines and apply changes would be nice to have? Would do you think?
    2
    Hi k,

    I remember this was something me and Patrics were playing around with for ROMCleaner before life got in the way :(

    Good work, I love little scripts like this and will be sure to play around with it on my next flash.

    I have some suggestions if thats ok?

    Does the answer file have to have the .prop extension?

    We found it was a lot easier for users to use a standard .txt file rather than 'fiddle' with a different extension.

    I know it sounds like a little thing but you'll be surprised at how many dont...

    Can you make the script ignore anything in the file answer file preceded with a #?

    If so you can make a sample file for complete novice users to use and also have the ability to quickly enable/disable edits.

    Something like:

    Code:
    #   !!!ALWAYS USE NOTEPAD++ WHEN EDITING THIS FILE!!!
    #
    #        ===============================================
    #        |                                             |
    #        |         Dynamic build.prop Editor           |
    #        |                     by                      |
    #        |                 klenamenis                  |
    #        |                                             |
    #        ===============================================
    #
    #        For help and support, please visit my thread:
    #
    #			http://forum.xda-developers.com/showthread.php?t=2664332
    #
    #   !!!ALWAYS USE NOTEPAD++ WHEN EDITING THIS FILE!!!
    #
    #
    #==========================================================================================================================
    #
    #	Add your custom build.prop entries to this file to have them automatically
    #	applied to your current build.prop when flashing a new ROM.
    #
    #	After flashing your ROM flash the tweakprop.zip and edits will be applied.
    #
    #	Eg:
    #
    #	To enable an edit:
    #
    #	ro.sf.lcd_density="400"
    #
    #	To disable an edit, precede the line with a hash symbol (#):
    #
    #	#ro.sf.lcd_density="400"
    #
    #==========================================================================================================================
    #
    #	!!! EDITS GO BELOW !!!
    #
    #==========================================================================================================================

    You could also go more adanced and make the .sh dynamic by having some asserts in the updater-script look for the answer file in predefined locations etc

    You can do a lot with scripts like these, just which I had more knowledge of nix scripting :(