Advertisement
mateorod

batch.sh_pull_request.output

Jun 18th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.35 KB | None | 0 0
  1. mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$ git diff f42575d58ffa450cd1ab07de69b13fd0d3fbcb7d
  2. diff --git a/auto_patcher b/auto_patcher
  3. index e16ca37..e88bac9 100755
  4. --- a/auto_patcher
  5. +++ b/auto_patcher
  6. @@ -903,6 +903,41 @@ echo "Patches are $PID/$ANDR/$RID/$BID" >> "$LOG"
  7.  
  8.  }
  9.  
  10. +prep_patches () {
  11. +
  12. +    echo "Did not detect patch_tools, preparing"
  13. +    cd "$ROOT/patch_tools"
  14. +    tar cvzf ../patch_tools.tgz *.jar updatecert.pem updatekey.pk8 boot cygwin
  15. +
  16. +    echo "Did not detect patches, preparing"
  17. +    cd "$ROOT"
  18. +    tar cvzf patch_patches.tgz patches
  19. +    zip autopatcher.zip auto_patcher patch_tools.tgz patch_patches.tgz
  20. +}
  21. +
  22. +# Put the variable config outside of the bash source construct so variables
  23. +# are accessible when file is source OR directly executed.
  24. +#ROOT="$(abspath "$(dirname "$(abspath "$(type -p "$0")")")")"
  25. +if [[ ! "$BASH_SOURCE" == "$0" ]]; then
  26. +    # Script is being sourced, not directly executed, must make
  27. +    ROOT="$(abspath "$(dirname "$(abspath "$(type -p "${BASH_SOURCE[0]}")")")")
  28. +else
  29. +    # Script is executing directly, $0 builtin acceptable
  30. +    ROOT="$(abspath "$(dirname "$(abspath "$(type -p "$0")")")")"
  31. +fi
  32. +TOOL="$ROOT/patch_tools.tgz"
  33. +PTCH="$ROOT/patch_patches.tgz"
  34. +DATE=$(date +%Y%m%d%H%M%S)
  35. +TEMP="$ROOT/tmp$DATE"
  36. +TMP="$ROOT/tmp$DATE"
  37. +TMPDIR="$ROOT/tmp$DATE"
  38. +ROM=$(abspath "$1")
  39. +ROMX=$(extpath "$1")
  40. +
  41. +
  42. +# Allow wrapper to determine if script is directly excecuted or sourced from
  43. +# batch.sh bootstrap script.
  44. +if [[ "$BASH_SOURCE" == "$0" ]]; then
  45. if [[ $1 == -h ]]; then
  46.      if [ $# -gt 1 ]; then
  47.           PID=$2
  48. @@ -939,18 +974,8 @@ echo "The Auto-Patcher $VERSION"
  49. echo ""
  50. # by pastime1971 and mateorod
  51.  
  52. -ROOT="$(abspath "$(dirname "$(abspath "$(type -p "$0")")")")"
  53. -TOOL="$ROOT/patch_tools.tgz"
  54. -PTCH="$ROOT/patch_patches.tgz"
  55. cleanup
  56. -# set temporaray directory
  57. -DATE=$(date +%Y%m%d%H%M%S)
  58. -TEMP="$ROOT/tmp$DATE"
  59. -TMP="$ROOT/tmp$DATE"
  60. -TMPDIR="$ROOT/tmp$DATE"
  61. mkdir "$TEMP"
  62. -ROM=$(abspath "$1")
  63. -ROMX=$(extpath "$1")
  64.  
  65. if [[ $OSTYPE == "cygwin" ]]; then
  66.      EXE=".exe"
  67. @@ -979,6 +1004,9 @@ which tar >> "$LOG" || misstools_error "Missing \"tar\" uti
  68.  which jar >> "$LOG" || misstools_error "Missing \"Java Development Kit\" (JDK)"
  69.  which java >> "$LOG" || misstools_error "Missing \"Java Development Kit\" (JDK)
  70. which cpio >> "$LOG" || misstools_error "Missing \"cpio\" utility"
  71. +if [[ ! (-f "$TOOL" || -f "$PTCH") ]]; then
  72. +    prep_patches
  73. +fi
  74. [ -f "$TOOL" ] || misspatch_error "patch_tool.tgz is missing"
  75. [ -f "$PTCH" ] || misspatch_error "patch_patches.tgz is missing"
  76. printtask "### verify ROM ###"
  77. @@ -1604,3 +1632,6 @@ done
  78.  
  79.  cd ..
  80.  \rm -rf "$TEMP"
  81. +
  82. +# End of bash_source if wrap
  83. +fi
  84. diff --git a/batch.sh b/batch.sh
  85. index c5211e3..b584f7b 100755
  86. --- a/batch.sh
  87. +++ b/batch.sh
  88. @@ -1,48 +1,12 @@
  89.  #!/bin/bash
  90.  
  91. -abspath () {
  92. -       case `uname -s` in
  93. -       CYGWIN*)
  94. -               echo $(cygpath -ua "$1") | sed 's:/$::g'
  95. -               ;;
  96. -       Darwin)
  97. -               #[[ $(echo $1 | awk '/^\//') == $1 ]] && echo "$1" || echo "$PWD
  98. -               [[ ${1:0:1} == "/" ]] && echo "$1" || echo "$PWD/$1"
  99. -               ;;
  100. -       Linux)
  101. -                echo $(readlink -f "$1")
  102. -               ;;
  103. -       *)
  104. -               if [[ ${1:0:1} == "/" ]]; then
  105. -                       echo "$1"
  106. -               elif [[ ${1:0:2} == "./" ]]; then
  107. -                       echo "$PWD/${1:2}"
  108. -               else
  109. -                       echo "$PWD/$1"
  110. -               fi
  111. -               ;;
  112. -       esac
  113. -}
  114. +AUTOPATCHER=./auto_patcher
  115.  
  116. -extpath () {
  117. -       case `uname -s` in
  118. -       CYGWIN*)
  119. -               echo $(cygpath -da "$1")
  120. -               ;;
  121. -       *)
  122. -               echo $(abspath "$1")
  123. -               ;;
  124. -       esac
  125. -}
  126. -ROOT=$(abspath `dirname "$0"`)
  127. -ROM=$(abspath "$1")
  128. -ROMX=$(extpath "$1")
  129. +if [ -e "$AUTOPATCHER" ]; then
  130. +    source $AUTOPATCHER
  131. +else
  132. +    echo "Cannot complete batch operations, cannot find file "$AUTOPATCHER"."
  133. +    exit 1
  134. +fi
  135.  
  136. -
  137. -cd "$ROOT/patch_tools"
  138. -tar cvzf ../patch_tools.tgz *.jar updatecert.pem updatekey.pk8 boot cygwin mac
  139. -cd "$ROOT"
  140. -
  141. -tar cvzf patch_patches.tgz patches
  142. -
  143. -zip autopatcher.zip auto_patcher patch_tools.tgz patch_patches.tgz
  144. +prep_patches
  145. mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$ ls *tgz
  146. patch_patches.tgz  patch_tools.tgz
  147. mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$ rm patch_tools.tgz
  148. mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$ ls *tgz
  149. patch_patches.tgz
  150. mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$ ./auto_patcher ../../../Of*/Some*
  151.  
  152. The Auto-Patcher v2.9.8
  153.  
  154. ### verify tools ###
  155. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  156. !! error: patch_tool.tgz is missing
  157. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  158.  
  159. !! The Auto-Patcher could not find its patches and/or tools!
  160.  
  161. * Did you run ./batch.sh first?
  162.  
  163. The patch_patches.tgz and patch_tools.tgz need to be in this directory,
  164.   one way or another...
  165.  
  166.     usage:     ./auto_patcher <ROM> <MODS> <ROMTYPE>
  167.     example:   ./auto_patcher CM10.zip  cm
  168.  
  169. Use ./auto_patcher -h for the help menu
  170.  
  171. mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement