Advertisement
Perka

current zipalign

Oct 4th, 2011
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. #!/system/bin/sh
  2. # Automatic ZipAlign by Wes Garner
  3. # ZipAlign files in /data that have not been previously ZipAligned (using md5sum)
  4. # Thanks to oknowton for the changes
  5.  
  6. # Changelog:
  7. # 1.1 (12/1/09) Switched to zipalign -c 4 to check the apk instead of MD5 (oknowton)
  8. # 1.0 (11/30/09) Original
  9.  
  10. LOG_FILE=/data/zipalign.log
  11. if [ -e $LOG_FILE ]; then
  12. rm $LOG_FILE;
  13. fi;
  14.  
  15. echo "Starting Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
  16. for apk in /data/app/*.apk ; do
  17. zipalign -c 4 $apk;
  18. ZIPCHECK=$?;
  19. if [ $ZIPCHECK -eq 1 ]; then
  20. echo ZipAligning $(basename $apk) | tee -a $LOG_FILE;
  21. zipalign -f 4 $apk /cache/$(basename $apk);
  22. if [ -e /cache/$(basename $apk) ]; then
  23. cp -f -p /cache/$(basename $apk) $apk | tee -a $LOG_FILE;
  24. rm /cache/$(basename $apk);
  25. else
  26. echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
  27. fi;
  28. else
  29. echo ZipAlign already completed on $apk | tee -a $LOG_FILE;
  30. fi;
  31. done;
  32. for apk in /system/app/*.apk ; do
  33. zipalign -c 4 $apk;
  34. ZIPCHECK=$?;
  35. if [ $ZIPCHECK -eq 1 ]; then
  36. echo ZipAligning $(basename $apk) | tee -a $LOG_FILE;
  37. zipalign -f 4 $apk /cache/$(basename $apk);
  38. if [ -e /cache/$(basename $apk) ]; then
  39. cp -f -p /cache/$(basename $apk) $apk | tee -a $LOG_FILE;
  40. rm /cache/$(basename $apk);
  41. else
  42. echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
  43. fi;
  44. else
  45. echo ZipAlign already completed on $apk | tee -a $LOG_FILE;
  46. fi;
  47. done;
  48. echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
  49.  
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement