[G1 Android Development] farmatito:
This script and the attached statically compiled zip program are able

to create a backup file named bakpak.zip on your sdcard containing

all your phone's proprietary files I'm aware of. If you know about

other files that need to be added to the list please let me know.

Roms with odexed apk packages are not supported as deodexing

them is not trivial and legally dubious.

List:

/system/app/BugReport.apk
/system/app/checkin.apk
/system/app/Gmail.apk
/system/app/GmailProvider.apk
/system/app/GoogleApps.apk
/system/app/GooglePartnerSetup.apk
/system/app/GoogleSettingsProvider.apk
/system/app/gtalkservice.apk
/system/app/MediaUploader.apk
/system/app/NetworkLocation.apk
/system/app/SetupWizard.apk
/system/app/Street.apk
/system/app/Talk.apk
/system/app/Vending.apk
/system/app/VoiceSearch.apk
/system/app/YouTube.apk
/system/framework/com.google.android.gtalkservice.jar
/system/framework/com.google.android.maps.jar
/system/etc/permissions/com.google.android.gtalkservice.xml
/system/etc/permissions/com.google.android.maps.xml
/system/bin/akmd
/system/etc/firmware/brf6300.bin
/system/etc/gps.conf
/system/etc/wifi/Fw1251r1c.bin
/system/etc/wifi/tiwlan.ini
/system/lib/libaudioeq.so
/system/lib/libgps.so
/system/lib/libhgl.so
/system/lib/libhtc_acoustic.so
/system/lib/libhtc_ril.so
/system/lib/libjni_pinyinime.so
/system/lib/libmm-adspsvc.so
/system/lib/libOmxCore.so
/system/lib/libOmxH264Dec.so
/system/lib/libOmxMpeg4Dec.so
/system/lib/libOmxVidEnc.so
/system/lib/libopencorehw.so
/system/lib/libpvasf.so
/system/lib/libpvasfreg.so
/system/lib/libqcamera.so
/system/lib/libspeech.so
/system/lib/hw/lights.goldfish.so
/system/lib/hw/lights.msm7k.so
/system/lib/hw/sensors.trout.so"

# Removed because under Apache v2 license
#/system/app/GoogleContactsProvider.apk
#/system/app/GoogleSubscribedFeedsProvider.apk
#/system/app/ImProvider.apk
#/system/app/VoiceDialer.apk
# Removed from list, we usually flash modded versions, could be readded if needed
#/system/etc/AudioFilter.csv
#/system/etc/AudioPara4.csv
#/system/etc/AudioPreProcess.csv

The purpose of this script is to enable devs to backup all proprietary files

before flashing a updated rom and restore them after the flashing process.

The restore script must still be developed, one thing to take care of is that

during restore you have to set the correct file permissions and ownership

yourself if choose to create a zip archive. If you create a tar.gz archive

(-t) the file permissions and ownership will be restored correctly.

Setup:

unzip backup.zip
adb remount
adb push zip /system/bin/
adb push bakpak.sh /system/bin/
adb shell
chown root.shell /system/bin/zip
chown root.shell /system/bin/bakpak.sh
chmod 755 /system/bin/zip
chmod 755 /system/bin/bakpak.sh

Usage:

adb shell
~ # bakpak.sh -h
Usage /system/bin/bakpak.sh [OPTIONS]
-t create a tar.gz
-v print version
-h this help
~ # bakpak.sh

or in the terminal

su
bakpak.sh

Example:

~ # bakpak.sh
zip warning: name not matched: /system/app/VoiceDialer.apk
zip warning: name not matched: /system/app/VoiceSearch.apk
adding: system/app/BugReport.apk (deflated 1%)
adding: system/app/checkin.apk (deflated 1%)
adding: system/app/Gmail.apk (deflated 16%)
adding: system/app/GmailProvider.apk (deflated 0%)
adding: system/app/GoogleApps.apk (deflated 1%)
adding: system/app/GoogleContactsProvider.apk (deflated 1%)
adding: system/app/GooglePartnerSetup.apk (deflated 1%)
adding: system/app/GoogleSettingsProvider.apk (deflated 1%)
adding: system/app/GoogleSubscribedFeedsProvider.apk (deflated 2%)
adding: system/app/gtalkservice.apk (deflated 1%)
adding: system/app/ImProvider.apk (deflated 3%)
adding: system/app/MediaUploader.apk (deflated 1%)
adding: system/app/NetworkLocation.apk (deflated 1%)
adding: system/app/SetupWizard.apk (deflated 9%)
adding: system/app/Street.apk (deflated 2%)
adding: system/app/Talk.apk (deflated 4%)
adding: system/app/Vending.apk (deflated 3%)
adding: system/app/YouTube.apk (deflated 3%)
adding: system/framework/com.google.android.gtalkservice.jar (deflated 1%)
adding: system/framework/com.google.android.maps.jar (deflated 0%)
adding: system/etc/permissions/com.google.android.gtalkservice.xml (deflated 41%)
adding: system/etc/permissions/com.google.android.maps.xml (deflated 41%)
adding: system/bin/akmd (deflated 67%)
adding: system/etc/firmware/brf6300.bin (deflated 37%)
adding: system/etc/gps.conf (deflated 44%)
adding: system/etc/wifi/Fw1251r1c.bin (deflated 40%)
adding: system/etc/wifi/tiwlan.ini (deflated 67%)
adding: system/lib/libaudioeq.so (deflated 59%)
adding: system/lib/libgps.so (deflated 70%)
adding: system/lib/libhgl.so (deflated 58%)
adding: system/lib/libhtc_acoustic.so (deflated 61%)
adding: system/lib/libhtc_ril.so (deflated 53%)
adding: system/lib/libjni_pinyinime.so (deflated 46%)
adding: system/lib/libmm-adspsvc.so (deflated 55%)
adding: system/lib/libOmxCore.so (deflated 62%)
adding: system/lib/libOmxH264Dec.so (deflated 55%)
adding: system/lib/libOmxMpeg4Dec.so (deflated 55%)
adding: system/lib/libOmxVidEnc.so (deflated 44%)
adding: system/lib/libopencorehw.so (deflated 68%)
adding: system/lib/libpvasf.so (deflated 50%)
adding: system/lib/libpvasfreg.so (deflated 53%)
adding: system/lib/libqcamera.so (deflated 45%)
adding: system/lib/libspeech.so (deflated 50%)
adding: system/lib/hw/lights.goldfish.so (deflated 73%)
adding: system/lib/hw/lights.msm7k.so (deflated 51%)
adding: system/lib/hw/sensors.trout.so (deflated 62%)
~ # cd sdcard/
/sdcard # ls -la bakpak.zip
----rw-rw- 1 system system 4620298 Sep 27 08:59 bakpak.zip

Enjoy!

Changelog:

v1 initial release

v2 remove some packages and add a warning about odex files.

v3 added ability to create tar.gz archives, check if dest exists,

check for missing files when using tar.Added command line parsing.

v3.1 Minor bugfixes