[GUIDE] Create your own Flashable ZIP with custom updater-script and addon.d script - Android General

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
FOR WHO? AND WHY?
• Everyone who wants to learn something today
• Do something yourself instead of relying on a 3rd party app/system.
• Remove/Add system apps
• Modify DPI
• Backup/Restore apps to survive a dirty flash
• Apply a custom font
• Apply a custom bootanimation
• Install a new ringtone
• and so on.
Basically removing/adding system stuff can be easily done through a file manager but it takes time and we have to do it whenever we update a custom ROM.
A couple of examples:
1. Customizing GApps packages: if you don't use all apps that are provided then you can simply remove them
2. Viper4Android: V4A is an awesome audio app and it's highly recommended to remove other audio apps/tweaks like AudioFX.
Click to expand...
Click to collapse
We will see how to add and remove system components. Once again, it can be done manually but your phone has to be booted into Android then it needs a reboot to apply the changes.
The last part is for the addon.d script. Your custom system changes will survive a dirty flash. No need to flash a zip file for each update
WHAT DO YOU NEED?
1. A good file manager: MiXplorer, Solid Explorer, ES File Explorer (jk )...
2. ZipSigner to sign your zip (or MiX Signer if you use MiXplorer // add-on available in the XDA thread)
3. A nandroid backup is recommended before using those scripts
4. Prepare your custom files: apk, gps.conf, ringtone, bootanimation,... Everything you want to add after a clean flash.
5. Free time. No young children around you
TEMPLATE AND MY CUSTOM ZIP
I'm a nice guy so I prepared a template. You can either download my own zip and customize it to your needs or use this template as a base to create your own zip "from scratch".
→ TEMPLATE: DOWNLOAD LINK (basic commands / you have to add your custom values: apps, paths of ringtones, bootanimation...)
→ MY ZIP: DOWNLOAD LINK (examples are always welcome to better understand an explanation. It can help to understand how to structure your files).
The template should be enough to start using a custom script.
SOME INFORMATIONS TO REMEMBER
Here are the paths of the main things we want to change in the /system partition (should work for most recent Android versions but check your system to be sure):
• addon.d => backup script to survive a dirty flash (used by GApps package for instance)
• app and priv-app => system apps to add or remove
• etc => host file
• fonts => your font
• media => your bootanimation.zip
• media > audio > alarms => sounds for alarms
• media > audio > notifications => sounds for notifications
• media > audio > ringtones => sounds for ringtones
• media > audio > ui => sounds for various things such as low battery, unlock, camera,..
• root of /system for build.prop file
Click to expand...
Click to collapse
Files that have been removed will be installed again after a dirty flash.
Files that have been manually added will be removed after a dirty flash.
=> That's why we need a script to backup our modifications!
NO space at the end of the lines
UNDERSTAND HOW IT WORKS
PART 1: UPDATER-SCRIPT
Here is mine:
ui_print("+-------------------------------------+");
ui_print("| CLEAN FLASH SCRIPT |");
ui_print("| |");
ui_print("| by Primokorn |");
ui_print("+-------------------------------------+");
run_program("/sbin/busybox", "umount", "/system");
run_program("/sbin/busybox", "mount", "/system");
ui_print(" ");
ui_print("***Deleting bloatwares***");
delete_recursive(
"/system/app/adaway.apk",
"/system/app/AdAway",
"/system/app/BasicDreams",
"/system/app/BookmarkProvider",
"/system/app/Calendar",
"/system/app/CalendarWidget",
"/system/app/CMFileManager",
"/system/app/CMWallpapers",
"/system/app/DeskClock",
"/system/app/Eleven",
"/system/app/Email",
"/system/app/ExactCalculator",
"/system/app/Exchange2",
"/system/app/Gello",
"/system/app/HexoLibre",
"/system/app/Jelly",
"/system/app/LiveWallpapersPicker",
"/system/app/LockClock",
"/system/app/messaging",
"/system/app/MiXplorer",
"/system/app/NexusLauncher",
"/system/app/Phonograph",
"/system/app/PhotoTable",
"/system/app/PicoTts",
"/system/app/PicoTTS",
"/system/app/ResurrectionStats",
"/system/app/SoundRecorder",
"/system/app/Terminal",
"/system/app/TugaBrowser",
"/system/app/Wallpaper",
"/system/app/WallpaperPickerGoogle",
"/system/priv-app/AudioFX",
"/system/priv-app/Chrome",
"/system/priv-app/Gallery2",
"/system/priv-app/MusicFX",
"/system/priv-app/OnePlusCamera",
"/system/priv-app/OnePlusGallery",
"/system/priv-app/OnePlusMusic",
"/system/priv-app/Recorder",
"/system/priv-app/Screencast",
"/system/priv-app/Snap",
"/system/priv-app/SnapdragonCamera",
"/system/priv-app/SnapdragonGallery",
"/system/priv-app/WeatherManagerService",
"/system/priv-app/WeatherProvider",
"/system/priv-app/Tag"
);
ui_print("Installing apps and mods, etc");
show_progress(8.800000, 5);
package_extract_dir("system", "/system/");
ui_print("***Fixing permissions***");
set_perm(0, 0, 0755, "/system/addon.d/99-dirty.sh");
set_perm(0, 0, 0644, "/system/etc/gps.conf");
set_perm(0, 0, 0644, "/system/fonts/Roboto-Regular.ttf");
set_perm(0, 0, 0644, "/system/media/audio/ringtones/PlasticRing.ogg");
set_perm(0, 0, 0644, "/system/priv-app/Phonesky.apk");
set_perm(0, 0, 0644, "/system/priv-app/microG.apk");
set_perm(0, 0, 0644, "/system/priv-app/Gsam.apk");
set_perm(0, 0, 0644, "/system/priv-app/BBS.apk");
set_perm(0, 0, 0644, "/system/priv-app/V4A-Magisk.apk");
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data/");
set_perm(0, 0, 0755, "/data/local/afscript.sh");
show_progress(8.800000, 5);
run_program("/sbin/busybox", "umount", "/data");
run_program("/sbin/busybox", "umount", "/system");
ui_print(" ");
ui_print("Done.");
ui_print("Ready to reboot.");
Note: ui_print(" "); is for text message. These lines don't do anything.
1/ It's a good practice to unmount then mount the partition before working on it.
run_program("/sbin/busybox", "umount", "/system");
run_program("/sbin/busybox", "mount", "/system");
Click to expand...
Click to collapse
2/ Remove system components. Put a comma at the end of each line EXCEPT the last one.
delete_recursive(
"/system/app/adaway.apk",
"/system/app/AdAway",
........................
"/system/priv-app/WeatherProvider",
"/system/priv-app/Tag"
);
Click to expand...
Click to collapse
3/ Extract the system files I want to install
package_extract_dir("system", "/system/");
Click to expand...
Click to collapse
4/ Set the permissions for the files that I add
set_perm(0, 0, 0755, "/system/addon.d/99-dirty.sh");
..............
set_perm(0, 0, 0644, "/system/priv-app/V4A-Magisk.apk");
Click to expand...
Click to collapse
5/ Same thing but for the /data folder (mount the partition > extract the data I want to add > set the permissions)
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data/");
set_perm(0, 0, 0755, "/data/local/afscript.sh");
Click to expand...
Click to collapse
6/ Unmount the modified partitions
run_program("/sbin/busybox", "umount", "/data");
run_program("/sbin/busybox", "umount", "/system");
Click to expand...
Click to collapse
PART 2: ADDON.D
Here is mine:
#!/sbin/sh
#
# /system/addon.d/99-dirty.sh
# /system is formatted and reinstalled, then thes files are restored.
#
. /tmp/backuptool.functions
list_files() {
cat <<EOF
addon.d/99-dirty.sh
fonts/Roboto-Regular.ttf
media/audio/ringtones/PlasticRing.ogg
priv-app/BBS.apk
priv-app/Gsam.apk
priv-app/microG.apk
priv-app/PhoneSky.apk
priv-app/V4A-Magisk.apk
etc/gps.conf
etc/hosts
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/"$FILE"
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
done
rm -rf /system/app/adaway.apk
rm -rf /system/app/AdAway
rm -rf /system/app/BasicDreams
rm -rf /system/app/BookmarkProvider
rm -rf /system/app/Calendar
rm -rf /system/app/CalendarWidget
rm -rf /system/app/CMFileManager
rm -rf /system/app/CMWallpapers
rm -rf /system/app/DeskClock
rm -rf /system/app/Eleven
rm -rf /system/app/Email
rm -rf /system/app/ExactCalculator
rm -rf /system/app/Exchange2
rm -rf /system/app/Gello
rm -rf /system/app/HexoLibre
rm -rf /system/app/Jelly
rm -rf /system/app/LatinIME
rm -rf /system/app/LiveWallpapersPicker
rm -rf /system/app/LockClock
rm -rf /system/app/messaging
rm -rf /system/app/MiXplorer
rm -rf /system/app/NexusLauncher
rm -rf /system/app/Nova.apk
rm -rf /system/app/Phonograph
rm -rf /system/app/PhotoTable
rm -rf /system/app/PicoTts
rm -rf /system/app/PicoTTS
rm -rf /system/app/ResurrectionStats
rm -rf /system/app/SoundRecorder
rm -rf /system/app/Terminal
rm -rf /system/app/TugaBrowser
rm -rf /system/app/Wallpaper
rm -rf /system/app/WallpaperPickerGoogle
rm -rf /system/priv-app/AudioFX
rm -rf /system/priv-app/Chrome
rm -rf /system/priv-app/Gallery2
rm -rf /system/priv-app/LatinIME
rm -rf /system/priv-app/MusicFX
rm -rf /system/priv-app/OnePlusCamera
rm -rf /system/priv-app/OnePlusGallery
rm -rf /system/priv-app/OnePlusMusic
rm -rf /system/priv-app/Recorder
rm -rf /system/priv-app/Screencast
rm -rf /system/priv-app/SnapdragonCamera
rm -rf /system/priv-app/SnapdragonGallery
rm -rf /system/priv-app/Snap
rm -rf /system/priv-app/Trebuchet
rm -rf /system/priv-app/WeatherManagerService
rm -rf /system/priv-app/WeatherProvider
rm -rf /system/priv-app/Tag
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac
1/ Files that I want to keep after a dirty flash
list_files() {
cat <<EOF
addon.d/99-dirty.sh
fonts/Roboto-Regular.ttf
media/audio/ringtones/PlasticRing.ogg
priv-app/BBS.apk
priv-app/Gsam.apk
priv-app/microG.apk
priv-app/PhoneSky.apk
priv-app/V4A-Magisk.apk
etc/gps.conf
etc/hosts
EOF
}
Click to expand...
Click to collapse
2/ Files I don't want to be installed after a dirty flash
rm -rf /system/app/adaway.apk
rm -rf /system/app/AdAway
rm -rf /system/app/BasicDreams
rm -rf /system/app/BookmarkProvider
................................................
rm -rf /system/priv-app/WeatherProvider
rm -rf /system/priv-app/Tag
;;
Click to expand...
Click to collapse
CREATE YOUR FLASHABLE ZIP
The steps below are done with MiXplorer file manager.
1. Select all your folders and select Archive.
2. Confirm the creation of the archive file.
View attachment 4182479
3. Enter the name of your file and select Store.
4. Your flashable zip has been created.
5. Select your zip file then Sign.
6. Select TESTKEY.
7. Your final flashable zip is created (xxx-signed.zip). This is the file you will flash from your custom recovery. You can safely remove the first zip file.
NOTES:
• your flashable zip has to be installed after a clean flash (or after wiping /system partition and making a dirty flash of your ROM custom). The updater-script will immediately remove/add the desired apps/folders. Leave your addon.d script alone. It will do its job without any user intervention.
Check your /system partition after the first installations to be sure that everything is working as expected.
• if you have something better to share or tips then let us know.
• all credits go to the people who shared their findings with the community. I picked up various information so this is more a general guide to create a custom updater-script and addon.d script.
• I recommend to keep an eye on the template or my zip when reading this guide.
• Ref: [TUTORIAL] The updater-script completely explained

HOW TO EDIT YOUR BUILD.PROP
If you want to modify your build.prop or add new lines then follow those steps.
1. Create a new .sh file (e.g build_prop.sh)
2. To modify specific lines:
sed -i 's/original_value/new_value/g' /system/build.prop;
Example for LCD Density (from 480 to 420):
sed -i 's/ro.sf.lcd_density=480/ro.sf.lcd_density=420/g' /system/build.prop;
Click to expand...
Click to collapse
3. To add new lines:
echo "your_value" >> /system/build.prop;
Example for Viper4Android (if you don't have those lines):
echo "IPA.decode=false" >> /system/build.prop;
echo "tunnel.decode=false" >> /system/build.prop;
echo "lpa.use-stagefright=false" >> /system/build.prop;
Click to expand...
Click to collapse
4. In your build_prop.sh file copy this
Code:
#!/sbin/sh
Then add your sed and echo lines
Example:
#!/sbin/sh
sed -i 's/ro.sf.lcd_density=480/ro.sf.lcd_density=420/g' /system/build.prop;
echo "IPA.decode=false" >> /system/build.prop;
echo "tunnel.decode=false" >> /system/build.prop;
echo "lpa.use-stagefright=false" >> /system/build.prop;
Click to expand...
Click to collapse
Copy your script into your flashable zip (system folder). That's it for the .sh script.
5. Now you have to create your updater-script into your flashable zip (see OP if you don't know how to do that).
Here is what you need to put:
Code:
ui_print("+--------BUILD-PROP-EDITION----------+");
run_program("/sbin/busybox", "umount", "/system");
run_program("/sbin/busybox", "mount", "/system");
show_progress(8.800000, 5);
package_extract_dir("system", "/system/");
ui_print("***Fixing permissions***");
set_perm(0, 0, 0777, "/system/build_prop.sh");
run_program("/sbin/sh", "system/build_prop.sh");
show_progress(8.800000, 5);
delete_recursive(
"/system/build_prop.sh"
);
run_program("/sbin/busybox", "umount", "/system");
ui_print(" ");
ui_print("Completed.");
What does it do? This will extract your build_prop.sh file into /system partition, set the permissions and delete your script.
6. Create your flashable zip and sign it as explained in the previous post.
7. Reboot into TWRP and flash!
I have attached a compressed file as an example.

Thank you! Will try this later
---------- Post added at 04:34 PM ---------- Previous post was at 03:45 PM ----------
Im so newbie with this kind of stuff, that i have to ask for specific info.
As i told in another topic, i need to keep my /system/app/Calculator/Calculator.apk when im flashing my rom update.
If i understand correctly, it can be done with addon.d script automatically, without flashing any zips?

raimopeku said:
Thank you! Will try this later
---------- Post added at 04:34 PM ---------- Previous post was at 03:45 PM ----------
Im so newbie with this kind of stuff, that i have to ask for specific info.
As i told in another topic, i need to keep my /system/app/Calculator/Calculator.apk when im flashing my rom update.
If i understand correctly, it can be done with addon.d script automatically, without flashing any zips?
Click to expand...
Click to collapse
Exactly. You can only create a .sh file into addon.d folder.
Use the following at the beginning:
Code:
list_files() {
cat <<EOF
app/Calculator/Calculator.apk
EOF
}

i remove some of the addons on your updater script.
because i only want the bloatware removal scripts. Can you check if this is correct.
ui_print("+-------------------------------------+");
ui_print("| bloatware removal script |");
ui_print("| |");
ui_print("| !!!BYE BYE!!! |");
ui_print("+-------------------------------------+");
run_program("/sbin/busybox", "umount", "/system");
run_program("/sbin/busybox", "mount", "/system");
ui_print(" ");
ui_print("***Deleting bloatwares***");
delete_recursive(
"/system/priv-app/Launcher3",
"/system/priv-app/MusicFX"
);
run_program("/sbin/busybox", "unmount", "/system");
ui_print(" ");
ui_print("Completed.");
ui_print("Enjoy!");

mixtapes08 said:
i remove some of the addons on your updater script.
because i only want the bloatware removal scripts. Can you check if this is correct.
ui_print("+-------------------------------------+");
ui_print("| bloatware removal script |");
ui_print("| |");
ui_print("| !!!BYE BYE!!! |");
ui_print("+-------------------------------------+");
run_program("/sbin/busybox", "umount", "/system");
run_program("/sbin/busybox", "mount", "/system");
ui_print(" ");
ui_print("***Deleting bloatwares***");
delete_recursive(
"/system/priv-app/Launcher3",
"/system/priv-app/MusicFX"
);
run_program("/sbin/busybox", "unmount", "/system");
ui_print(" ");
ui_print("Completed.");
ui_print("Enjoy!");
Click to expand...
Click to collapse
It should work BUT Launcher3 is stored into /system/app/. Moreover you need a launcher to reach a homescreen. In other words, if you remove Launcher3 after a clean flash then you have to install another launcher.
I forgot to explain how to sign the final zip. I'll add this in the coming hours.

On pure nexus its located on system/priv-app and I have a novalauncher.zip that i will install after flashing. I have a installer.zip here. Can i copy my modified updater-script there?
Sent from my Nexus 5

mixtapes08 said:
On pure nexus its located on system/priv-app and I have a novalauncher.zip that i will install after flashing. I have a installer.zip here. Can i copy my modified updater-script there?
Sent from my Nexus 5
Click to expand...
Click to collapse
Of course. Do not forget to remove run_program lines if you already have them in the other file :good:

Thanks. Man.
Sent from my Nexus 5

PART 3 added to create and sign your flashable zip.

Primokorn said:
Exactly. You can only create a .sh file into addon.d folder.
Use the following at the beginning:
Code:
list_files() {
cat <<EOF
app/Calculator/Calculator.apk
EOF
}
Click to expand...
Click to collapse
So, i created that file in /system/addon.d/myfile.sh
And now when i updated my rom (euphoria), my old calculator was gone, and i had to manually it back?

raimopeku said:
So, i created that file in /system/addon.d/myfile.sh
And now when i updated my rom (euphoria), my old calculator was gone, and i had to manually it back?
Click to expand...
Click to collapse
Can you post your whole script? Are you using other scripts?

Primokorn said:
Can you post your whole script? Are you using other scripts?
Click to expand...
Click to collapse
hmm, there are 2 other scripts (made by rom i assume)
myfile.sh:
Code:
list_files() {
cat <<EOF
app/Calculator/Calculator.apk
EOF
}
50-eos.sh
Code:
#!/sbin/sh
#
# /system/addon.d/50-eos.sh
# During a upgrade, this script backs up /system/etc/hosts,
# /system is formatted and reinstalled, then the file is restored.
#
. /tmp/backuptool.functions
list_files() {
cat <<EOF
etc/hosts
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/"$FILE"
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac
70-gapps.sh
Code:
#!/sbin/sh
#
# /system/addon.d/70-gapps.sh
#
. /tmp/backuptool.functions
list_files() {
cat <<EOF
app/FaceLock/lib/arm/libfacelock_jni.so
app/FaceLock/lib/arm64/libfacelock_jni.so
app/FaceLock/FaceLock.apk
app/GoogleContactsSyncAdapter/GoogleContactsSyncAdapter.apk
etc/permissions/com.google.android.camera2.xml
etc/permissions/com.google.android.maps.xml
etc/permissions/com.google.android.media.effects.xml
etc/permissions/com.google.widevine.software.drm.xml
etc/preferred-apps/google.xml
framework/com.google.android.camera2.jar
framework/com.google.android.maps.jar
framework/com.google.android.media.effects.jar
framework/com.google.widevine.software.drm.jar
lib/libfilterpack_facedetect.so
lib64/libfilterpack_facedetect.so
lib/libjni_latinime.so
lib64/libjni_latinime.so
lib/libjni_latinimegoogle.so
lib64/libjni_latinimegoogle.so
priv-app/GoogleBackupTransport/GoogleBackupTransport.apk
priv-app/GoogleFeedback/GoogleFeedback.apk
priv-app/GoogleLoginService/GoogleLoginService.apk
priv-app/GoogleOneTimeInitializer/GoogleOneTimeInitializer.apk
priv-app/GooglePartnerSetup/GooglePartnerSetup.apk
priv-app/GoogleServicesFramework/GoogleServicesFramework.apk
priv-app/HotwordEnrollment/HotwordEnrollment.apk
priv-app/Phonesky/Phonesky.apk
priv-app/PrebuiltGmsCore/lib/arm/libAppDataSearch.so
priv-app/PrebuiltGmsCore/lib/arm/libconscrypt_gmscore_jni.so
priv-app/PrebuiltGmsCore/lib/arm/libdirect-audio.so
priv-app/PrebuiltGmsCore/lib/arm/libgcastv2_base.so
priv-app/PrebuiltGmsCore/lib/arm/libgcastv2_support.so
priv-app/PrebuiltGmsCore/lib/arm/libgmscore.so
priv-app/PrebuiltGmsCore/lib/arm/libgms-ocrclient.so
priv-app/PrebuiltGmsCore/lib/arm/libjgcastservice.so
priv-app/PrebuiltGmsCore/lib/arm/libNearbyApp.so
priv-app/PrebuiltGmsCore/lib/arm/libsslwrapper_jni.so
priv-app/PrebuiltGmsCore/lib/arm/libwearable-selector.so
priv-app/PrebuiltGmsCore/lib/arm/libWhisper.so
priv-app/PrebuiltGmsCore/lib/arm64/libAppDataSearch.so
priv-app/PrebuiltGmsCore/lib/arm64/libconscrypt_gmscore_jni.so
priv-app/PrebuiltGmsCore/lib/arm64/libdirect-audio.so
priv-app/PrebuiltGmsCore/lib/arm64/libgcastv2_base.so
priv-app/PrebuiltGmsCore/lib/arm64/libgcastv2_support.so
priv-app/PrebuiltGmsCore/lib/arm64/libgmscore.so
priv-app/PrebuiltGmsCore/lib/arm64/libgms-ocrclient.so
priv-app/PrebuiltGmsCore/lib/arm64/libjgcastservice.so
priv-app/PrebuiltGmsCore/lib/arm64/libNearbyApp.so
priv-app/PrebuiltGmsCore/lib/arm64/libsslwrapper_jni.so
priv-app/PrebuiltGmsCore/lib/arm64/libwearable-selector.so
priv-app/PrebuiltGmsCore/lib/arm64/libWhisper.so
priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk
priv-app/SetupWizard.apk
priv-app/Velvet/lib/arm/libcronet.so
priv-app/Velvet/lib/arm/libgoogle_speech_jni.so
priv-app/Velvet/lib/arm/libgoogle_speech_micro_jni.so
priv-app/Velvet/lib/arm64/libcronet.so
priv-app/Velvet/lib/arm64/libgoogle_speech_jni.so
priv-app/Velvet/lib/arm64/libgoogle_speech_micro_jni.so
priv-app/Velvet/Velvet.apk
usr/srec/en-US/c_fst
usr/srec/en-US/clg
usr/srec/en-US/commands.abnf
usr/srec/en-US/compile_grammar.config
usr/srec/en-US/contacts.abnf
usr/srec/en-US/dict
usr/srec/en-US/dictation.config
usr/srec/en-US/dnn
usr/srec/en-US/endpointer_dictation.config
usr/srec/en-US/endpointer_voicesearch.config
usr/srec/en-US/ep_acoustic_model
usr/srec/en-US/g2p_fst
usr/srec/en-US/grammar.config
usr/srec/en-US/hclg_shotword
usr/srec/en-US/hmm_symbols
usr/srec/en-US/hmmlist
usr/srec/en-US/hotword.config
usr/srec/en-US/hotword_classifier
usr/srec/en-US/hotword_normalizer
usr/srec/en-US/hotword_prompt.txt
usr/srec/en-US/hotword_word_symbols
usr/srec/en-US/metadata
usr/srec/en-US/norm_fst
usr/srec/en-US/normalizer
usr/srec/en-US/offensive_word_normalizer
usr/srec/en-US/phone_state_map
usr/srec/en-US/phonelist
usr/srec/en-US/rescoring_lm
usr/srec/en-US/wordlist
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.8/landmark_group_meta_data.bin
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.8/left_eye-y0-yi45-p0-pi45-r0-ri20.lg_32-tree7-wmd.bin
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.8/nose_base-y0-yi45-p0-pi45-r0-ri20.lg_32-tree7-wmd.bin
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.8/right_eye-y0-yi45-p0-pi45-r0-ri20.lg_32-3-tree7-wmd.bin
vendor/pittpatt/models/detection/yaw_roll_face_detectors.7.1/head-y0-yi45-p0-pi45-r0-ri30.4a-v24-tree7-2-wmd.bin
vendor/pittpatt/models/detection/yaw_roll_face_detectors.7.1/head-y0-yi45-p0-pi45-rn30-ri30.5-v24-tree7-2-wmd.bin
vendor/pittpatt/models/detection/yaw_roll_face_detectors.7.1/head-y0-yi45-p0-pi45-rp30-ri30.5-v24-tree7-2-wmd.bin
vendor/pittpatt/models/detection/yaw_roll_face_detectors.7.1/pose-r.8.1.bin
vendor/pittpatt/models/detection/yaw_roll_face_detectors.7.1/pose-y-r.8.1.bin
vendor/pittpatt/models/recognition/face.face.y0-y0-71-N-tree_7-wmd.bin
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/$FILE
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/$FILE $R
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
rm -rf /system/app/BrowserProviderProxy
rm -f /system/app/BrowserProviderProxy.apk
rm -rf /system/app/PartnerBookmarksProvider
rm -f /system/app/PartnerBookmarksProvider.apk
rm -rf /system/app/Provision
rm -f /system/app/Provision.apk
rm -rf /system/app/QuickSearchBox
rm -f /system/app/QuickSearchBox.apk
rm -rf /system/app/Vending
rm -f /system/app/Vending.apk
rm -rf /system/priv-app/BrowserProviderProxy
rm -f /system/priv-app/BrowserProviderProxy.apk
rm -rf /system/priv-app/PartnerBookmarksProvider
rm -f /system/priv-app/PartnerBookmarksProvider.apk
rm -rf /system/priv-app/Provision
rm -f /system/priv-app/Provision.apk
rm -rf /system/priv-app/QuickSearchBox
rm -f /system/priv-app/QuickSearchBox.apk
rm -rf /system/priv-app/Vending
rm -f /system/priv-app/Vending.apk
;;
esac

Your myfile.sh file is not complete. You have to use the whole code (just remove my custom lines: apps that I remove and audio_policy at the end).
Try this:
Code:
#!/sbin/sh
#
#
. /tmp/backuptool.functions
list_files() {
cat <<EOF
app/Calculator/Calculator.apk
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/"$FILE"
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac

Primokorn said:
Your myfile.sh file is not complete. You have to use the whole code (just remove my custom lines: apps that I remove and audio_policy at the end).
Try this:
Code:
#!/sbin/sh
#
#
. /tmp/backuptool.functions
list_files() {
cat <<EOF
app/Calculator/Calculator.apk
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/"$FILE"
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac
Click to expand...
Click to collapse
Ok, thanks m8! I updated my script, after next rom update ill report if it works

*** NEW ***
How to edit your build.prop in post 2.

The "Template" (MEGA) download link in the OP is dead. Please re-upload, thanks.

blowtorch said:
The "Template" (MEGA) download link in the OP is dead. Please re-upload, thanks.
Click to expand...
Click to collapse
I've uploaded my latest custom scripts. I also updated OP.

Primokorn said:
I've uploaded my latest custom scripts. I also updated OP.
Click to expand...
Click to collapse
I was wondering if there is any way you can help me with a flashable zip i am working on cant seem to get it to flash correctly I get the following error each time;
Updater process ended with signal:11

maxmotos said:
I was wondering if there is any way you can help me with a flashable zip i am working on cant seem to get it to flash correctly I get the following error each time;
Updater process ended with signal:11
Click to expand...
Click to collapse
Share your files and I'll have a look as soon as I can.

Related

[GUIDE][HOW-TO] customize your xperia phone

Let's customize our ROM.
This thread's goal is to make you understand better about your ROM, how to maintain it, and how to modify it to satisfy your desire. this thread is based of this thread http://forum.xda-developers.com/showthread.php?t=1590330 which I've write several months ago. however, our system is a lil bit different with the one in SGY. this thread will contain more specific information about ICS based rom especially the xperia phones.
I'll made this thread into several section. the first section will explain about the file structure in our system. the second one will tell you about app/system modification, and the thirdth one is about tweaking.
1. KNOW BETTER ABOUT YOUR SYSTEM
1.1 SYSTEM STRUCTURE
first of all, when I said "system" here, what I mean is all the stuff under your system partition. if you're browsing with your file explorer, it's all the files inside /system folder. please don't mix it with a complete android system. if you open your /system folder, you'll find these folders.
1. app : contain all the system's app and the odex file of system app
2. bin : contain the command and bin files for the rom
3. vendor: specified vendor system. you have your specific vendor's app, libs, and config files here.
4. etc : additional setting and files for the rom.
5. font : the fonts
6. framework : system's framework files and the odex file for framework
7. lib : drivers, modules, kernel related files for the rom
8. media : media files-ringtones, notification, bootanimation.
9. sd : folder created by a2sd darktremor. (only modified rom have it)
10. usr : files needed for keyboard, bluetooth, etc.
11. xbin : additional command and bin files (busybox is usually installed here)
12. build.prop file : contain your system default prop
13. ts.conf : a configuration file for your system. you'd better stay away from it.
1.2 DEODEX VS ODEX
Most of custom rom available is deodexed rom while our stock rom is half deodexed rom. I'll try to explain it in most simple way. First of all, we should understand that mostly every app in android consist of three part, *apk files, *dex/odex files, and lib files.
ODEXED rom means that *dex file needed to run the app is extracted from the apk file and placed in same folder with the apk files (/system/app). the positive side, it consume less internal memory and a execute faster. the negative side, it makes the app uncostumizable (cannot apply custom themes) and need more space in system partition.
DEODEXED rom means that *dex file needed to run the app is extracted from the apk file and placed in /data/dalvik-cache. the positive side, the app can be themed (full customizable) and consume less system partition. we could put more app in /system/app in deodexed rom. the negative side, it consume a lot of internal memory. please be cautious with the internal memory space if you use deodexed rom. (NOTE: if you start from stock rom, you may use dsixdia to convert odexed to deodexed rom).
2. APP/SYSTEM MODIFICATION
basicly, you modify your system in two ways. push a file to add/replace file into your system and modify your files with file explorer. it can be done in several ways. if you want to modify your system, you should remember these stuff:
1. file compatibilty : if you push a file, especially some apps, you should make sure that file is compatible with your system. some app require different framework, additional libs, and some other dependencies. make sure you already had all of them in your system.
2. correct file permission: some file don't need special permission. however, some other file require special permission like execution.
3. system free memory : you have limited system partition size. you can't put everything inside it. please be aware with the system partition size and the free memory.
4. always backup before doing everything.
2.1 ADD MORE APP INTO YOUR SYSTEM
it can be done in two ways. the first one, you can add that app into /system/app. the second one, you can add that app into /system/vendor/app. both of them works on xperia's phone. most of the files inside inside /system/vendor work just like in /system. so, if you have an apk in /system/vendor/app, it's not different with having that apk in /system/app. nevertheless, all file in /system/vendor is more prioritizied than the one in /system. it means, if you have two file with same name, the one in /system/vendor will be used instead of the one in /system.
please note that. this trick only work for anything under /system/vendor/app, /system/vendor/etc, and /system/vendor/lib. for an instance, if you create /system/vendor/framework, it won't recognized by system. this trick will usefull for you if you want to modifying your system without touching your original system files. you'll also easiliy distinguish your modification and easily remove it from your system without worying about bootloop.
Click to expand...
Click to collapse
2.2 CREATE THEME FOR YOR OWN ROM
simple theming stuff could be done by replacing the pic files inside the apk, especially framework-res.apk in /system/framework. a hardcore theming need apk modification. this thread doesn't recover about this stuff since it's too long. please search it by yourself if you interested about it. for a basic theme, you need to modify systemUI.apk and framework-res.apk. the systemUI.apk contain your statusbar. the framework-res.apk contain your system interface.
3. TWEAK UP YOUR ROM
there are a lot of tweak. I'll divide it into two categories. scripts and props. scripts, is a tweak run by specified script. this tweak only work if you have a rom with init.d support or you're using script manager app. most of these stuff can be found in /system/etc/init.d/.
props, is a file contain your system properties. the famous one your build.prop inside /system. aside of it you actually have default.prop but this file is stored in your ramdisk and can't be modified without kernel modification. you have a lot of method to modify your prop stuff.
1. modify your build.prop file. you can put your own prop or modify the prop value inside this file. seems easy, but this is the most risky one. you can brick your device easily if you're not carefull when modifying it. I don't recommend it for new android user.
2. create a file "local.prop" in /data. the less risky method. it works just like when you modify your build.prop directly. however, it's less risky since if you got bootloop, you only need to delete it and your device will revived. I always prefer this method for my rom modification
3. create script in init.d. the basic form will be
Code:
#!/system/bin/sh
# the custom prop
setprop <prop key><space><prop value>
for an instance, if you have a prop in your build.prop "dalvik.vm.heapsize=128m" you can type "setprop dalvik.vm.heapsize 128m" in your script. this trick is usefull if you're a rom modificator and want to install something which require specific prop. in this way, you don't need to know anything inside build.prop/local.prop. you can make an universal mod which can be installed on a lot of device. bravia engine mod works fine with this method.
BONUS FOR TWEAKERS
if you have time, you can rewrite all the stuff by yourself to avoid double typed script with different value. its easy but need a lil more patience. I'll try to give quick explanation. our tweaks mostly work via init.d script. the basic structure will be.
Code:
#!/system/bin/sh --> the header. tell the system to use "sh" command on the script below
echo bla bla bla. --> the script
I'll differentiate the scripts into two parts. the one run a bash script and the one used to change our device setting. the first one is quite complicated and usually written on separated file. the famous one might be zipalign script and sqlite script. basicly you only need to add the script and the required files (the libs and the binary file in /system/bin) into your system and need no modification. just add and leave it.
the second part is the one used to change our device setting. we can differentiate this stuff into two things. the setprop stuff and the "other stuff". the setprop stuff is quite easy to use. the setprop stuff basic form is "setprop <key> <value>" for an example:
Code:
setprop ro.ril.enable.dtm 1
setprop ro.ril.gprsclass 10
setprop ro.ril.hep 1
setprop ro.ril.enable.3g.prefix 1
setprop ro.ril.hsdpa.category 8
setprop ro.ril.hsupa.category 6
setprop ro.ril.hsxpa 2
setprop ro.ril.enable.a53 1
some of these script written in form of "setprop ro.ril.hep=1". that's the wrong way. the correct way is as I've described above.
the second part, the "other stuff" work in three different way. for an example, look at these files
Code:
/proc/sys/kernel/shmmni
/proc/sys/kernel/shmmax
/proc/sys/kernel/shmall
these files have certain value on it. if we want to change the value written on it, we can use three different way.
1. use "sysctl -w <key>=<value>" form. in your init.d script you'll type
Code:
sysctl -w kernel.shmmni=4096
sysctl -w kernel.shmmax=268435456
sysctl -w kernel.shmall=2097152
2. use sysctl.conf file. in your sysctl.conf file, you'll write
Code:
kernel.shmmni=4096
kernel.shmmax=268435456
kernel.shmall=2097152
while in your init.d script you'll write "sysctl -p".
personally I prefer the number 1 since I can made a simple test to check whether if the script is running or not and add it into my log files. anyway, these trick only work for the files under /proc/sys. if you want to change the value of different files, you'll need to use method number 3.
3. use echo command. the form is "echo "<value>" > /path/to/file". in your init.d you'll write
Code:
echo "0" > /sys/module/lowmemorykiller/parameters/debug_level
echo "64" > /sys/module/lowmemorykiller/parameters/cost
echo "0,1,3,5,7,15" > /sys/module/lowmemorykiller/parameters/adj
echo "4096,5182,6400,15360,17920,20480" > /sys/module/lowmemorykiller/parameters/minfree
to avoid double typed script, we can categorize our tweak into several group. I'll show you my tweak as an example. you can learn it or start with it. I don't take credits, so that you can modify it anytime without asking my permission.
Code:
#!/system/bin/sh
# kuro tweak1: the echo stuff
# [email protected] (2012) - lol...i'm just joking. no copyright or whatsoever
# contact : [email protected]
# v.1 - first release
# v.1.1 - new log system and new tweak added.
# v.1.2 - new tweak for xperia
# v.1.3(4-11-12) - new form
LOG_FILE=/data/kuro_tweak1.log
LOG_FILEZ=/data/kuro_sqlite.log
if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
if [ -e $LOG_FILEZ ]; then
rm $LOG_FILEZ;
fi;
# the preface
echo "==========================
# TWEAK KURO1-LOG FILE #
==========================
in the name of Allah,
the most beneficent,
the most mercifull
==========================
system information:
vendor : $( getprop ro.product.brand )
model : $( getprop ro.product.model )
ROM : $( getprop ro.build.display.id )
running the script...
start at:
$( date +"%m-%d-%Y %H:%M:%S" )
==========================" | tee -a $LOG_FILE;
# perfect mount
mount -o remount,noatime,commit=500,noauto_da_alloc,barrier=0 /system /system;
mount -o remount,noatime,commit=500,noauto_da_alloc,barrier=0 /data /data;
mount -o remount,noatime,commit=500,noauto_da_alloc,barrier=0 /cache /cache;
echo "perfect mount---------[OK]" | tee -a $LOG_FILE;
# sdcard speed fix
# not working yet - need root permission to change these value
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
busybox echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
busybox echo "2048" > /sys/devices/virtual/bdi/179:32/read_ahead_kb
echo "sdcard speed fix------[OK]
-value set to $( cat /sys/devices/virtual/bdi/179:0/read_ahead_kb )
-value set to $( cat /sys/devices/virtual/bdi/179:32/read_ahead_kb )" | tee -a $LOG_FILE; else
echo "sdcard speed fix----[FAIL]" | tee -a $LOG_FILE;
fi
# kernel kick
sysctl -w kernel.shmmni=4096
sysctl -w kernel.shmmax=268435456
sysctl -w kernel.shmall=2097152
sysctl -w kernel.msgmni=4096
sysctl -w kernel.msgmax=64000
# sysctl -w kernel.sched_latency_ns=20000000
# sysctl -w kernel.sched_wakeup_granularity_ns=2500000
# sysctl -w kernel.sched_min_granularity_ns=10000000
sysctl -w kernel.sem="500 512000 64 2048"
sysctl -w kernel.panic=30
sysctl -w kernel.panic_on_oops=0
sysctl -w kernel.threads-max=10000
sysctl -w kernel.panic=30
# sysctl -w kernel.sched_compat_yield=1
# sysctl -w kernel.sched_shares_ratelimit=256000
sysctl -w kernel.ctrl-alt-del=0
sysctl -w fs.lease-break-time=10
sysctl -w fs.file-max=65536
echo "kernel kick-----------[OK]" | tee -a $LOG_FILE;
# OOM
sysctl -w vm.laptop_mode=0
sysctl -w vm.swappiness=40
sysctl -w vm.dirty_writeback_centisecs=3000
sysctl -w vm.dirty_expire_centisecs=500
sysctl -w vm.dirty_ratio=15
sysctl -w vm.dirty_background_ratio=10
sysctl -w vm.lowmem_reserve_ratio="100 100"
sysctl -w vm.overcommit_ratio=70
sysctl -w vm.highmem_is_dirtyable=1
sysctl -w vm.min_free_order_shift=4
sysctl -w vm.oom_kill_allocating_task=0
sysctl -w vm.panic_on_oom=0
sysctl -w vm.page-cluster=3
sysctl -w vm.drop_caches=3
sysctl -w vm.min_free_kbytes=5120
sysctl -w vm.vfs_cache_pressure=50
sysctl -w vm.block_dump=0
echo "memory management-----[OK]" | tee -a $LOG_FILE;
# network boost
sysctl -w net.ipv4.tcp_congestion_control=cubic
sysctl -w net.ipv4.tcp_timestamps=0
sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.ipv4.tcp_sack=1
sysctl -w net.ipv4.tcp_dsack=1
sysctl -w net.ipv4.tcp_tw_recycle=1
sysctl -w net.ipv4.tcp_window_scaling=1
sysctl -w net.ipv4.tcp_keepalive_probes=5
sysctl -w net.ipv4.tcp_keepalive_intvl=30
sysctl -w net.ipv4.tcp_fin_timeout=30
sysctl -w net.ipv4.tcp_moderate_rcvbuf=1
sysctl -w net.ipv4.tcp_max_tw_buckets=1440000
sysctl -w net.ipv4.tcp_mem="57344 57344 524288"
sysctl -w net.ipv4.tcp_synack_retries=2
sysctl -w net.ipv4.tcp_syn_retries=2
sysctl -w net.ipv4.tcp_max_syn_backlog=1024
sysctl -w net.ipv4.icmp_echo_ignore_all=1
sysctl -w net.ipv4.route/flush=1
sysctl -w net.ipv4.udp_rmem_min=6144
sysctl -w net.ipv4.udp_wmem_min=6144
sysctl -w net.ipv4.tcp_rfc1337=1
sysctl -w net.ipv4.ip_no_pmtu_disc=0
sysctl -w net.ipv4.tcp_ecn=0
sysctl -w net.ipv4.tcp_wmem="6144 87380 524288"
sysctl -w net.ipv4.tcp_rmem="6144 87380 524288"
sysctl -w net.ipv4.tcp_fack=1
sysctl -w net.ipv4.tcp_synack_retries=2
sysctl -w net.ipv4.tcp_syn_retries=2
sysctl -w net.ipv4.tcp_no_metrics_save=1
sysctl -w net.ipv4.tcp_keepalive_time=1800
sysctl -w net.ipv4.ip_forward=0
sysctl -w net.ipv4.ip_dynaddr=0
sysctl -w net.ipv4.conf.all.accept_source_route=0
sysctl -w net.ipv4.conf.all.accept_redirects=0
sysctl -w net.ipv4.conf.all.rp_filter=1
sysctl -w net.ipv4.conf.all.secure_redirects=0
sysctl -w net.ipv4.conf.default.accept_redirects=0
sysctl -w net.ipv4.conf.default.secure_redirects=0
sysctl -w net.ipv4.conf.default.accept_source_route=0
sysctl -w net.core.rmem_max=524288
sysctl -w net.core.wmem_max=524288
sysctl -w net.core.rmem_default=262144
sysctl -w net.core.wmem_default=262144
sysctl -w net.core.optmem_max=20480
sysctl -w net.core.netdev_max_backlog=25000
sysctl -w net.unix.max_dgram_qlen=50
echo "network boost---------[OK]" | tee -a $LOG_FILE;
# cleaner
busybox rm -f /data/anr/*.*
busybox rm -f /data/cache/*.*
busybox rm -f /data/local/log/*.*
busybox rm -f /data/local/tmp/*.*
busybox rm -f /data/last_alog/*
busybox rm -f /data/last_kmsg/*
busybox rm -f /data/mlog/*
busybox rm -f /data/tombstones/*
busybox rm -f /data/system/dropbox/*
chmod 400 /data/system/dropbox
busybox rm /dev/log/main
busybox rm -f /data/system/usagestats/*
busybox chmod 400 /data/system/usagestats
export sampling_rate=10000
export up_threshold=80
echo "memory cleaner--------[OK]" | tee -a $LOG_FILE;
if [ -e /data/anr/*.* ]; then
echo "-anr not cleaned" | tee -a $LOG_FILE; else
echo "-anr cleaned" | tee -a $LOG_FILE
fi;
if [ -e /data/local/tmp/*.* ]; then
echo "-local/tmp not cleaned" | tee -a $LOG_FILE; else
echo "-local/tmp cleaned" | tee -a $LOG_FILE
fi;
if [ -e /data/cache/*.* ]; then
echo "-cache not cleaned" | tee -a $LOG_FILE; else
echo "-cache cleaned" | tee -a $LOG_FILE
fi;
if [ -e /data/last_log/*.* ]; then
echo "-log not cleaned" | tee -a $LOG_FILE; else
echo "-log cleaned" | tee -a $LOG_FILE
fi;
if [ -e /data/tombstones/*.* ]; then
echo "-tombstones not cleaned" | tee -a $LOG_FILE; else
echo "-tombstones cleaned" | tee -a $LOG_FILE
fi;
# minfree
echo "64" > /sys/module/lowmemorykiller/parameters/cost
echo "0,1,3,5,7,15" > /sys/module/lowmemorykiller/parameters/adj
echo "4096,5182,6400,15360,17920,20480" > /sys/module/lowmemorykiller/parameters/minfree
echo "minfree setting-------[OK]
-minfree value
$( cat /sys/module/lowmemorykiller/parameters/adj )
$( cat /sys/module/lowmemorykiller/parameters/minfree )" | tee -a $LOG_FILE;
# end
echo "==========================
done at:
$( date +"%m-%d-%Y %H:%M:%S" )
all praise is due to Allah
==========================
-- have a nice day --
[email protected]
==========================" | tee -a $LOG_FILE;
note that the line started with # are not executed.
Code:
#!/system/bin/sh
# kuro tweak2: the setprop stuffs and journalismoff
# [email protected] (2012) - lol...i'm just joking. no copyright or whatsoever
# contact : [email protected]
# v.1 - first release
# v.1.1 - new log system and new tweak added.
# v.1.2 - new tweak for xperia
LOG_FILE=/data/kuro_tweak2.log
if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
# the preface
echo "==========================
# TWEAK KURO2-LOG FILE #
==========================
in the name of Allah,
the most beneficent,
the most mercifull
==========================
system information:
vendor : $( getprop ro.product.brand )
model : $( getprop ro.product.model )
ROM : $( getprop ro.build.display.id )
running the script...
start at:
$( date +"%m-%d-%Y %H:%M:%S" )
==========================" | tee -a $LOG_FILE;
# 3g mod
setprop ro.ril.enable.dtm 1
setprop ro.ril.gprsclass 10
setprop ro.ril.hep 1
setprop ro.ril.enable.3g.prefix 1
setprop ro.ril.hsdpa.category 8
setprop ro.ril.hsupa.category 6
setprop ro.ril.hsxpa 2
setprop ro.ril.enable.a53 1
setprop ro.ril.htcmaskw1.bitmask 4294967295
setprop ro.ril.htcmaskw1 14449
setprop ro.config.hw_fast_dormancy 1
echo "3g signal mod---------[OK]" | tee -a $LOG_FILE;
# battery mod n media
setprop debug.performance.tuning 1
setprop pm.sleep_mode 1
setprop windowsmgr.max_events_per_sec 90
setprop ro.ril.disable.power.collapse 0
setprop wifi.supplicant_scan_interval 180
setprop ro.media.enc.jpeg.quality 100
setprop debug.sf.hw 1
setprop ro.vold.umsdirtyratio 20
echo "battery n media-------[OK]" | tee -a $LOG_FILE;
# performance
# setprop persist.sys.purgeable_assets 1
setprop dalvik.vm.execution-mode int:jit
setprop dalvik.vm.dexopt-flags l=x,n=z,m=y
setprop dalvik.vm.verify-bytecode false
setprop dalvik.vm.heapsize 64m
setprop dalvik.vm.heapgrowthlimit 48m
setprop dalvik.vm.dexopt-data-only 1
setprop dalvik.vm.jmiopts forcecopy
setprop dalvik.vm.lockprof.treshold 250
setprop ro.kernel.android.checkjni 0
setprop ro.telephony.call_ring.delay 0
setprop debug.kill_allocating_task 1
# defaul is zero
# mem adj
setprop ro.FOREGROUND_APP_ADJ 0
setprop ro.VISIBLE_APP_ADJ 4
setprop ro.SECONDARY_SERVER_ADJ 6
setprop ro.HIDDEN_APP_MIN_ADJ 8
setprop ro.CONTENT_PROVIDER_ADJ 12
setprop ro.EMPTY_APP_ADJ 15
# mem minfree
setprop ro.FOREGROUND_APP_MEM 1536
setprop ro.VISIBLE_APP_MEM 2048
setprop ro.SECONDARY_SERVER_MEM 4096
setprop ro.HIDDEN_APP_MEM 5120
setprop ro.CONTENT_PROVIDER_MEM 5632
setprop ro.EMPTY_APP_MEM 6144
echo "performance-----------[OK]" | tee -a $LOG_FILE;
# Disable debugging notify icon on statusbar
setprop persist.adb.notify 0
# Disable blackscreen issue after a call
setprop ro.lge.proximity.delay 0
setprop mot.proximity.delay 0
# Phone will not wake up from hitting the volume rocker
# setprop ro.config.hwfeature_wakeupkey 0
# Enable display Dithering
# setprop persist.sys.use_dithering 1
# xperia mental
setprop persist.android.strictmode 0
setprop persist.sys.ui.hw 1
setprop ro.max.fling_velocity 12000
setprop ro.min.fling_velocity 2000
setprop ro.mot.eri.losalert.delay 1000
setprop ro.kernel.checkjni 0
setprop ro.config.nocheckin 1
setprop debug.qctwa.statusbar 1
setprop debug.qctwa.preservebuf 1
setprop debug.qc.hardware true
setprop com.qc.hardware true
setprop profiler.force_disable_err_rpt 1
setprop profiler.force_disable_ulog 1
setprop logcat.live disable
setprop net.ppp0.dns1 8.8.8.8
setprop net.ppp0.dns2 8.8.4.4
setprop net.dns1 8.8.8.8
setprop net.rmnet0.dns1 8.8.8.8
setprop net.rmnet0.dns2 8.8.4.4
setprop net.dns2 8.8.4.4
setprop debug.egl.profiler 1
setprop debug.egl.hw 1
setprop debug.composition.type gpu
echo "Xperia tweak----------[OK]" | tee -a $LOG_FILE;
# no journal
tune2fs -o journal_data_writeback /dev/block/mmcblk0p10
tune2fs -o journal_data_writeback /dev/block/mmcblk0p11
tune2fs -o journal_data_writeback /dev/block/mmcblk0p15
echo "no journal------------[OK]" | tee -a $LOG_FILE;
# end
echo "==========================
done at:
$( date +"%m-%d-%Y %H:%M:%S" )
all praise is due to Allah
==========================
-- have a nice day --
[email protected]
==========================" | tee -a $LOG_FILE;
the journalism stuff require tune2fs binary file installed into your system.
Code:
#!/system/bin/sh
#keep beats
PPID=$(pidof org.equalizerapp);
echo "17" > /proc/$PPID/oom_adj;
renice -18 $PPID;
#set
setprop.keep_app_1 org.equalizerapp
#audio resample
setprop af.resample 48000;
setprop af.resampler.quality 255;
setprop ro.audio.samplerate 48000;
setprop ro.audio.pcm.samplerate 48000;
setprop persyst.af.resample 48000;
setprop persyst.af.resampler.quality 255;
setprop persyst.ro.audio.samplerate 48000;
setprop persyst.ro.audio.pcm.samplerate 48000;
setprop persyst.dev.pm.dyn_samplingrate 1;
this one is modifying our sound quality. some of the part are still under my investigation but the audio resample part is really working.
Code:
#!/system/bin/sh
# DarkyROM 2011
# Much faster zipalign.
# Changelog:
# 1.3 (5/8/12) new log system. system remount deleted (by: kurotsugi)
# 1.2 (17/1/11) Added /data/zipalign.db file for faster apk check (ninpo,Bo$s)
# 1.1 (12/1/09) Switched to zipalign -c 4 to check the apk instead of MD5 (oknowton)
# 1.0 (11/30/09) Original
LOG_FILE=/data/kuro_zalign.log
ZIPALIGNDB=/data/kuro_zalign.db
if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
if [ ! -f $ZIPALIGNDB ]; then
touch $ZIPALIGNDB;
fi;
# the preface
echo "==========================
# TWEAK KURO-ZALIGN FILE #
==========================
in the name of Allah,
the most beneficent,
the most mercifull
==========================
system information:
vendor : $( getprop ro.product.brand )
model : $( getprop ro.product.model )
ROM : $( getprop ro.build.display.id )
running the script...
start at:
$( date +"%m-%d-%Y %H:%M:%S" )
==========================" | tee -a $LOG_FILE;
# zipalign script (not modified)
for DIR in /system/app /data/app ; do
cd $DIR
for APK in *.apk ; do
if [ $APK -ot $ZIPALIGNDB ] && [ $(grep "$DIR/$APK" $ZIPALIGNDB|wc -l) -gt 0 ] ; then
echo "zipaligned: $DIR/$APK" | tee -a $LOG_FILE
else
zipalign -c 4 $APK
if [ $? -eq 0 ] ; then
echo "now zipaligned: $DIR/$APK" | tee -a $LOG_FILE
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB
else
echo "Now aligning: $DIR/$APK" | tee -a $LOG_FILE
zipalign -f 4 $APK /cache/$APK
busybox mount -o rw,remount /system
cp -f -p /cache/$APK $APK
busybox rm -f /cache/$APK
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB
fi
fi
done
done
touch $ZIPALIGNDB
# end
echo "==========================
done at:
$( date +"%m-%d-%Y %H:%M:%S" )
all praise is due to Allah
==========================
-- have a nice day --
[email protected]
==========================" | tee -a $LOG_FILE;
the famous zipalign script. i modify the log system. you need the zipalign binary to use it
Code:
#!/system/bin/sh
# kuro akuro: new data2sd method
# [email protected] (2012) - lol...i'm just joking. no copyright or whatsoever
# contact : [email protected]
# v.1 - first release
# v.1.1 - automated system, new build,
LOG_FILE=/data/kuro_akuro.log
if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
# the preface
echo "==========================
# TWEAK AKURO-LOG FILE #
==========================
in the name of Allah,
the most beneficent,
the most mercifull
==========================
system information:
vendor : $( getprop ro.product.brand )
model : $( getprop ro.product.model )
ROM : $( getprop ro.build.display.id )
running the script...
start at:
$( date +"%m-%d-%Y %H:%M:%S" )
==========================" | tee -a $LOG_FILE;
# fix sdcard speed
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
echo "fix sdcard speed tweak [OK]" | tee -a $LOG_FILE;
fi;
# create sdext dir in /system
if [ ! -e /system/sd ]; then
echo "WARNING!: no sdext dir
please create dir /system/sd" | tee -a $LOG_FILE;
fi;
echo "SDEXT directory check [OK]" | tee -a $LOG_FILE;
# mount sdcard all type
busybox mount -o noatime,nodiratime,nosuid,nodev /dev/block/mmcblk0p2 /system/sd;
mountext=`busybox mount | egrep 'ext2|ext3|ext4'`;
if [ -n "$mountext" ]; then
chown 1000:1000 /system/sd;
chmod 771 /system/sd;
fi;
echo "akuro: sd-ext mount [OK]" | tee -a $LOG_FILE;
# create the directories
if [ ! -e /system/sd/app ]; then
mkdir /system/sd/app;
busybox mv /data/app/* /system/sd/app;
fi;
if [ ! -e /system/sd/dalvik-cache ]; then
mkdir /system/sd/dalvik-cache;
busybox mv /data/dalvik-cache/* /system/sd/dalvik-cache;
fi;
echo "akuro: preparation step [OK]" | tee -a $LOG_FILE;
# mount sd to data directories
mount -o bind /system/sd/app /data/app;
chown 1000:1000 /system/sd/app;
chmod 771 /system/sd/app;
if [ -e /system/sd/app ]; then
echo "akuro: app mount step [OK]" | tee -a $LOG_FILE; else
echo "akuro: app mount step [FAIL]" | tee -a $LOG_FILE;
fi;
mount -o bind /system/sd/dalvik-cache /data/dalvik-cache;
chown 1000:1000 /system/sd/dalvik-cache;
chmod 771 /system/sd/dalvik-cache;
if [ -e /system/sd/dalvik-cache ]; then
echo "akuro: dalvik mount step [OK]" | tee -a $LOG_FILE; else
echo "akuro: dalvik mount step [FAIL]" | tee -a $LOG_FILE;
fi;
if [ -e /system/sd/data ]; then
mount -o bind /system/sd/data /data/data;
chown 1000:1000 /system/sd/data;
chmod 771 /system/sd/data;
fi;
if [ -e /system/sd/data ]; then
echo "akuro: data mount step [OK]" | tee -a $LOG_FILE; else
echo "akuro: data mount step [FAIL]" | tee -a $LOG_FILE;
fi;
# end
echo "==========================
done at:
$( date +"%m-%d-%Y %H:%M:%S" )
all praise is due to Allah
==========================
-- have a nice day --
[email protected]
==========================" | tee -a $LOG_FILE;
my own made akuro script. it works to move dalvik-cache,app, and /data/folder from our internal memory to ext2/3/4 partition on our sdcard. it will save our internal mem space. sadly this one is for samsung device. you need to modify some part of it.
have a nice tweaking
EDIT: btw, for my first and second tweak, you should use your own value. my value is taken from sgy and still under investigation to get better result.
as I've promised I'll tell you how to build your own rom. however, I made this thread for someone who started to build his own rom. I want to made this post understandable even for a newb in android world. this guide doesn't recover stuffs like how to customize the theme or add more feature into your your rom. that one require a lot of resources and you need to learn it by yourself.
the first thing you need is the system files. you can get it by dumping your system partition, modify an existed rom of even build it from scratch by yourself. assume if you already have one, the next thing you should learn is the updater script.
basic rom installer structure will be something like this.
1. meta-inf folder : contain updater script and updater binary to install your rom
2. system folder : contain your system files
3. additional files and script.
for a start, you can get meta-inf folder from here http://www.mediafire.com/?nxgiz0993brp9re
it contain a basic updater script to install a rom. it designed to install a rom for another device. you need to modify it if you want to use it.
if you open the updater script, you'll see this
Code:
ui_print("Installing ...");
ui_print(" ");
unmount("/system");
mount("ext3", "EMMC", "/dev/block/mmcblk0p2", "/system");
show_progress(0.100000, 0);
delete_recursive("/system");
show_progress(0.100000, 0);
show_progress(0.500000, 40);
ui_print("Installing System...");
package_extract_dir("system", "/system");
symlink("toolbox", "/system/bin/schedtop");
symlink("toolbox", "/system/bin/df");
symlink("toolbox", "/system/bin/insmod");
symlink("toolbox", "/system/bin/top");
symlink("toolbox", "/system/bin/iftop");
symlink("toolbox", "/system/bin/getevent");
symlink("toolbox", "/system/bin/rm");
symlink("toolbox", "/system/bin/rmmod");
symlink("toolbox", "/system/bin/printenv");
symlink("toolbox", "/system/bin/start");
symlink("toolbox", "/system/bin/kill");
symlink("toolbox", "/system/bin/vmstat");
symlink("toolbox", "/system/bin/stop");
symlink("toolbox", "/system/bin/ioctl");
symlink("toolbox", "/system/bin/cmp");
symlink("toolbox", "/system/bin/ps");
symlink("toolbox", "/system/bin/chmod");
symlink("toolbox", "/system/bin/sendevent");
symlink("toolbox", "/system/bin/netstat");
symlink("toolbox", "/system/bin/setconsole");
symlink("toolbox", "/system/bin/cat");
symlink("toolbox", "/system/bin/mount");
symlink("toolbox", "/system/bin/ln");
symlink("toolbox", "/system/bin/log");
symlink("toolbox", "/system/bin/reboot");
symlink("toolbox", "/system/bin/dd");
symlink("toolbox", "/system/bin/id");
symlink("toolbox", "/system/bin/getprop");
symlink("toolbox", "/system/bin/lsmod");
symlink("toolbox", "/system/bin/ionice");
symlink("toolbox", "/system/bin/newfs_msdos");
symlink("toolbox", "/system/bin/setprop");
symlink("toolbox", "/system/bin/sync");
symlink("toolbox", "/system/bin/umount");
symlink("toolbox", "/system/bin/watchprops");
symlink("toolbox", "/system/bin/route");
symlink("toolbox", "/system/bin/notify");
symlink("toolbox", "/system/bin/uptime");
symlink("toolbox", "/system/bin/wipe");
symlink("toolbox", "/system/bin/nandread");
symlink("toolbox", "/system/bin/lsof");
symlink("toolbox", "/system/bin/mkdir");
symlink("toolbox", "/system/bin/rmdir");
symlink("toolbox", "/system/bin/hd");
symlink("toolbox", "/system/bin/ls");
symlink("toolbox", "/system/bin/chown");
symlink("toolbox", "/system/bin/dmesg");
symlink("toolbox", "/system/bin/sleep");
symlink("toolbox", "/system/bin/renice");
symlink("toolbox", "/system/bin/ifconfig");
symlink("toolbox", "/system/bin/mv");
symlink("toolbox", "/system/bin/date");
symlink("toolbox", "/system/bin/smd");
symlink("dumpstate", "/system/bin/dumpmesg");
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm_recursive(0, 0, 0777, 0777, "/system/etc/init.d");
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm(0, 3003, 06755, "/system/bin/ip");
set_perm(0, 3003, 02750, "/system/bin/netcfg");
set_perm(0, 3004, 02755, "/system/bin/ping");
set_perm(0, 2000, 06750, "/system/bin/run-as");
set_perm_recursive(1002, 1002, 0755, 0440, "/system/etc/bluetooth");
set_perm(0, 0, 0755, "/system/etc/bluetooth");
set_perm(1000, 1000, 0640, "/system/etc/bluetooth/auto_pairing.conf");
set_perm(3002, 3002, 0444, "/system/etc/bluetooth/blacklist.conf");
set_perm(1002, 1002, 0755, "/system/etc/dbus.conf");
set_perm(1014, 2000, 0755, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm(0, 2000, 0550, "/system/etc/init.goldfish.sh");
set_perm(0, 0, 04755, "/system/bin/bash");
symlink("/system/bin/bash", "/system/bin/sh");
set_perm(0, 0, 0777, "/system/bin/a2sd");
set_perm(0, 0, 0777, "/system/rtc/init.d/S95allinone");
set_perm(0, 0, 0777, "/system/etc/init.d/00banner");
set_perm(0, 0, 0777, "/system/etc/init.d/01sysctl");
set_perm(0, 0, 0777, "/system/etc/init.d/02firstboot");
set_perm(0, 0, 0777, "/system/etc/init.d/03mountsd");
set_perm(0, 0, 0777, "/system/etc/init.d/04apps2sd");
set_perm(0, 0, 0777, "/system/etc/init.d/99complete");
set_perm(0, 0, 0777, "/system/bin/launcha2sd");
set_perm(0, 0, 0777, "/system/bin/starta2sd");
set_perm(0, 0, 0777, "/system/bin/jita2sd");
set_perm(0, 0, 0777, "/system/bin/chka2sd");
set_perm(0, 0, 0777, "/system/bin/zipalign");
set_perm(0, 0, 0777, "/system/bin/sysinit");
set_perm(0, 0, 0777, "/system/bin/busybox.a2sd");
set_perm(0, 0, 0644, "/system/bin/apps2sd.hlp");
set_perm(0, 0, 0777, "/system/xbin/a2sd");
set_perm(0, 0, 0777, "/system/bin/dtinstall");
set_perm(0, 0, 06755, "/system/bin/su");
symlink("/system/bin/su", "/system/xbin/su");
set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
show_progress(0.1, 10);
show_progress(0.2, 0);
set_perm(0, 1000, 0755, "/system/xbin/busybox");
package_extract_file("installbusybox", "/tmp/installbusybox");
set_perm(0, 0, 0777, "/tmp/installbusybox");
run_program("/tmp/installbusybox");
ui_print("Installing Boot...");
show_progress(0.2, 10);
show_progress(0.100000, 0);
ui_print(" ");
ui_print("Installation Completed!!!!");
ui_print(" ");
ui_print("Enjoy...");
ui_print(" ");
unmount("/system");
ui_print("Welcome to MySs Rom ");
lets breakdown the updater script. basic updater script contain several parts. from above script, we can divide it into these parts:
1. UI SCRIPT
it will give you information about your rom installation.
it consist of two part. the first one is the ui_print, it used to show some text when you install the rom. for an example, ui_print("Welcome to MySs Rom "); it will print Welcome to MySs Rom on your screen. the form is
Code:
ui_print("<your text>")
the second one is the show progress stuff. for an example show_progress(0.5, 20);.the form is
Code:
show_progress(<the progress part 0 to 1>, <time needed to reach progress part>);
if you look into the example, it means that the installation progress bar will reach 50% in 20 second.
2. INSTALLER SCRIPT
the most crucial part. it install the files into your system partition.
it consist of three part. the first one is the mounter script. it used to mount a certain partition when you install the rom. this is one of the example mount("ext3", "EMMC", "/dev/block/mmcblk0p2", "/system");. the basic form is
Code:
mount("<partition file>", "<partition type>", "<partition location>", "<place where it mounted>");
the second part is formater script. you can do it by format the entire partition or simply delete all the files in the partition. I always choose the second one to avoid getting a corrupted partition. the basic form is
Code:
delete_recursive("<folder address>")
# or in an example
delete_recursive("/system");
the last part is the one used to copy the files into your system. you can do it in two ways. the first one you copy the files one by one. you'll use something like this.package_extract_file("installbusybox", "/tmp/installbusybox");. the form is package_extract_file("<file name and address>", "<where you want to copy it>");. the second one is you copy the entire folder. you'll use package_extract_dir("system", "/system");. the form is package_extract_dir("<folder name inside your zip file>", "<where to copy it>");
3. MODIFIER SCRIPT
to change the permission you'll use
Code:
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
# if you want to change it based on the folder
# basic form
set_perm_recursive(<1st owner>, <2nd owner>, <folder permission>, <file permission>, "/system/bin")
set_perm(0, 3003, 06755, "/system/bin/ip");
# if you want to change it file by file
# basic form
set_perm(<1st owner>, <2nd owner>, <permission>, "/system/bin/ip")
to create symlink
Code:
symlink("toolbox", "/system/bin/ls");
# basic form
symlink("<the file name>", "<the link name>");
4. ADDITIONAL SCRIPT
it mainly use to run certain script. for an example
Code:
package_extract_file("installbusybox", "/tmp/installbusybox");
set_perm(0, 0, 0777, "/tmp/installbusybox");
run_program("/tmp/installbusybox"); [code] first thing you should remember is that you need to extract the script first. in this case, is the installbusybox file to /tmp. to run the script you'll need to change the permission and run it with run_program. the basic form is [b]run_program("<the file>")[/b]
[/hide]
now, after you know about the updater script, you need to create the proper updater script for your rom. the basic script will be.
1. mount all needed partition. some rom installation need to mount /data, /cache, etc. make sure you already mount all of them
2. delete all the old system files.
3. copy all new system files into your system.
4. change the owner and the permission of certain files and folders. make sure you have the exact owner and permission setting of all the files copied into /system. the default is owner: root. permission: rw-r-r.
5. create symlinks.
6. run the additional script.
the last step, pack all the files into a single zip file and install your rom. enjoy your rom.
ADDITIONAL RESOURCE
1. introduction for edify updater script [url]http://forum.xda-developers.com/showthread.php?t=1669489[/url]
2. dsixda's kitchen [url]http://forum.xda-developers.com/showthread.php?t=633246[/url]
3. kernel kitchen [url]http://forum.xda-developers.com/showthread.php?t=1659584[/url]
Thanks king! Always wanted to learn that!
Sent from my ST23i using xda app-developers app
nice one..thanks for your work.:good:
thanks, nice info
Good post will wait for some more cool stuffs
thread updated...I don't know. I hope you can understand this simple guide. I made this thread so that we will have more rom devs in near future. please don't use it to steal another's works.
help
kurotsugi said:
thread updated...I don't know. I hope you can understand this simple guide. I made this thread so that we will have more rom devs in near future. please don't use it to steal another's works.
Click to expand...
Click to collapse
hai gan.. terimakasih untuk tut.nya kembangkan terus skill yang anda punya.
saya jadi ikut bangga .. heee.
gan saya boleh minta tolong. kenapa kalau saya buat jaringan ad hoc dikomputer lalu saya coba check di hp saya (sony tipo) itu nggak mau kedeteksi dan konek? denger-denger katanya suruh modif wpa_nya tapi tetep nggak bisa.
tolong bantu saya gan,
terimakasih. :angel:
Pls keep the language to english
Inviato dal mio ST26i con Tapatalk 2
thanks for this tut, I'll bookrmark this topic since I'm still new to this android thingy
Beautiful tutorial Thanks:highfive:
Java_Indo said:
hai gan.. terimakasih untuk tut.nya kembangkan terus skill yang anda punya.
saya jadi ikut bangga .. heee.
gan saya boleh minta tolong. kenapa kalau saya buat jaringan ad hoc dikomputer lalu saya coba check di hp saya (sony tipo) itu nggak mau kedeteksi dan konek? denger-denger katanya suruh modif wpa_nya tapi tetep nggak bisa.
tolong bantu saya gan,
terimakasih. :angel:
Click to expand...
Click to collapse
Pakai bahasa inggris..
This is international forum, all around the world is here..
Anyway, thanka for this guide.. bookmarked this
Thanks a lot!

Maintaining build.prop changes in ROM Updates

Hey guys,
So, I am using CM currently, and use CyanDelta to update every couple of days (it works so well!). It works great because I can have it flash Franco Kernel and SuperSU after updating, so those are maintained at least. Annoying part is, every time I update, my build.prop is being overwritten. I scale my DPI down to 405 in order for everything to be ungigantic, and when it gets changed back, it essentially erases my home screens. So, every update, I have to re-apply my settings, and re-do my homescreens. I'm just wondering if you guys have come up with a way to maintain build.prop changes between ROM updates? I feel like there may be a script or something out there, but with some cursory searching around, I can't find jack.
Thanks!
Just copy your current build.prop to your sd when u flash a new build copy and paste over the new one change permissions reboot
Sent from my SM-N910C using XDA Free mobile app
duvalbmarley said:
Just copy your current build.prop to your sd when u flash a new build copy and paste over the new one change permissions reboot
Sent from my SM-N910C using XDA Free mobile app
Click to expand...
Click to collapse
What happens if there are important build.prop changes in an update though?
Transmitted via Bacon
timmaaa said:
What happens if there are important build.prop changes in an update though?
Transmitted via Bacon
Click to expand...
Click to collapse
Most changes are not build.prop related and if it is it would be easier to just copy and paste those changes to the build.prop u copied on your sd card.. and if it's the same rom then it should be no problem or even if it's 2 different roms with the same Base just make sure to copy your original before replacing incase anything goes wrong.... I'm just throwing out a solution what do you suggest the op do??? Don't bash the helper give a helping hand or don't comment
Sent from my SM-N910C using XDA Free mobile app
duvalbmarley said:
Most changes are not build.prop related and if it is it would be easier to just copy and paste those changes to the build.prop u copied on your sd card.. and if it's the same rom then it should be no problem or even if it's 2 different roms with the same Base just make sure to copy your original before replacing incase anything goes wrong.... I'm just throwing out a solution what do you suggest the op do??? Don't bash the helper give a helping hand or don't comment
Sent from my SM-N910C using XDA Free mobile app
Click to expand...
Click to collapse
Whoa, calm down. I'm not bashing you, just asking a question, in order to work with you to come up with the best solution. I agree, most changes aren't contained in the build.prop, but every now and again there could be one or two and it'd take more time checking the two build.props against other than it would just changing the DPI and setting up screens after a flash. I just don't think this solution, while it may work, is a very elegant or practical one, considering that you'd need to waste time to check the build.prop anyway.
@kmakiki, what launcher do you use? I use the app Texdroider to adjust my DPI to 370 after each nightly flash too, but my home screens are never affected. I use Nova Launcher.
Transmitted via Bacon
timmaaa said:
Whoa, calm down. I'm not bashing you, just asking a question, in order to work with you to come up with the best solution. I agree, most changes aren't contained in the build.prop, but every now and again there could be one or two and it'd take more time checking the two build.props against other than it would just changing the DPI and setting up screens after a flash. I just don't think this solution, while it may work, is a very elegant or practical one, considering that you'd need to waste time to check the build.prop anyway.
@kmakiki, what launcher do you use? I use the app Texdroider to adjust my DPI to 370 after each nightly flash too, but my home screens are never affected. I use Nova Launcher.
Transmitted via Bacon
Click to expand...
Click to collapse
Well in my situation I have speed tweaks Internet tweaks dpi changes and a bunch of other tweaks I add to build.prop and i would rather just copy one or two lines then to add every tweak and change after every update
Sent from my SM-N910C using XDA Free mobile app
duvalbmarley said:
Well in my situation I have speed tweaks Internet tweaks dpi changes and a bunch of other tweaks I add to build.prop and i would rather just copy one or two lines then to add every tweak and change after every update
Sent from my SM-N910C using XDA Free mobile app
Click to expand...
Click to collapse
Yeah, but what I'm saying is that it would be time consuming to actually go through each build.prop line by line to discover if there are any that are different or added/removed. It isn't the adding of lines that's the problem, it's having to find out if you need to.
Transmitted via Bacon
timmaaa said:
Yeah, but what I'm saying is that it would be time consuming to actually go through each build.prop line by line to discover if there are any that are different or added/removed. It isn't the adding of lines that's the problem, it's having to find out if you need to.
Transmitted via Bacon
Click to expand...
Click to collapse
Most developer's have change logs to show what was updated and if it's build.prop changes which most likely it won't be u could just ask or it should be posted in change log let's not argue about the changes let's find another solution besides copy and paste since no one has came up with another option
Sent from my SM-N910C using XDA Free mobile app
duvalbmarley said:
Most developer's have change logs to show what was updated and if it's build.prop changes which most likely it won't be u could just ask or it should be posted in change log let's not argue about the changes let's find another solution besides copy and paste since no one has came up with another option
Sent from my SM-N910C using XDA Free mobile app
Click to expand...
Click to collapse
I think the best solution for him is to just change the launcher he's using, that's where the problem lies.
Transmitted via Bacon
flash this zip (attachement)
it will add a file called 99-DPI.sh to
/system/addons.d/ and, by that, it will be executed after every rom flash that uses the backupscripts (cm,... )
the script will replace the default ro.sf.lcd_density to a value you specify (the new default value is 360, this is what i use)
you can add a file called .dpi to your sdcard (/sdcard/.dpi) which contains a number (e.g. 405), then this value will be used after each rom flash.
if you have some questions then feel free to ask :>
[edit]
i just read the whole thread (i was missing some posts)
the 99-DPI.sh can be used to edit any build.prop change, you just have to add some lines, it should be self explaining.
@aHcVolle can u explain more on how to dd new lines to be added into build. Prop
Thnx in advance
@kmakiki i just think of it what if u edit the build. Prop in the cyandelta zip file b4 flashing it?
Ma7mu7 said:
@aHcVolle can u explain more on how to dd new lines to be added into build. Prop
Thnx in advance
Click to expand...
Click to collapse
Can you give more info in what you are trying to do?
aHcVolle said:
Can you give more info in what you are trying to do?
Click to expand...
Click to collapse
Thanks for the fast reply i want to add some lines to build.prop other than changing the dpi i.e disabling bootanimation 3g tweaks etc..
Ma7mu7 said:
Thanks for the fast reply i want to add some lines to build.prop other than changing the dpi i.e disabling bootanimation 3g tweaks etc..
Click to expand...
Click to collapse
OK, edit the file script/99-DPI.sh
remove everything between restore) and ;;
and add your stuff between those 2.
example:
Code:
restore)
echo "dummy_var=1" >> /system/build.prop
ui_print "added line to build.prop"
;;
that should be everything you need.
aHcVolle said:
OK, edit the file script/99-DPI.sh
remove everything between restore) and ;;
and add your stuff between those 2.
example:
Code:
restore)
echo "dummy_var=1" >> /system/build.prop
ui_print "added line to build.prop"
;;
that should be everything you need.
Click to expand...
Click to collapse
Sooo it should be
Code:
restore)
echo "dummy_var=1" >> /system/build.prop
ui_print "added line to build.prop"
debug.sf.nobootanimation=1
ro.config.hw_quickpoweron=true
persist.sys.shutdown.mode=hibernate
dev.bootcomplete=0 ;;
Instead of
Code:
restore)
# We only have work when restoring....
if [ -f $FILE ]; then
# The DPI file is existing, lets check its content
FILEDPI=$(cat $FILE)
# Convert to int (maybe not needed)
(( FILEDPI=$FILEDPI+0 ))
Right?
No
Code:
restore)
echo "debug.sf.nobootanimation=1" >> /system/build.prop
echo "ro.config.hw_quickpoweron=true" >> /system/build.prop
echo "persist.sys.shutdown.mode=hibernate" >> /system/build.prop
echo "dev.bootcomplete=0" >> /system/build.prop
ui_print "added 4 lines to build.prop"
;;
aHcVolle said:
No
Code:
restore)
echo "debug.sf.nobootanimation=1" >> /system/build.prop
echo "ro.config.hw_quickpoweron=true" >> /system/build.prop
echo "persist.sys.shutdown.mode=hibernate" >> /system/build.prop
echo "dev.bootcomplete=0" >> /system/build.prop
ui_print "added 4 lines to build.prop"
;;
Click to expand...
Click to collapse
Thank you very very much just last question
What abt the rest
Code:
# We only have work when restoring....
if [ -f $FILE ]; then
# The DPI file is existing, lets check its content
FILEDPI=$(cat $FILE)
# Convert to int (maybe not needed)
(( FILEDPI=$FILEDPI+0 ))
Shall i just delete them or keep the,m?
Ma7mu7 said:
Thank you very very much just last question
What abt the rest
Code:
# We only have work when restoring....
if [ -f $FILE ]; then
# The DPI file is existing, lets check its content
FILEDPI=$(cat $FILE)
# Convert to int (maybe not needed)
(( FILEDPI=$FILEDPI+0 ))
Shall i just delete them or keep the,m?
Click to expand...
Click to collapse
you can delete them.
make the file look like this:
Code:
#!/sbin/sh
# persistant dpi by volle
# credits: nuclearmistake for ui_print cmd
# Print function
export OUTFD=$(ps | grep -v "grep" | grep -o -E "update_binary(.*)" | cut -d " " -f 3); #BIG props to Chainfire
[ ! $OUTFD ] && export OUTFD=$(ps | grep -v "grep" | grep -o -E "/tmp/updater(.*)" | cut -d " " -f 3); #BIG props nuclearmistake for TWRP-izing
ui_print() { if [ $OUTFD ]; then echo "ui_print $*" 1>&$OUTFD; fi; return 0; }
case "$1" in
pre-backup)
;;
backup)
;;
post-backup)
;;
pre-restore)
;;
restore)
echo "debug.sf.nobootanimation=1" >> /system/build.prop
echo "ro.config.hw_quickpoweron=true" >> /system/build.prop
echo "persist.sys.shutdown.mode=hibernate" >> /system/build.prop
echo "dev.bootcomplete=0" >> /system/build.prop
ui_print "added 4 lines to build.prop"
;;
post-restore)
;;
*)
ui_print " Unkown command $1"
;;
esac
@aHcVolle thanx for the script.
i was also searching how to add lines to build.prop in recovery and it works perfect :good:
aHcVolle said:
you can delete them.
make the file look like this:
[/code]
Click to expand...
Click to collapse
I have a question about combining scripts.
I managed to combine 2 scripts.
First one i created with Android Flashable Zip Creator to install to flash apps in recovery.
Second one is the Fermion Blackhole script to remove bloatware and unwanted apps, also in recovery.
I just copied part of the blackhole into the 1st scipt. I tested it and it works.
Code:
ui_print("@Starting the install process");
ui_print("Setting up required tools...");
ui_print("Mounting Partitions...");
ui_print(" ");
run_program("/sbin/busybox","mount", "/system");
run_program("/sbin/busybox","mount", "/data");
set_progress(0.1);
ui_print("@Installing System Apps");
package_extract_dir("customize/APKs-System/APKs-System_appz", "/system/app");
set_progress(0.2);
set_progress(0.25);
set_progress(0.3);
set_progress(0.4);
set_progress(0.5);
set_progress(0.6);
set_progress(0.7);
set_progress(0.8);
set_progress(0.9);
ui_print("-Sending bloatware to a blackhole.");
delete_recursive(
"/system/app/BasicDreams",
"/system/app/Browser",
"/system/app/Camera2",
"/system/app/CMFileManager",
"/system/app/CMWallpapers",
"/system/app/Eleven",
"/system/app/Email",
"/system/app/Exchange2",
"/system/app/Galaxy4",
"/system/app/Gallery2",
"/system/app/HoloSpiralWallpaper",
"/system/app/LatinIME",
"/system/app/LiveWallpapers",
"/system/app/LiveWallpapersPicker",
"/system/app/Microbes",
"/system/app/NoiseField",
"/system/app/PhaseBeam",
"/system/app/PhotoPhase",
"/system/app/PhotoTable",
"/system/app/PicoTts",
"/system/app/VisualizationWallpapers",
"/system/app/WhisperPush"
);
delete_recursive(
"/system/priv-app/AudioFX",
"/system/priv-app/CellBroadcastReceiver",
"/system/priv-app/Mms",
"/system/priv-app/MmsService",
"/system/priv-app/OmniSwitch",
"/system/priv-app/Trebuchet",
"/system/priv-app/Wallet"
);
set_progress(0.9);
set_metadata_recursive("/system/addon.d", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/app", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/etc/permissions", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/etc/preferred-apps", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/framework", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/priv-app", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
ui_print("-Unmounting system partition.");
run_program("/sbin/busybox", "umount", "/system");
run_program("/sbin/busybox", "umount", "/data");
ui_print("");
ui_print("Done debloating your device!");
ui_print("@Finished Install");
set_progress(1);
Is it possible to add your script to the updater.script ? What part should i copy ? And also can i just add the /script folder into my zip flash file ?
These are the 2 files i use to edit build.prop :
Code:
ui_print("Persistant DPI mod by volle");
ui_print(" Mounting /system");
ifelse(is_mounted("/system"), unmount("/system"));
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
ui_print(" Extracting backupscript");
package_extract_file("script/99-DPI.sh", "/system/addon.d/99-DPI.sh");
set_perm(0, 0, 0777, "/system/addon.d/99-DPI.sh");
ui_print(" Running backupscript");
assert(run_program("/system/addon.d/99-DPI.sh","restore"));
ui_print(" Unmounting /system");
unmount("/system");
ui_print("Everything done");
Code:
#!/sbin/sh
# persistant dpi by volle
# credits: nuclearmistake for ui_print cmd
# Print function
export OUTFD=$(ps | grep -v "grep" | grep -o -E "update_binary(.*)" | cut -d " " -f 3); #BIG props to Chainfire
[ ! $OUTFD ] && export OUTFD=$(ps | grep -v "grep" | grep -o -E "/tmp/updater(.*)" | cut -d " " -f 3); #BIG props nuclearmistake for TWRP-izing
ui_print() { if [ $OUTFD ]; then echo "ui_print $*" 1>&$OUTFD; fi; return 0; }
case "$1" in
pre-backup)
;;
backup)
;;
post-backup)
;;
pre-restore)
;;
restore)
echo "qemu.hw.mainkeys=0" >> /system/build.prop
ui_print " HW Mainkeys set"
;;
post-restore)
;;
*)
ui_print " Unkown command $1"
;;
esac

[SOLVED] Addon.d script doesn't work

Hi, I created an addon.d script called 'deleteapks.sh' into /system/addon.d:
Here is the code:
#!/sbin/sh
#
# /system/addon.d/deleteapks.sh
#
. /tmp/backuptool.functions
list_files() {
cat <priv-app/ViPER4Android_FX_A4.x/V4A.x.apk
etc/gps.conf
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/$FILE
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/$FILE $R
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
rm -rf /system/app/Apollo
rm -f /system/app/Apollo/Apollo.apk
rm -rf /system/app/Browser
rm -f /system/app/Browser/Browser.apk
rm -rf /system/app/Calendar
rm -f /system/app/Calendar/Calendar.apk
rm -rf /system/app/Camera2
rm -f /system/app/Camera2/Camera2.apk
rm -rf /system/app/CMFileManager
rm -f /system/app/CMFileManager/CMFileManager.apk
rm -rf /system/app/CMHome
rm -f /system/app/CMHome/CMHome.apk
rm -rf /system/app/CMWallpapers
rm -f /system/app/CMWallpapers/CMWallpapers.apk
rm -rf /system/app/DashClock
rm -f /system/app/DashClock/DashClock.apk
rm -rf /system/app/DeskClock
rm -f /system/app/DeskClock/DeskClock.apk
rm -rf /system/app/DSPManager
rm -f /system/app/DSPManager/DSPManager.apk
rm -rf /system/app/Eleven
rm -f /system/app/Eleven/Eleven.apk
rm -rf /system/app/Email
rm -f /system/app/Email/Email.apk
rm -rf /system/app/Exchange2
rm -f /system/app/Exchange2/Exchange2.apk
rm -rf /system/app/ExchangeServices
rm -f /system/app/ExchangeServices/ExchangeServices.apk
rm -rf /system/app/FaceLock
rm -f /system/app/FaceLock/FaceLock.apk
rm -rf /system/app/Galaxy4
rm -f /system/app/Galaxy4/Galaxy4.apk
rm -rf /system/app/Gallery2
rm -f /system/app/Gallery2/Gallery2.apk
rm -rf /system/app/LatinIME
rm -f /system/app/LatinIME/LatinIME.apk
rm -rf /system/app/LatinImeDictionaryPack
rm -f /system/app/LatinImeDictionaryPack/LatinImeDictionaryPack.apk
rm -rf /system/app/LiveWallpapers
rm -f /system/app/LiveWallpapers/LiveWallpapers.apk
rm -rf /system/app/LiveWallpapersPicker
rm -f /system/app/LiveWallpapersPicker/LiveWallpapersPicker.apk
rm -rf /system/app/LockClock
rm -f /system/app/LockClock/LockClock.apk
rm -rf /system/app/Music
rm -f /system/app/Music/Music.apk
rm -rf /system/app/SoundRecorder
rm -f /system/app/SoundRecorder/SoundRecorder.apk
rm -rf /system/app/VoicePlus
rm -f /system/app/VoicePlus/VoicePlus.apk
rm -rf /system/app/WhisperPush
rm -f /system/app/WhisperPush/WhisperPush.apk
rm -rf /system/priv-app/AudioFX
rm -f /system/priv-app/AudioFX/AudioFX.apk
rm -rf /system/priv-app/KernelAdiutor
rm -f /system/priv-app/KernelAdiutor/KernelAdiutor.apk
rm -rf /system/priv-app/OmniSwitch
rm -f /system/priv-app/OmniSwitch/OmniSwitch.apk
rm -rf /system/priv-app/MusicFX
rm -f /system/priv-app/MusicFX/MusicFX.apk
;;
esac
What I'd like to do:
1. Backup/Restore Viper4Android.apk and gps.conf to survive a dirty flash.
2. Delete all listed system apps after a dirty flash
I kept the same structure as a bloatware removal script and this script.
deleteapks.sh is stored into /system/addon.d with 755 permissions. I didn't wipe the /system partition before flashing the rom update and the script has not been removed.
However Viper4Android and gps.cong files didn't survive and the listed system apps weren't removed.
What's wrong with my script?
Note: I could do these modifications through a flashable zip (see below) but the aim to reduce the number of zips I have to flash.
This is the updater-script I use after a clean flash:
ui_print("+-------------------------------------+");
ui_print("| bloatware removal script |");
ui_print("| |");
ui_print("| !!!BYE BYE!!! |");
ui_print("+-------------------------------------+");
run_program("/sbin/busybox", "umount", "/system");
run_program("/sbin/busybox", "mount", "/system");
ui_print(" ");
ui_print("***Deleting bloatwares***");
delete_recursive(
"/system/app/AudioFX",
"/system/app/Browser",
"/system/app/Calendar",
"/system/app/DeskClock",
"/system/app/DSPManager",
"/system/app/CMFileManager",
"/system/app/Eleven",
"/system/app/Email",
"/system/app/Exchange2",
"/system/app/ExchangeServices",
"/system/app/FaceLock",
"/system/app/Galaxy4",
"/system/app/Gallery2",
"/system/app/LiveWallpapers",
"/system/app/LiveWallpapersPicker",
"/system/app/LockClock",
"/system/app/MusicFX",
"/system/app/SoundRecorder",
"/system/app/WhisperPush",
"/system/etc/gps.conf",
"/system/priv-app/AudioFX",
"/system/priv-app/MusicFX",
"/system/priv-app/DSPManager",
"/system/priv-app/KernelAdiutor",
"/system/priv-app/OmniSwitch"
);
ui_print("Installing Cerberus, BBS, GSam...");
show_progress(8.800000, 5);
run_program("/sbin/busybox", "mount", "/system");
package_extract_dir("system", "/system/");
ui_print("***Fixing permissions***");
set_perm(0, 0, 0755, "/system/priv-app/Viper4Android");
set_perm(0, 0, 0755, "/system/addon.d/deleteapks.sh");
set_perm(0, 0, 0644, "/system/priv-app/Viper4Android/V4A.apk");
set_perm(0, 0, 0644, "/system/etc/gps.conf");
set_perm(0, 0, 0644, "/system/priv-app/com.asksven.betterbatterystats_signed.apk");
set_perm(0, 0, 0644, "/system/priv-app/Gsam.apk");
set_perm(0, 0, 0644, "/system/priv-app/Cerberus.apk");
show_progress(8.800000, 5);
run_program("/sbin/busybox", "unmount", "/system");
ui_print(" ");
ui_print("Completed.");
ui_print("Enjoy!");
Why not just get jrummys app and go to apps and take them out in one go and Reboot as I've done with the 5.1.1 update? You can be fkexible or take more out, I took keyboard and launcher etc as I use nova and swiftkey
SENT BY ENTANGLEMENT
zerosum0 said:
Why not just get jrummys app and go to apps and take them out in one go and Reboot as I've done with the 5.1.1 update? You can be fkexible or take more out, I took keyboard and launcher etc as I use nova and swiftkey
SENT BY ENTANGLEMENT
Click to expand...
Click to collapse
I don't want to install a new app. If needed I will flash my custom updater-script for each dirty flash.
Primokorn said:
I kept the same structure as a bloatware removal script and this script.
Click to expand...
Click to collapse
Does this script work with your rom? Could be a situation where none of your scripts are running.
Primokorn said:
I don't want to install a new app. If needed I will flash my custom updater-script for each dirty flash.
Click to expand...
Click to collapse
If you want a quick way to do this you could download my zip from the ViperOP and just edit out the apps you want removed/restored from the updater-script and addon.sh.
Wakamatsu said:
Does this script work with your rom? Could be a situation where none of your scripts are running.
Click to expand...
Click to collapse
idk. I'll try the 'Bloatware Removal Script' for the next dirty flash.
AndrasLOHF said:
If you want a quick way to do this you could download my zip from the ViperOP and just edit out the apps you want removed/restored from the updater-script and addon.sh.
Click to expand...
Click to collapse
If your script saves V4A and allows apps to survice a dirty flash then I'll take a look after testing the above script.
Actually your script seems to have the same structure as mine.
Finally I reduced the number of lines by removing apps and using rm -rf command and I manually typed the lines for V4A + gps.conf and the removed folders.
Maybe this problem was caused by some extra spaces...
Here is the working script for information:
#!/sbin/sh
#
# /system/addon.d/deleteapks.sh
#
. /tmp/backuptool.functions
list_files() {
cat <<EOF
priv-app/Viper4Android/V4A.apk
etc/gps.conf
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/"$FILE"
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
done
rm -rf /system/priv-app/AudioFX
rm -rf /system/priv-app/KernelAdiutor
rm -rf /system/priv-app/OmniSwitch
rm -rf /system/priv-app/MusicFX
rm -rf /system/app/Apollo
rm -rf /system/app/Browser
rm -rf /system/app/Calendar
rm -rf /system/app/CMFileManager
rm -rf /system/app/DeskClock
rm -rf /system/app/DSPManager
rm -rf /system/app/Eleven
rm -rf /system/app/Email
rm -rf /system/app/Exchange2
rm -rf /system/app/ExchangeServices
rm -rf /system/app/FaceLock
rm -rf /system/app/LatinIME
rm -rf /system/app/LatinImeDictionaryPack
rm -rf /system/app/LockClock
rm -rf /system/app/SoundRecorder
rm -rf /system/app/VideoEditor
rm -rf /system/app/WhisperPush
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac

[Q] Why doesn't my Addon.d script work? Need help :)

Hi
I have made an addon.d script that would backup betterbatterystats and gsam system apps when upgrading system(cm12.1 nightlies).
Also the Aplle Color Emoji's should be backup.
Also I want to remove the camera sounds on every update.
I have checked other scripts in the addon.d dir but can't find the problems myself. Need your help.
Whats wrong with my addon.d script?
Here's my script:
#!/sbin/sh
#
# /system/addon.d/81-custom_backup.sh
# During a CM12 upgrade, this script backs up custom files.
#
. /tmp/backuptool.functions
list_files() {
cat <<EOF
priv-app/base.apk
priv-app/com.asksven.betterbatterystats_xdaedition.apk
etc/fallback_fonts.xml
etc/fonts.xml
fonts/AppleColorEmoji.ttf
EOF
}
case "$1" in
backup)
echo "STARTING TO BACKUP CUSTOM FILES..."
list_files | while read FILE DUMMY; do
echo backup_file $S/"$FILE"
backup_file $S/"$FILE"
done
ls -al /tmp
echo "ENDING TO BACKUP CUSTOM FILES..."
;;
restore)
echo "STARTING TO RESTORE CUSTOM FILES..."
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
echo $S/$FILE $( ls -alZ $S/$FILE )
done
echo "ENDING TO RESTORE CUSTOM FILES..."
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
echo "STARTING POST-RESTORE CUSTOM FILES..."
rm media/audio/ui/camera_click.ogg
rm media/audio/ui/camera_focus.ogg
echo "DONE POST-RESTORE XPOSED"
;;
esac

Using command echo .sh file doesn't work in recovery

I'm trying to understand why using echo command in sh file doesn't work in recovery.
I've made a flashable zip with 7-zip, it contains a shell script.
The updater-script is
Code:
ui_print("");
run_program("/sbin/busybox", "mount", "/system");
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("test", "/tmp");
set_perm(0, 0, 0777, "/tmp/test.sh");
run_program("/tmp/test.sh");
delete_recursive("/tmp");
unmount("/system");
unmount("/data");
and my test.sh is like this :
Code:
#!/sbin/sh
rm -rf /system/app/YouTube
echo "Delete Youtube"
test.sh deletes Youtube folder but echo command doesn't work.
I use TWRP 3.2.3.0 recovery
Echo is a command for windows command line. In recovery you use: ui_print("<message goes here");
In recovery the language used is called Edify.
Read a bit about it here:
https://forum.xda-developers.com/wiki/Edify_script_language
joluke said:
Echo is a command for windows command line. In recovery you use: ui_print("<message goes here");
In recovery the language used is called Edify.
Read a bit about it here:
https://forum.xda-developers.com/wiki/Edify_script_language
Click to expand...
Click to collapse
you use ui_print in updater-script ?
but in sh file how to print on screen if echo doesn't work in recovery ?
kramer04 said:
you use ui_print in updater-script ?
but in sh file how to print on screen if echo doesn't work in recovery ?
Click to expand...
Click to collapse
Sh use the commands you use in linux
And yes ui_print is for updater-script
joluke said:
Sh use the commands you use in linux
And yes ui_print is for updater-script
Click to expand...
Click to collapse
Ok trying to use echo in sh file doesn't work for me.
So I don't understand how to do .
Any suggestions?
kramer04 said:
Ok trying to use echo in sh file doesn't work for me.
So I don't understand how to do .
Any suggestions?
Click to expand...
Click to collapse
Use Linux commands only. Echo is for Windows command line.
I don't have the skills to help you but googling "Linux commands for console" should help
joluke said:
Use Linux commands only. Echo is for Windows command line.
I don't have the skills to help you but googling "Linux commands for console" should help
Click to expand...
Click to collapse
So googling linus commands but I don't find how to use echo in a sh file in recovery.
If you have time try yourself echo command .
I've no idea why it doesn't work.
ECHO is a command for windows command line dude! Why do you insist on using echo? Echo is for windows command line? Got it now?
You need to use other commands according to the system you are using. and in android you use bash language on .sh files!
joluke said:
ECHO is a command for windows command line dude! Why do you insist on using echo? Echo is for windows command line? Got it now?
You need to use other commands according to the system you are using. and in android you use bash language on .sh files!
Click to expand...
Click to collapse
but i don't understand why it doesn't work
else i don't know how to replace echo by an other command
Thanks for help
kramer04 said:
but i don't understand why it doesn't work
else i don't know how to replace echo by an other command
Thanks for help
Click to expand...
Click to collapse
Every programming language uses its own commands...
Maybe because of that?
After some research
i change a little my script to see if command echo works
code in updater-script
Code:
ui_print("*************************");
ui_print("sh10");
ui_print("*************************");
unmount("/system");
unmount("/data");
#ui_print("-- Montage partitions...");
run_program("/sbin/busybox", "mount", "/system");
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("test", "/tmp");
set_perm(0, 0, 0777, "/tmp/test.sh");
run_program("/tmp/test.sh");
#ui_print("Extracting files ...");
#package_extract_dir("system", "/tmp/update");
#set_perm(0, 0, 0755, "/tmp/update/myscript.sh");
#run_program("/tmp/update/myscript.sh");
#delete_recursive("/tmp*");
ui_print("END OF PROCESS");
ui_print("*************************");
unmount("/data");
unmount("/system");
code in test.sh file
Code:
#!/sbin/sh
#echo on
#function to display commands
exe() { echo "\$ [email protected]" ; "[email protected]" ; }
OUTFD=$2
ui_print() {
if [ $OUTFD != "" ]; then
echo "ui_print ${1} " 1>&$OUTFD;
echo "ui_print " 1>&$OUTFD;
else
echo "${1}";
fi;
}
#rm -rf /system/app/YouTube
echo "hello world !, using echo" >tong.txt
exe echo "Delete YouTube, using exe echo"
echo "Delete YouTube, using echo" >>tong.txt
printf "hello world, using printf" >>tong.txt
cat tong.txt
ui_print "hello world! using ui_print"
echo command doesn't print on screen but it creates tong.txt and pass in results.
We can see it works in recovery.log
I:Set page: 'install'
I:Set page: 'flash_confirm'
I:Set page: 'flash_zip'
Iperation_start: 'Flashing'
Installing zip file '/external_sd/Custom Rom/test.zip'
Checking for Digest file...
Skipping Digest check: no Digest file found
I:Update binary zip
Verifying package compatibility...
Package doesn't contain compatibility.zip entry
I:Zip does not contain SELinux file_contexts file in its root.
I:has_legacy_properties: Found legacy property match!
I:Legacy property environment initialized.
*************************
sh10
*************************
unmount of /system failed; no such volume
about to run program [/sbin/busybox] with 3 args
about to run program [/sbin/busybox] with 3 args
minzip: Extracted file "/tmp/test.sh"
about to run program [/tmp/test.sh] with 1 args
$ echo Delete YouTube, using exe echo
Delete YouTube, using exe echo
hello world !, using echo
Delete YouTube, using echo
hello world, using printfsh: : unknown operand
hello world! using ui_print
END OF PROCESS
*************************
script result was [/system]
I:Updater process ended with RC=0
I:Legacy property environment disabled.
I:Install took 0 second(s).
Updating partition details...
I:mount -o bind '/data/media/0' '/sdcard' process ended with RC=0
Someone has an idea why echo doesn't print on screen in TWRP recovery; else it works...
weird for me
kramer04 said:
After some research
i change a little my script to see if command echo works
code in updater-script
Code:
ui_print("*************************");
ui_print("sh10");
ui_print("*************************");
unmount("/system");
unmount("/data");
#ui_print("-- Montage partitions...");
run_program("/sbin/busybox", "mount", "/system");
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("test", "/tmp");
set_perm(0, 0, 0777, "/tmp/test.sh");
run_program("/tmp/test.sh");
#ui_print("Extracting files ...");
#package_extract_dir("system", "/tmp/update");
#set_perm(0, 0, 0755, "/tmp/update/myscript.sh");
#run_program("/tmp/update/myscript.sh");
#delete_recursive("/tmp*");
ui_print("END OF PROCESS");
ui_print("*************************");
unmount("/data");
unmount("/system");
code in test.sh file
Code:
#!/sbin/sh
#echo on
#function to display commands
exe() { echo "\$ [email protected]" ; "[email protected]" ; }
OUTFD=$2
ui_print() {
if [ $OUTFD != "" ]; then
echo "ui_print ${1} " 1>&$OUTFD;
echo "ui_print " 1>&$OUTFD;
else
echo "${1}";
fi;
}
#rm -rf /system/app/YouTube
echo "hello world !, using echo" >tong.txt
exe echo "Delete YouTube, using exe echo"
echo "Delete YouTube, using echo" >>tong.txt
printf "hello world, using printf" >>tong.txt
cat tong.txt
ui_print "hello world! using ui_print"
echo command doesn't print on screen but it creates tong.txt and pass in results.
We can see it works in recovery.log
I:Set page: 'install'
I:Set page: 'flash_confirm'
I:Set page: 'flash_zip'
Iperation_start: 'Flashing'
Installing zip file '/external_sd/Custom Rom/test.zip'
Checking for Digest file...
Skipping Digest check: no Digest file found
I:Update binary zip
Verifying package compatibility...
Package doesn't contain compatibility.zip entry
I:Zip does not contain SELinux file_contexts file in its root.
I:has_legacy_properties: Found legacy property match!
I:Legacy property environment initialized.
*************************
sh10
*************************
unmount of /system failed; no such volume
about to run program [/sbin/busybox] with 3 args
about to run program [/sbin/busybox] with 3 args
minzip: Extracted file "/tmp/test.sh"
about to run program [/tmp/test.sh] with 1 args
$ echo Delete YouTube, using exe echo
Delete YouTube, using exe echo
hello world !, using echo
Delete YouTube, using echo
hello world, using printfsh: : unknown operand
hello world! using ui_print
END OF PROCESS
*************************
script result was [/system]
I:Updater process ended with RC=0
I:Legacy property environment disabled.
I:Install took 0 second(s).
Updating partition details...
I:mount -o bind '/data/media/0' '/sdcard' process ended with RC=0
Someone has an idea why echo doesn't print on screen in TWRP recovery; else it works...
weird for me
Click to expand...
Click to collapse
You are probably going to have to go in a little different direction. See this thread where update-binary is used in place of update-script.
Tulsadiver said:
You are probably going to have to go in a little different direction. See this thread where update-binary is used in place of update-script.
Click to expand...
Click to collapse
Thanks for your answer but could you add the link
kramer04 said:
Thanks for your answer but could you add the link
Click to expand...
Click to collapse
Sorry, lol!
https://forum.xda-developers.com/an...-complete-shell-script-flashable-zip-t2934449
Tulsadiver said:
Sorry, lol!
https://forum.xda-developers.com/an...-complete-shell-script-flashable-zip-t2934449
Click to expand...
Click to collapse
Thanks, but this isn't exactly what i'm looking for even if it's very interesting.
I would like to know how to display on recovery screen
I tryed with echo command but it doesn't work
For example running this script in sh file on recovery TWRP
Code:
#!/sbin/sh
csc_id=`cat /efs/imei/mps_code.dat`
echo "==== Your active csc is $csc_id ====="
echo do displays this
==== Your active csc is BTU ====
on recovery screen
but not displays anything.
Is there a way to activate it ?
kramer04 said:
Thanks, but this isn't exactly what i'm looking for even if it's very interesting.
I would like to know how to display on recovery screen
I tryed with echo command but it doesn't work
For example running this script in sh file on recovery TWRP
Code:
#!/sbin/sh
csc_id=`cat /efs/imei/mps_code.dat`
echo "==== Your active csc is $csc_id ====="
echo do displays this
==== Your active csc is BTU ====
on recovery screen
but not displays anything.
Is there a way to activate it ?
Click to expand...
Click to collapse
Echo has never worked on my phones. ui_print works on my pixel and pixel 2. It stopped working on my pixel 3 XL but that is because I haven't found a way to mount system using toybox. Pixel 3 XL won't mount using BusyBox.
Tulsadiver said:
Echo has never worked on my phones. ui_print works on my pixel and pixel 2. It stopped working on my pixel 3 XL but that is because I haven't found a way to mount system using toybox. Pixel 3 XL won't mount using BusyBox.
Click to expand...
Click to collapse
I know echo works because i see it in recovery log but it doesn't display anything on recovery screen
And i don't understand why;
Maybe it's because of recovery ?
I use TWRP
kramer04 said:
I know echo works because i see it in recovery log but it doesn't display anything on recovery screen
And i don't understand why;
Maybe it's because of recovery ?
I use TWRP
Click to expand...
Click to collapse
Most everyone uses TWRP. I believe for recovery screen, echo must be passed on to ui_print. Try this for an explanation:
https://forum.xda-developers.com/showthread.php?t=1023150&page=1
Tulsadiver said:
Most everyone uses TWRP. I believe for recovery screen, echo must be passed on to ui_print. Try this for an explanation:
https://forum.xda-developers.com/showthread.php?t=1023150&page=1
Click to expand...
Click to collapse
yes. totaly true
finaly i resolved my problem using code from Chainfire
Code:
#!/sbin/sh
OUTFD=1
readlink /proc/$$/fd/$OUTFD 2>/dev/null | grep /tmp >/dev/null
if [ "$?" -eq "0" ]; then
# rerouted to log file, we don't want our ui_print commands going there
OUTFD=0
# we are probably running in embedded mode, see if we can find the right fd
# we know the fd is a pipe and that the parent updater may have been started as
# 'update-binary 3 fd zipfile'
for FD in `ls /proc/$$/fd`; do
readlink /proc/$$/fd/$FD 2>/dev/null | grep pipe >/dev/null
if [ "$?" -eq "0" ]; then
ps | grep " 3 $FD " | grep -v grep >/dev/null
if [ "$?" -eq "0" ]; then
OUTFD=$FD
break
fi
fi
done
fi
ui_print() {
echo -n -e "ui_print $1\n" >> /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" >> /proc/self/fd/$OUTFD
}
Thanks to all
https://forum.xda-developers.com/android/software-hacking/dev-complete-shell-script-flashable-zip-t2934449/page37
kramer04 said:
yes. totaly true
finaly i resolved my problem using code from Chainfire
Code:
#!/sbin/sh
OUTFD=1
readlink /proc/$$/fd/$OUTFD 2>/dev/null | grep /tmp >/dev/null
if [ "$?" -eq "0" ]; then
# rerouted to log file, we don't want our ui_print commands going there
OUTFD=0
# we are probably running in embedded mode, see if we can find the right fd
# we know the fd is a pipe and that the parent updater may have been started as
# 'update-binary 3 fd zipfile'
for FD in `ls /proc/$$/fd`; do
readlink /proc/$$/fd/$FD 2>/dev/null | grep pipe >/dev/null
if [ "$?" -eq "0" ]; then
ps | grep " 3 $FD " | grep -v grep >/dev/null
if [ "$?" -eq "0" ]; then
OUTFD=$FD
break
fi
fi
done
fi
ui_print() {
echo -n -e "ui_print $1\n" >> /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" >> /proc/self/fd/$OUTFD
}
Thanks to all
https://forum.xda-developers.com/android/software-hacking/dev-complete-shell-script-flashable-zip-t2934449/page37
Click to expand...
Click to collapse
That works on my pixel and pixel 2 but not my pixel 3 XL. But on my pixel 3 XL I also have to use toybox to mount instead of BusyBox
run_program("/sbin/toybox", "mount", "/system");

Categories

Resources