apktool 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. #
  3. # Copyright (C) 2007 The Android Open Source Project
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # This script is a wrapper for smali.jar, so you can simply call "smali",
  17. # instead of java -jar smali.jar. It is heavily based on the "dx" script
  18. # from the Android SDK
  19. # Set up prog to be the path of this script, including following symlinks,
  20. # and set up progdir to be the fully-qualified pathname of its directory.
  21. prog="$0"
  22. while [ -h "${prog}" ]; do
  23. newProg=`/bin/ls -ld "${prog}"`
  24. echo ${newProg}
  25. newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
  26. if expr "x${newProg}" : 'x/' >/dev/null; then
  27. prog="${newProg}"
  28. else
  29. progdir=`dirname "${prog}"`
  30. prog="${progdir}/${newProg}"
  31. fi
  32. done
  33. oldwd=`pwd`
  34. progdir=`dirname "${prog}"`
  35. cd "${progdir}"
  36. progdir=`pwd`
  37. prog="${progdir}"/`basename "${prog}"`
  38. cd "${oldwd}"
  39. jarfile=apktool_2.2.4.jar
  40. libdir="$progdir"
  41. if [ ! -r "$libdir/$jarfile" ]
  42. then
  43. echo `basename "$prog"`": can't find $jarfile"
  44. exit 1
  45. fi
  46. javaOpts=""
  47. # If you want DX to have more memory when executing, uncomment the following
  48. # line and adjust the value accordingly. Use "java -X" for a list of options
  49. # you can pass here./Users/mac/work/sqy/code/dist/Mahjong21_ok.apk
  50. #
  51. javaOpts="-Xmx256M"
  52. # Alternatively, this will extract any parameter "-Jxxx" from the command line
  53. # and pass them to Java (instead of to dx). This makes it possible for you to
  54. # add a command-line parameter such as "-JXmx256M" in your ant scripts, for
  55. # example.
  56. while expr "x$1" : 'x-J' >/dev/null; do
  57. opt=`expr "$1" : '-J\(.*\)'`
  58. javaOpts="${javaOpts} -${opt}"
  59. shift
  60. done
  61. if [ "$OSTYPE" = "cygwin" ] ; then
  62. jarpath=`cygpath -w "$libdir/$jarfile"`
  63. else
  64. jarpath="$libdir/$jarfile"
  65. fi
  66. # add current location to path for aapt
  67. PATH=$PATH:`pwd`;
  68. export PATH;
  69. exec /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java $javaOpts -jar "$jarpath" "$@"