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.
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
Click to expand...
Click to collapse
Such Awesome, much appreciate i wanted to make one too, but never got the time to.
Sent from my Xperia V using XDA Premium 4 mobile app
What should my text file look like if I just want to add one line of text at the end of my build.prop? For example,
qemu.hw.mainkeys=0
to activate softkeys on a device with capacitive buttons?
Thanks
Sent from my XT912 using Tapatalk
Need some information
I need explanation for the following lines of code.
Code:
## your personal file with tweaks and custom entries/values
tweak=/sdcard/0/tweak.prop
## abort execution if $tweaks not found
if [ ! -e $tweaks ]
then
ui_print "ERROR: Personal file not found. No changes were made."
ui_print "Script aborted. Check file path and flash again."
exit 0
fi
## read only lines matching any valid entry pattern (someVAR=someVAL), e.g.
## net.bt.name=Android, omni.device=n7100, url.legal=http://www ...
sed '/.*=.*/!d' $tweak > /tmp/tweak.prop
tweaks=/tmp/tweak.prop
You are giving a condition loop without even declaring the variable "tweaks" at first. You have declared only after the loop ends. Then that means, the code in the loop never executes. I think this is a small mistake you did with the code. Make sure you correct those.
But else, a great work!! :good: :good:
Sorry, but stick to one variable, "tweak", or "tweaks".
Otherwise, its a very simple, yet efficient algorithm. :good:
jonwgee said:
What should my text file look like if I just want to add one line of text at the end of my build.prop? For example,
qemu.hw.mainkeys=0
to activate softkeys on a device with capacitive buttons?
Click to expand...
Click to collapse
Just a simple text file containing your mentioned line. Any other empty or non-entry lines will be ignored by my script anyway.
the_pirate_predator said:
I need explanation for the following lines of code.
Code:
## your personal file with tweaks and custom entries/values
tweak=/sdcard/0/tweak.prop
## abort execution if $tweaks not found
if [ ! -e $tweaks ]
then
ui_print "ERROR: Personal file not found. No changes were made."
ui_print "Script aborted. Check file path and flash again."
exit 0
fi
## read only lines matching any valid entry pattern (someVAR=someVAL), e.g.
## net.bt.name=Android, omni.device=n7100, url.legal=http://www ...
sed '/.*=.*/!d' $tweak > /tmp/tweak.prop
tweaks=/tmp/tweak.prop
You are giving a condition loop without even declaring the variable "tweaks" at first. You have declared only after the loop ends. Then that means, the code in the loop never executes. I think this is a small mistake you did with the code. Make sure you correct those.
But else, a great work!! :good: :good:
Click to expand...
Click to collapse
You're right. It's a typo, I'm correcting it now. Thanks for your advice.
thewisenerd said:
Sorry, but stick to one variable, "tweak", or "tweaks".
Otherwise, its a very simple, yet efficient algorithm. :good:
Click to expand...
Click to collapse
I use a second buffer file that is a cleaned version of the original one. If I find a smarter way, I will.
I was searching for something like this for ages.
But i have a nob question! lol
I need to create a text file with all the lines i want to add to my built.prop file, so where I put the text file? And i have to give a certain name to that file or any name will do?
Hugo
oguh said:
I need to create a text file with all the lines i want to add to my built.prop file, so where I put the text file? And i have to give a certain name to that file or any name will do?
Click to expand...
Click to collapse
My script searches for a file called tweak.prop located at your internal storage (storage/emulated/0/tweak.prop or sdcard/tweak.prop or sdcard/0/tweak.prop), but you can freely change the line
PHP:
tweak=/sdcard/0/tweak.prop
to any path you want your personal file to be.
klenamenis said:
My script searches for a file called tweak.prop located at your internal storage (storage/emulated/0/tweak.prop or sdcard/tweak.prop or sdcard/0/tweak.prop), but you can freely change the line
PHP:
tweak=/sdcard/0/tweak.prop
to any path you want your personal file to be.
Click to expand...
Click to collapse
Thx for the quick response, and for your great work.
hugo
Sorry but i don't get it.
i need to create a txt file called tweak.prop and place it where i want, for example /sdcard/tweak.prop
after extracting the tweakprop-0.3.zip for editing the line /tmp/tweakprop.sh
Code:
## your personal file with tweaks and custom entries/values
tweak=/sdcard/tweak.prop
zipping meta-inf and tmp folder and finally flashing this zip.. am i doing something wrong ?
because it takes no changes.
got this line in tweak.prop at /sdcard/tweak.prop
Code:
ro.sf.lcd_density=400
sorry, i really dont get it.
bnbagiz said:
Sorry but i don't get it.
i need to create a txt file called tweak.prop and place it where i want, for example /sdcard/tweak.prop
after extracting the tweakprop-0.3.zip for editing the line /tmp/tweakprop.sh
Code:
## your personal file with tweaks and custom entries/values
tweak=/sdcard/tweak.prop
zipping meta-inf and tmp folder and finally flashing this zip.. am i doing something wrong ?
because it takes no changes.
Click to expand...
Click to collapse
As my script already shows, changing the path to /sdcard/0/tweak.prop again should do the trick.
I just want to change my DPI with this. What do I need to change in your default tweak.prop to be able to do that?
Click thanks if I helped you.
Sent from my SM-N900W8 using XDA Premium mobile app
Code:
klenamenis said:
As my script already shows, changing the path to /sdcard/0/tweak.prop again should do the trick.
Click to expand...
Click to collapse
did not work ! :/ you mean changing the path for the tweak.prop in the unzipped tweakprop.sh in /tmp/, aren't you ?
Code:
build=/system/build.prop
## your personal file with tweaks and custom entries/values
tweak=/sdcard/0/tweak.prop
---------- Post added at 02:41 PM ---------- Previous post was at 02:34 PM ----------
sauron82 said:
I just want to change my DPI with this. What do I need to change in your default tweak.prop to be able to do that?
Click thanks if I helped you.
Sent from my SM-N900W8 using XDA Premium mobile app
Click to expand...
Click to collapse
that is what i am trying to do
you need to change the line
Code:
ro.sf.lcd_density="value you like to have, i.e. 400"
bnbagiz said:
Code:
did not work ! :/ you mean changing the path for the tweak.prop in the unzipped tweakprop.sh in /tmp/, aren't you ?
Code:
build=/system/build.prop
## your personal file with tweaks and custom entries/values
tweak=/sdcard/0/tweak.prop
Click to expand...
Click to collapse
Yes, that's what I meant. Then just try any other path. I guess the internal storage's path is a device specific thing. Which device do you? I would try locating your personal file at /system as this path exists on all devices/ROMs.
klenamenis said:
Yes, that's what I meant. Then just try any other path. I guess the internal storage's path is a device specific thing. Which device do you? I would try locating your personal file at /system as this path exists on all devices/ROMs.
Click to expand...
Click to collapse
I am using a LG G2 Intern. D802
PAC-Man ROM (but thing thats irrelevant)
so if i place my tweak.prop in /system/ i need to edit the path in tweakprop.sh right ?
edit:
personal file is in /system/tweak.prop
editting tweakprop.sh line to
/system/tweak.prop
does not work don't get it .. sounds so simple, actually it is, but i don't know what i am doing wrong
bnbagiz said:
that is what i am trying to do you need to change the line
Code:
ro.sf.lcd_density="value you like to have, i.e. 400"
Click to expand...
Click to collapse
I know that, but where do I put it in the provided tweak.prop? What do I remove from the provided tweak.prop so that's the only change? I really don't know what any of this code actually means. Thanks to the OP for providing this, but instructions aren't very clear.
Click thanks if I helped you.
Sent from my SM-N900W8 using XDA Premium mobile app
You're my hero.So tired of changing build.prop values every time I try a different ROM. :good:
bnbagiz said:
edit:
personal file is in /system/tweak.prop
editting tweakprop.sh line to
/system/tweak.prop
does not work don't get it .. sounds so simple, actually it is, but i don't know what i am doing wrong
Click to expand...
Click to collapse
Hm.. Which recovery? Maybe it's a problem with the updater-script doesn't get executed correctly. Sadly, I have no possibilities to test those scenarios.
sauron82 said:
I know that, but where do I put it in the provided tweak.prop? What do I remove from the provided tweak.prop so that's the only change? I really don't know what any of this code actually means. Thanks to the OP for providing this, but instructions aren't very clear.
Click to expand...
Click to collapse
I didn't provide any personal file. If you only want to change this line, create a file called tweak.prop containing only this line and place it right on your internal storage.
Sent from my GT-N7100 using Tapatalk
bnbagiz said:
I am using a LG G2 Intern. D802
PAC-Man ROM (but thing thats irrelevant)
so if i place my tweak.prop in /system/ i need to edit the path in tweakprop.sh right ?
edit:
personal file is in /system/tweak.prop
editting tweakprop.sh line to
/system/tweak.prop
does not work don't get it .. sounds so simple, actually it is, but i don't know what i am doing wrong
Click to expand...
Click to collapse
If you put it in /system/ it'll get erased when you flash a new nightly anyways, as most .zip scripts wipe the /system partition... So... it would be best to keep it on the SD card.
Related
Hi,
as I have seen some complaints in the CM forums about what apps should be in the CM6 release (bla bla bloatware bla bla...) and I already use a CM6 nightly with a lot of the apps removed. I thought a script that automagically creates a slimmed down version of a CM6-update.zip according to your personal choice might help some people.
How it works:
You need a linux box with working java6 binaries
Unzip the attached .zip
Optional: Read the release notes in slim.sh. (In fact, better read the whole file and understand what it will do...)
Copy testsign.jar from here in the extracted directory
Copy the gapps into the directory (must be named gapps-mdpi-FRF91-3-signed.zip)
Copy some CM6-update.zip into the directory
Decide what you want to keep/delete:
This is the interesting part. There are 3 Files ending with .bl in the extracted directory. Just edit them with your favourite text editor. Files with a # in front of the filename will be kept, without it it will be deleted.
Optional: Put some stuff you want in the adds folder, but use the directory structure of the update.zip (e.g. you want launcherpro: copy LauncherPRO.apk to adds/system/app/LauncherPRO.apk)
Run the script: "sh slim.sh NameOfCM6Update.zip"
Flash LowFatYoghurt-CM6-signed.zip and hope that you did not remove something essential [as always, flash on your own risk]
The .bl files in their current state are what I am trying at the moment, so EDIT THEM YOURSELF, I can not promise that everything runs smooth with this settings.
Have fun with this, learn something, improve and share it.
Thanks go out to cyanogen and his team for this awesome build and to everyone else contributing to the android community. The updater-script somewhere deep in adds is kanged from cyanogen and just slightly modified (thanks again).
mblaster
€: Some more automation for the lazy ones...
The new scriptfile GetFreshLFY.sh can be extracted from GetFreshLFY2.zip into the same directory as LowFatYoghurt. To run just type "sh GetFreshLFY.sh" to automatically download and slim the newest nightly for d/s using your current .bl files and adds.
€€: Fast update. Changed GetFreshLFY.sh to make it not download the newest nightly if it already is present.
This is cool. very well-implemented.
jcarrz1 said:
This is cool. very well-implemented.
Click to expand...
Click to collapse
Thanks. I just thought if it is useful for me it might as well be usefull for anyone else
Nice idea, but I always just run a gscript I made to remove them for me. I guess this would take a few mb off of the rom before hand thereby making the flashing process a bit faster.
mejorguille said:
Nice idea, but I always just run a gscript I made to remove them for me. I guess this would take a few mb off of the rom before hand thereby making the flashing process a bit faster.
Click to expand...
Click to collapse
Not only that. If you dare to remove enough, CM6 might eventually fit stock spl (got it down to about 70mb, so quite close). Additionally you can use firerats mtd patch to use the saved /system space for /data.
€: Someone should really make a bootanimation out of your sig
Added another script to OP.
Nice work. And great idea. Thanks.
I liked the idea here but changed it up a bit. I made it so the script runs after the rom installs.
PHP:
"Usage $SCRIPT_NAME [-l] [-s]"
""
"options:"
" -l | --list Creates a list of your apps and media"
" -s | --slim Removes unwanted specified files"
" -h | --help This help"
""
"To remove files run $SCRIPT_NAME -l to create a list of files"
"Open $SLIM_APK and $SLIM_MEDIA"
"Remove the '#' infront of each file you want to delete."
"Run $SCRIPT_NAME -s to remove all the unwanted files."
Hi Guys,
I was speaking to baadnwz a couple of weeks ago and i asked him which script he used to properly pack all the APKs in his ROM. He told me he used no script, just repacked the APKs he thought were most relevant.
I figured it couldn't be too hard to write something that took an APK, extracted it somewhere, then repacked it with the proper compression, so i wrote one. baadnwz then challenged me to make it work for multiple APKs, so he can just run it against a folder full of them like a lazy asshole. i went one better, and made a script that you could run against a ROM folder structure, it will search out all APKs, repack them, and copy them back into place. HOT!
because this uses recursion and functions to make it easier to write (and because i'm generally comfortable in it), i have written it in VBScript. So this means it won't work on linux as far as i know, sorry. Feel free to convert it or whatevs
WHAT DOES IT DO??????//
1. finds an APK
2. unpacks it in a folder
3. optimises the PNGs (if you want it to)
4. repacks all files as deflate except a blacklist of filetypes*
5. repacks the blacklisted filetypes* as STORE
6. zipaligns the new APK
7. copies it back to the original location, overwriting the original APK
8. finds the next APK, and repeat from step 2
* the blacklisted file types are easily editable. just find the STOREFileNames variable. by default the filetypes are:
"*.arsc", "*.m10", "*.png", "*.wav", "*.ogg", "*.mp4", "*.jpl", "*.jpeg", "*.gif","*.mp2", "*.mp3", _
"*.aac","*.mpg", "*.mpeg", "*.mid", "*.midi", "*.smf", "*.jet","*.rtttl", "*.imy", "*.xmf", _
"*.m4a","*.m4v", "*.3gp", "*.3gpp", "*.3g2", "*.3gpp2", "*.amr", "*.awb", "*.wma", "*.wmv", _
"*.so", "*.dat", "*.bin"
WHY DO YOU WANT THIS??
If certain filetypes in the APK are compressed as STORE (which means they aren't compressed at all), then Android can use them directly. If they are stored as DEFLATE (like all other file types should be), then Android must first decompress the APK somewhere. This means slower apps, more cache, and it's just not how things are supposed to be done. This script makes sure that all files inside all APKs are stored as they should be, and it will optimise PNG files and zipalign the final APK as it goes.
This script is really meant for ROM chefs to run against their ROMs before releasing them, but if you (a mere user) have a ROM that your chef hasn't run this script on, then you can extract the ROM, run the script on it, then recompress the ROM and flash it.
HOW DOES IT DO IT?????///////
It uses the command line version of 7-Zip. Download it from here:
http://7-zip.org/download.html
It uses zipalign.exe from the android SDK. if you don't know where this comes from.. maybe you shouldn't be using this script
It uses a cool OptiPNG utility to optimise the PNGs if you want it to. This slows the processing down a lot.. but it's up to you if you wanna do it. You'll need to download the utility from here:
http://optipng.sourceforge.net/
WHAT DO I HAVE TO DO TO MAKE IT WORK//////?
Grab the script, put it in the same folder as the root of your ROM (the script will repack all APKs in the subfolders from where it's sitting, including the APKs in the folder the script is in).
open up the script, there are 5 variables you MUST verify, most likely you will have to change them.. unless you put things on a D and E drive and your name is Nick..
tempAPKextract = "E:\Temp\tempAPKExtract"
tempAPKBuild = "E:\Temp\tempAPKBuild"
sevenZipLoc = """D:\nick\android\7za\7za.exe"""
zipAlignLoc = """D:\nick\android\android-sdk-windows\tools\zipalign.exe"""
optiPNGLoc = """D:\android\7-zipA\ROM\optipng.exe"""
the first two temp ones can be anywhere.. just make sure at least the sub folders up to "tempAPK..." exist (eg in this case the E:\Temp folder must already be there)
the next three are the locations of the tools required for the script to work, edit to please!
Run the script. If you have set verboseOutput to true (it's false by default), then I would highly recommend you run the script from the commandline with the command:
cscript fixAllAPKs.vbs
anyways, hope it's useful to you.
DOWNLOAD
CHANGELOG????/
v1.5.1 - cleaned up some code, added in verboseOutput so you can watch the progress as it's fixing (must run as cscript!)
v1.5 - added OptiPNG to the script, enabled by default. Quite slow. Added some more file types.
v1.4.3 - added more file types to STORE, thanks gtg465x
v1.4.1 - minor code clean up, fixed some comments.
v1.4 - fixed the problem where the script wouldn't fix any APKs in the root folder that the script was in
v1.3 - almost doubled the speed of the script. fixed some naughty bugs
edit: nevermind
not from what i've been told. if it's not compressed, the android system doesn't have to explicitly decompress it somewhere when it wants to use it, it can just pick it straight out of the APK.
omniwolf said:
not from what i've been told. if it's not compressed, the android system doesn't have to explicitly decompress it somewhere when it wants to use it, it can just pick it straight out of the APK.
Click to expand...
Click to collapse
Good man. Here are all of the files blacklisted by the default Android Asset Packaging Tool (aapt) if you want to include them.
{
".jpg", ".jpeg", ".png", ".gif",
".wav", ".mp2", ".mp3", ".ogg", ".aac",
".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet",
".rtttl", ".imy", ".xmf", ".mp4", ".m4a",
".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2",
".amr", ".awb", ".wma", ".wmv"
};
cool, thanks for the info. i've added the missing ones in and uploaded a new version.
cheers!
Nice work.
Suggestion or maybe a challenge for Ver 2:
Given a definition of what languages the user defines, can you repack including only those languages. This would include both drawables and layout language folders.
Removing languages not only speeds up the rom but reduces the apk size which for Sense 3.0 is becoming challenging for many older (> 1 year) devices.
Thanks for your contributions to XDA.
Also need to add .so to the blacklist. Ran into a problem with that the other day.
Here's mine.
It synchronizes with our SVN repository and builds the rom. Any commits which were made are automatically turned into a new ClockWorkMod flashable package.
Code:
#! /bin/sh
#This is the repository Directory, change to match your setup
Repo="~/TeamKomin/trunk"
#This is the Final folder, this is where the file will end up
Output="~/Desktop"
#synchronize SVN repository
svn update "$Repo"
#remove temp folder if exist
test -e "$Output/tmp/" && rm -Rf "$Output/tmp/"
#make new temp folder
mkdir "$Output/tmp/"
#copy repository to temp folder
cp -rf "$Repo/data" "$Output/tmp/"
cp -rf "$Repo/META-INF" "$Output/tmp/"
cp -rf "$Repo/system" "$Output/tmp/"
cp -rf "$Repo/updates" "$Output/tmp/"
#clear SVN folders to reduce size
find "$Output/tmp/" -name ".svn" -type d -exec rm -rf {} \;
cd "$Output/tmp"
#remove old files if there
test -e "$Output/AndromedaRepo.zip" && rm -f "$Output/AndromedaRepo.zip"
#zip up a new Andromeda3 version
zip -r "$Output"/AndromedaRepo.zip ./*
#done
I've also got a version which uses the Expect command to log into our SFTP server and update the files.teamkomin.com website... I'm not posting that here though as it contains security sensitive information.
Using this method, all members work on the ROM as though it were on the phone... This script packages it. No need to package or unpackage the entire thing.
myn said:
Nice work.
Suggestion or maybe a challenge for Ver 2:
Given a definition of what languages the user defines, can you repack including only those languages. This would include both drawables and layout language folders.
Removing languages not only speeds up the rom but reduces the apk size which for Sense 3.0 is becoming challenging for many older (> 1 year) devices.
Click to expand...
Click to collapse
ok, sounds like a good idea. i'm not actually a ROM developer, so i don't know the ins and outs of the various files. any hints on which files i exclude for various languages? just having a vague look around i see in framework-res.apk there's some raw-ar, raw-cs, raw-en-GB folders, are these the ones you're saying i can strip out?
this will obviously be a lot easier if i can do it programmatically, do you know the rules?
Also need to add .so to the blacklist. Ran into a problem with that the other day.
Click to expand...
Click to collapse
ok cool, added it in and uploaded 1.4.3. thanks dude.
Here's mine.
It synchronizes with our SVN repository and builds the rom. Any commits which were made are automatically turned into a new ClockWorkMod flashable package.
I've also got a version which uses the Expect command to log into our SFTP server and update the files.teamkomin.com website... I'm not posting that here though as it contains security sensitive information.
Using this method, all members work on the ROM as though it were on the phone... This script packages it. No need to package or unpackage the entire thing.
Click to expand...
Click to collapse
ok cool. does this actually repack and zip align the APKs though? this looks like it just takes care of the overall ROM zip structure, not the APKs within..? maybe your script could call mine.. if there was a vbs parser for linux
omniwolf said:
ok, sounds like a good idea. i'm not actually a ROM developer, so i don't know the ins and outs of the various files. any hints on which files i exclude for various languages? just having a vague look around i see in framework-res.apk there's some raw-ar, raw-cs, raw-en-GB folders, are these the ones you're saying i can strip out?
this will obviously be a lot easier if i can do it programmatically, do you know the rules?
ok cool, added it in and uploaded 1.4.3. thanks dude.
ok cool. does this actually repack and zip align the APKs though? this looks like it just takes care of the overall ROM zip structure, not the APKs within..? maybe your script could call mine.. if there was a vbs parser for linux
Click to expand...
Click to collapse
We keep the APKs on the server for ease of use. It makes it easier to reference a single file for testing that way.
http://www.jsware.net/jsware/vblinux.php5
vbscript on linux with wine!
Got error on line 118 - WshShell.Run
Anything else shall I edit apart of 4 paths? I have 64-bit OS if that matters.
I just realized how much easier this would be on linux...
Code:
#! /bin/bash
OutDir=~/Desktop/newRom
InDir=~/Desktop/myRom
zipAlign=/home/adam/code/android-sdk-linux_x86/tools/zipalign
TempDIr=~/Desktop/TempDir
FIFO=~/Desktop/temp1234
realign="apk dll whatever files"
#set things up
rm -Rf "$OutDir"
mkdir "$OutDir"
rm "$FIFO"
mkfifo "$FIFO"
#Move to dir and start script
cd InDir
#Spawn another process to write to the fifo object
find `pwd`>"$FIFO" &
#read each line in the fifo
while read line
do
#get each object extension in $realign variable
for x in $realign
do
#test if the extension matches the realignment
if [ $x = ${line#*.} ]; then
#make the path in case it does not exist, could be optimized
touch "$line"
#meh... this would be the command ish...
"$zipAlign" "$line" "$temp/$line"
else
mv "$line" "$temp/$line"
fi
done
done <$FIFO
#this just removes the redundant filesystem created...
#/home/adam/desktop/out/home/adam/desktop/myrom
rm -Rf "$OutDir"
mkdir "$OutDir"
mv "$/TempDIr/$InDIr" "$OutDir"
Untested, should work with some realignment of the variables at the top.
mike1986. said:
Got error on line 118 - WshShell.Run
Anything else shall I edit apart of 4 paths? I have 64-bit OS if that matters.
Click to expand...
Click to collapse
i'd say it's a problem with your
sevenZipLoc
variable, it's the first place it gets used. my OS is 64bit too, so that shouldn't be a problem. what does your sevenZipLoc variable look like?
omniwolf said:
i'd say it's a problem with your
sevenZipLoc
variable, it's the first place it gets used. my OS is 64bit too, so that shouldn't be a problem. what does your sevenZipLoc variable look like?
Click to expand...
Click to collapse
sevenZipLoc = """C:\Program Files\7-Zip\7z.exe"""
EDIT:
It seems that I forgot to download "command version"...
Any way to add optimizing PNGs to this script as well?
williamfold said:
Any way to add optimizing PNGs to this script as well?
Click to expand...
Click to collapse
show me how to do this and i might be able to add it in..
Heres the link to the opensource OptiPNG program to optimize a PNG
http://optipng.sourceforge.net/
I hope it perfectly work
wow thanks bro, that's way i need to learn about it
For optimizing apks, aside from fixAllAPKs by omniwolf, I found another one.
Note: I have no responsibility for breaking your ROM, so backup first.
Rights: No rights reserved, you can do whatever you like.
The classes.dex files have significant amount of debug infos in it, striping out those can reduce file size and increase some performance. I test it with all /system/app/ and /system/framework/ files, the ROM runs snapier, especially when you launching apps. Stripe out those debug info doesn't hurt anything, they are usefull only for original developer and one who wants to mod it, but you can always keep a copy of the original one for modding and debugging purpose.
Note that this does not boost performance like increase CPU freq, but the theory is, since the file size is reduced, dex and dalvik-cache became smaller in size, occupies memories smaller, thus processing is faster, and saves a little battery life, you can think it as something like optipng does.
Note also, you don't need to specify 0 compression, dex will be decompressed to /data/dalvik-cache, just use fixAllAPKs for fixing files inside APK that should not be compressed, and 0 compression for file type like xml isn't really a good idea.
Don't use this for ICS Framework files yet, there are specific files will causes surprising bugs when recompiled, but I'm lazy to find it out why and what, so just don't do it.
For FixAllAPKs, original thread here, http://forum.xda-developers.com/showthread.php?t=1123463
or post #36 by carl1961 http://forum.xda-developers.com/showpost.php?p=21458549&postcount=36
==========================================================================================================
RemoveDebuggingInfo_v2.2:
API Level must be specified to get 100% compatibility, it seems not forward nor backward compatible.
Froyo = 8, GB = 10, ICS4.0 ~ 4.0.2 = 14, ICS 4.0.3 = 15
Added API Level chooser, default 15 (ICS 4.0.3)
Added more descriptions.
Correct typos.
==========================================================================================================
depricated...
RemoveDebuggingInfo_v2.1:
First, Thanks to all who corrects me.
fix typo for menu selection 6
fix path for pulling for adb to work without setting PATH env variable
fix pushing framework to wrong directory
update smali/baksmali to v1.3.2
update script to compile/decompile using api level 15
added menu selection of fixAllAPKs
Instructions: Important
The default config is for ICS 4.03 base ROM, if you are gonna use it for Gingerbread Base ROM, need to edit the file RemoveDebuggingInfo.bat, and change the -a 15 to -a 10 for API level 10, then just double click start.bat and follow the on screen instruction.
java -jar baksmali-1.3.2.jar -b -a 10 -o .\classes .\classes.dex
java -jar smali-1.3.2.jar -a 10 .\classes -o .\classes.dex
Click to expand...
Click to collapse
Using API level 10 for ICS and API level 15 for GB will not work, you phone will just hang or endless reboots.
Pushing framework will reset all your settings, so if you choose to push framework, do a factory reset instead and just re-install your user apps.
After pushing /system/app, you must reboot to recovery and wipe dalvik and cache, another way of pushing is boot to recovery, mount /system then push.
I have only tested on Gingerbread 2.08.401.1 base, have no idea for ICS, but it should work, as the latest smali/baksmali supports ICS.
If you experience glitches, do it from the beginning by using un-modified apk and jar.
How it works: it is just baksmali (decompile dex to smali code WITHOUT debugging info) and then smali (compile back to dex)
Requirements: java and htc sync usb driver.
==========================================================================================================
Depricated - too much error.
RemoveDebuggingInfo_v2:
Added another script for simpler operations, instead of dragging hundreds of APKs, it is self descriptive, can pull and push /system/app, /system/framework, optimizing all files for app and framework, and reboot to recovery.
Tested on v2.08.401.1 ROM, on all files /system/app, /system/framework, should work on other device and ROM too, but not sure, test it yourself!
==========================================================================================================
For /data/app/ user application files, modify it may not installed at all, re-sign it also not help, so just do it manually to test.
But for now, here is a way to do it manually, since /system partition will not grow and many spaces left, you can simply put some APP on this partition, and following are working on my ROM, some should have naming as com.a.b.c... whatever is the name installed on /data/app/ stripe out the -1 at the end. Just besure the APP is uninstalled before pushing to /system/app/
Below are what I tested.
AdobePhotoshopExpress.apk
BarcodeScanner.apk
com.evernote.skitch.apk
ESFileExplorer.apk
GoogleDocs.apk
GoogleGoggles.apk
GoogleTranslate.apk
GPSTest.apk
org.hermit.audalyzer.apk
For APKs that has lib folder, you can just extract it and put it on /system/lib/ then del the lib folder inside the apk archive, e.g. flashplayer, adobereader.
adb should be start only once after booting your PC, if you get issues, like adb always shows restarting and out of date, it is because the included adb.exe in htc sync is out of date, and you had installed android sdk with environmental variable set, to fix it, both must have same version, or simply delete one of them, and if you have path variable set, you can del the included adb.exe as well.
Thanks for this, I will be sure to use it
Sent from my HTC Sensation XE with Beats Audio Z715e using xda premium
I have 189 Apps in system/app .... is there a way to make it with all files!?
Jonny said:
Thanks for this, I will be sure to use it
Just out of interest, what program do you use for getting the smali code?
Click to expand...
Click to collapse
It is the one and only, baksmali.jar and smali.jar http://code.google.com/p/smali/
xtcislove said:
I have 189 Apps in system/app .... is there a way to make it with all files!?
Click to expand...
Click to collapse
Yes I know it is so much, but need to write a sohphisticated code, maybe if I have time, I'll try to make it more easier, a vbscript or cmd script, or a shell script in linux. And don't forget the framework files too.
mudhi said:
I test it with all /system/app/ and /system/framework/ files, the ROM runs snapier, especially when you launching apps.
Click to expand...
Click to collapse
It is really so. I have checked it up.
mudhi said:
It is the one and only, baksmali.jar and smali.jar http://code.google.com/p/smali/
Click to expand...
Click to collapse
Thank you mudhi
a little off topic here, Is there a way to change smali files into a readable code (let's say i want to use it with eclipse !!)
i have tried searching and i came across Dex2Jar and jd-gui !!
my question here is: is there a way to use smali files into Eclipse ??
Alfaifi said:
Thank you mudhi
a little off topic here, Is there a way to change smali files into a readable code (let's say i want to use it with eclipse !!)
i have tried searching and i came across Dex2Jar and jd-gui !!
my question here is: is there a way to use smali files into Eclipse ??
Click to expand...
Click to collapse
Yes, use dex2jar to jar archive file, then jd-gui to view the source, you can also use DJ-decompiler (commercial) to view and change code, but that's not really readable, and compile back is too hard, and also jbe, ce etc... but I came to a conclusion.
Use dex2jar to decompile dex and use jd-gui to view the source for understand logic, method etc... and just reference it to smali code, and if you get use to it, hacking app will be easier, perhaps more easier than viewing the source code, because hackiing involviing mostly on 0 to 1, true to false, jump to where ... and that is only adding or changing a single code in smali, e.g. logic if a == b then c, if you want to make it always c, then just if 0 == 0 then c, or just a simple jump etc...
@mudhi new smali/baksmali 1.3.2 is out
And is also possible to remove debugging info from jar files that are present in framework folder?
texture said:
And is also possible to remove debugging info from jar files that are present in framework folder?
Click to expand...
Click to collapse
I think you can just rename them to .apk and then back to .jar.
mike1986. said:
I think you can just rename them to .apk and then back to .jar.
Click to expand...
Click to collapse
No you dont need to, just put(or pull) all framework files (both apks and jars) and it will process them all automatically.
Btw i just ran this on InsertCoin 4.1.1 for all APPS and Framework except i changed a script a bit (added -mx0) so it compresses APKS with 0 compression.
And can tell you that phone definitively feels faster, boots faster, apps open faster, and there a bit more free RAM available now.
Thank you mudhi allot for this!
mike1986. said:
@mudhi new smali/baksmali 1.3.2 is out
Click to expand...
Click to collapse
ah... hehe thank you, supposed ICS 4.0.3 is supported. Thank you!
Need a little clarification ..
java -version
if errorlevel 1 goto javaerr
---------------------
C:\>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.
---------------------
I installed java however still get an error ..
What is needed > to install ? Link Maybe ?
Also ... I found a small ops in the bat file ..
:javaerr
cls
echo Java is not found, please install java and rerun the script.
echo Hit anykey to quit
PAUSE
goto end < forgot this ?
Thanks ..
WarlockW said:
Need a little clarification ..
java -version
if errorlevel 1 goto javaerr
---------------------
C:\>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.
---------------------
I installed java however still get an error ..
What is needed > to install ? Link Maybe ?
Also ... I found a small ops in the bat file ..
:javaerr
cls
echo Java is not found, please install java and rerun the script.
echo Hit anykey to quit
PAUSE
goto end < forgot this ?
Thanks ..
Click to expand...
Click to collapse
You need to set java variable, here's how-to:
http://java.com/en/download/help/path.xml
mudhi, You've got few errors in start.bat file. If you want to pull the apps to "app" folder, use this command "adb pull /system/app/ app". If you do cd app, It won't find the adb in the app folder and won't do nothing.
ivicask said:
No you dont need to, just put(or pull) all framework files (both apks and jars) and it will process them all automatically.
Btw i just ran this on InsertCoin 4.1.1 for all APPS and Framework except i changed a script a bit (added -mx0) so it compresses APKS with 0 compression.
And can tell you that phone definitively feels faster, boots faster, apps open faster, and there a bit more free RAM available now.
Thank you mudhi allot for this!
Click to expand...
Click to collapse
Before optimizing with this script, my apks are all fixed with the vbscript by omniwolf, it only compress files that should be compressed, the script fixAllAPKs.vbs can be used before or after this. Anyway, I'll add a decision to run the script.
mudhi said:
Before optimizing with this script, my apks are all fixed with the vbscript by omniwolf, it only compress files that should be compressed, the script fixAllAPKs.vbs can be used before or after this. Anyway, I'll add a decision to run the script.
Click to expand...
Click to collapse
Is there any problem with doing 0 compression on all files? I dont have space problems, and doesnt that make phone run faster as it doesnt need to decompress any data? Saves both CPU and RAM?
drms12 said:
mudhi, You've got few errors in start.bat file. If you want to pull the apps to "app" folder, use this command "adb pull /system/app/ app". If you do cd app, It won't find the adb in the app folder and won't do nothing.
Click to expand...
Click to collapse
Oh yes, I know where's the error, because I have android sdk installed and environmental PATH variable are set, you can fix it by just set the PATH variable with where the adb.exe exist.
Or just change the script with this
ullapp
cd app
../adb pull /system/app/
or
ullapp
adb pull /system/app/ app
same as pullframe
mudhi said:
Oh yes, I know where's the error, because I have android sdk installed and environmental PATH variable are set, you can fix it by just set the PATH variable with where the adb.exe exist.
Or just change the script with this
ullapp
cd app
../adb pull /system/app/
or
ullapp
adb pull /system/app/ app
same as pullframe
Click to expand...
Click to collapse
Yes
I think you forgot to update the download, It still ver2.
There is an error in script - the push command to upload files to framework uploads them to /system/app
ICS 4.0.3 - got bootloop just after lockscreen shows. Had to restore system.
Hi all the great ppl out there!!!
All I want is just a simple and easy pre-setup'd flashable zip.
as long as it can pushes any files in and fix their permissions to 0644……
I am not sure if all the meta-inf do the same thing.
Really appreciated guys!
xstormli said:
Hi all the great ppl out there!!!
All I want is just a simple and easy pre-setup'd flashable zip.
as long as it can pushes any files in and fix their permissions to 0644……
I am not sure if all the meta-inf do the same thing.
Really appreciated guys!
Click to expand...
Click to collapse
Heres the thing, it would be very risky to make a file that just auto flashes and sets permissions to anything/everything its set to flash with permissions to 0644. You have to manually type the lines out.
There is no syntax that sets the script to do that kind of analysis. I THINK THERE ISN'T.
I assume by old example there was something with if ( directory ) = true then set_perm_recursive?
By thinking of it now, it may be possible, but you can break other stuff un-intentionally.
For example, I want to update something in my core system files to permissions 644. But in this folder there are other critical system files with permissions 0755. I could use set_perm 0,0, 0755, 0644. The folder is set to rwx rx rx and every file inside is set to rw r r. Problem is that if the other files needed other permissions that isnt rw r r, you can cause trouble ranging from small to huge.
This is heavy stuff. I dont think CWM has a syntax smart enough to that level to do such a thing. Still possible though. If you want to take the risk of doing that, then sure go ahead .
Excuse me for my bad arrangement of words. Im just really tired.
I can help and provide a zip file with the proper structures set up. All you have to do is learn the syntax for updater-script
then go script!
EDIT: In addition, the partitions for the devices are different across. mmcblk0p19 is system partition ( i think ) on GT-i9505, but thats not the same for every device. Doing what you request may cause bricks when used for different devices.
baboomerang said:
Heres the thing, it would be very risky to make a file that just auto flashes and sets permissions to anything/everything its set to flash with permissions to 0644. You have to manually type the lines out.
There is no syntax that sets the script to do that kind of analysis. I THINK THERE ISN'T.
I assume by old example there was something with if ( directory ) = true then set_perm_recursive?
By thinking of it now, it may be possible, but you can break other stuff un-intentionally.
For example, I want to update something in my core system files to permissions 644. But in this folder there are other critical system files with permissions 0755. I could use set_perm 0,0, 0755, 0644. The folder is set to rwx rx rx and every file inside is set to rw r r. Problem is that if the other files needed other permissions that isnt rw r r, you can cause trouble ranging from small to huge.
This is heavy stuff. I dont think CWM has a syntax smart enough to that level to do such a thing. Still possible though. If you want to take the risk of doing that, then sure go ahead .
Excuse me for my bad arrangement of words. Im just really tired.
I can help and provide a zip file with the proper structures set up. All you have to do is learn the syntax for updater-script
then go script!
EDIT: In addition, the partitions for the devices are different across. mmcblk0p19 is system partition ( i think ) on GT-i9505, but thats not the same for every device. Doing what you request may cause bricks when used for different devices.
Click to expand...
Click to collapse
Thanks for the hints mate. oh well, the thing is that I am not a CS major person, I don't have much knowledge to the script world……I tried to read through SuperSU update-script yesterday, all i can understand is about, let's say, 50%, at most, lol. Is there anything that i can read to enrich my CS knowledge in the world of Android? I would be so proud of myself.
http://forum.xda-developers.com/showthread.php?t=2377695
xstormli said:
Thanks for the hints mate. oh well, the thing is that I am not a CS major person, I don't have much knowledge to the script world……I tried to read through SuperSU update-script yesterday, all i can understand is about, let's say, 50%, at most, lol. Is there anything that i can read to enrich my CS knowledge in the world of Android? I would be so proud of myself.
Click to expand...
Click to collapse
You may not believe me, but this forum post is the only thing I used to learn the script language. Im not even a computer science major. Derp
This thread:
http://forum.xda-developers.com/showthread.php?t=2377695
And this one:
http://forum.xda-developers.com/showthread.php?t=1669489
Also try to make your own script. Noone gets this by first shot. I failed very hard before . Just keep practicing. If you need one more tip all I can say is this. When you make a typo in the command for the script, you will almost always get a status 6 error. Like when you miss the semicolon after every action you do. Status 7 can mean many things. Just try and do your best
This one is what might you are looking for.
Open the zip (do not extract)...
Place any file to RootFlasher.zip/system/app when you need to flash apps on system/app like SystemUI.apk
And RootFlasher.zip/system/framework when you need to flash app on system/framework like framework-res.apk
(It auto fix permission to rw-r-r too.)
Just ignore the fonts, media and vendor folder under system folder inside that zip file
(just focus on app and framework folder).
I haven't used before those folder I want you to ignore.
Credits to original developer.
My friend who gave it to me just got this file here on XDA too.
I guess this is it?!
Odlanyer22 said:
This one is what might you are looking for.
Open the zip (do not extract)...
Place any file to RootFlasher.zip/system/app when you need to flash apps on system/app like SystemUI.apk
And RootFlasher.zip/system/framework when you need to flash app on system/framework like framework-res.apk
(It auto fix permission to rw-r-r too.)
Just ignore the fonts, media and vendor folder under system folder inside that zip file
(just focus on app and framework folder).
I haven't used before those folder I want you to ignore.
Credits to original developer.
My friend who gave it to me just got this file here on XDA too.
Click to expand...
Click to collapse
Thanks buddy! I'll take a look later. I think this is it.
I like modify all my ROMs, and in Android 5.0, the /system is on a system.dat and I don't know how to extract it, please help me
Up ?
I am up to this too. Before this .dat thing was very easy to de-bloat the ROM before installing it.
A different approach is to have a flashable zip with an updater- script that deletes apps / files and adds / changes etc. Its a bit more work at the beginning but it will save you editing every ROM zip you download as it'll only take a second to flash it.
rootSU said:
A different approach is to have a flashable zip with an updater- script that deletes apps / files and adds / changes etc. Its a bit more work at the beginning but it will save you editing every ROM zip you download as it'll only take a second to flash it.
Click to expand...
Click to collapse
Can you provide/point us a simple tutorial for making a simple flashable script that removes apps?
Thanks.
01 Vlatce said:
Can you provide/point us a simple tutorial for making a simple flashable script that removes apps?
Thanks.
Click to expand...
Click to collapse
I uploaded mine in this thread:
http://forum.xda-developers.com/google-nexus-5/help/editing-build-prop-via-flashable-zip-t2949308
Please note, it deletes some stuff, adds anything in the /system folder of the zip to your /system partition and also runs a bash shell script (.sh) to modify the build prop. If you look in the updater-script, you should be able to figure it out from there.
rootSU said:
I uploaded mine in this thread:
http://forum.xda-developers.com/google-nexus-5/help/editing-build-prop-via-flashable-zip-t2949308
Please note, it deletes some stuff, adds anything in the /system folder of the zip to your /system partition and also runs a bash shell script (.sh) to modify the build prop. If you look in the updater-script, you should be able to figure it out from there.
Click to expand...
Click to collapse
Already figured it out. Thank you!
you can also get an ext4 fs editor (the .dat is actually an ext4 image), such as ext4_unpacker and so on
http://forum.xda-developers.com/showthread.php?p=57633970