droidzone

system/app odex-er

Mar 5th, 2011
164
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #
  2. # Posted by Droidzone
  3. #
  4. # system/app odex-er by Paul O'Brien @ www.MoDaCo.com
  5. # Create Odex file from deodexed apks
  6. #
  7. #
  8. # experimental - nandroid backup before you run this script!
  9. #
  10. #
  11. #
  12. # version 0.1, 29th January 2010
  13. #
  14.  
  15. #
  16. # set permissions
  17. #
  18. chmod 4755 /data/odex/dexopt-wrapper
  19. #
  20. chmod 4755 /data/odex/zip
  21. #
  22. chmod 4755 /data/odex/zipalign
  23. #
  24.  
  25. #
  26. # mount system as rw
  27. #
  28. mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
  29. #
  30.  
  31. #
  32. # change to system/app and process each apk!
  33. #
  34. cd /system/app
  35. #
  36.  
  37. #
  38. for filename in `find . -name '*.apk'`
  39. #
  40. do
  41. #
  42.  
  43. #
  44. # step 1 - odex the apk
  45. #
  46. /data/odex/dexopt-wrapper $filename `echo $filename | sed 's/\(.*\.\)apk/\1odex/'`
  47. #
  48.  
  49. #
  50. # step 2 - did we succesfully odex?
  51. #
  52. if [ -f `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` ]
  53. #
  54. then
  55. #
  56. # step 3 - remove the classes.dex from the apk
  57. #
  58. /data/odex/zip -d $filename classes.dex
  59. #
  60.  
  61. #
  62. # step 4 - zipalign, just in case
  63. #
  64. /data/odex/zipalign -f -v 4 $filename $filename.new
  65. #
  66. mv $filename.new $filename
  67. #
  68. fi
  69. #
  70.  
  71. #
  72. done;
  73. #
  74.  
  75. #
  76. # clear dalvik cache
  77. #
  78. rm -r /data/dalvik-cache/*
  79. #
  80.  
  81. #
  82. # reboot
  83. #
  84. reboot
RAW Paste Data