Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$ git diff f42575d58ffa450cd1ab07de69b13fd0d3fbcb7d
- diff --git a/auto_patcher b/auto_patcher
- index e16ca37..e88bac9 100755
- --- a/auto_patcher
- +++ b/auto_patcher
- @@ -903,6 +903,41 @@ echo "Patches are $PID/$ANDR/$RID/$BID" >> "$LOG"
- }
- +prep_patches () {
- +
- + echo "Did not detect patch_tools, preparing"
- + cd "$ROOT/patch_tools"
- + tar cvzf ../patch_tools.tgz *.jar updatecert.pem updatekey.pk8 boot cygwin
- +
- + echo "Did not detect patches, preparing"
- + cd "$ROOT"
- + tar cvzf patch_patches.tgz patches
- + zip autopatcher.zip auto_patcher patch_tools.tgz patch_patches.tgz
- +}
- +
- +# Put the variable config outside of the bash source construct so variables
- +# are accessible when file is source OR directly executed.
- +#ROOT="$(abspath "$(dirname "$(abspath "$(type -p "$0")")")")"
- +if [[ ! "$BASH_SOURCE" == "$0" ]]; then
- + # Script is being sourced, not directly executed, must make
- + ROOT="$(abspath "$(dirname "$(abspath "$(type -p "${BASH_SOURCE[0]}")")")")
- +else
- + # Script is executing directly, $0 builtin acceptable
- + ROOT="$(abspath "$(dirname "$(abspath "$(type -p "$0")")")")"
- +fi
- +TOOL="$ROOT/patch_tools.tgz"
- +PTCH="$ROOT/patch_patches.tgz"
- +DATE=$(date +%Y%m%d%H%M%S)
- +TEMP="$ROOT/tmp$DATE"
- +TMP="$ROOT/tmp$DATE"
- +TMPDIR="$ROOT/tmp$DATE"
- +ROM=$(abspath "$1")
- +ROMX=$(extpath "$1")
- +
- +
- +# Allow wrapper to determine if script is directly excecuted or sourced from
- +# batch.sh bootstrap script.
- +if [[ "$BASH_SOURCE" == "$0" ]]; then
- if [[ $1 == -h ]]; then
- if [ $# -gt 1 ]; then
- PID=$2
- @@ -939,18 +974,8 @@ echo "The Auto-Patcher $VERSION"
- echo ""
- # by pastime1971 and mateorod
- -ROOT="$(abspath "$(dirname "$(abspath "$(type -p "$0")")")")"
- -TOOL="$ROOT/patch_tools.tgz"
- -PTCH="$ROOT/patch_patches.tgz"
- cleanup
- -# set temporaray directory
- -DATE=$(date +%Y%m%d%H%M%S)
- -TEMP="$ROOT/tmp$DATE"
- -TMP="$ROOT/tmp$DATE"
- -TMPDIR="$ROOT/tmp$DATE"
- mkdir "$TEMP"
- -ROM=$(abspath "$1")
- -ROMX=$(extpath "$1")
- if [[ $OSTYPE == "cygwin" ]]; then
- EXE=".exe"
- @@ -979,6 +1004,9 @@ which tar >> "$LOG" || misstools_error "Missing \"tar\" uti
- which jar >> "$LOG" || misstools_error "Missing \"Java Development Kit\" (JDK)"
- which java >> "$LOG" || misstools_error "Missing \"Java Development Kit\" (JDK)
- which cpio >> "$LOG" || misstools_error "Missing \"cpio\" utility"
- +if [[ ! (-f "$TOOL" || -f "$PTCH") ]]; then
- + prep_patches
- +fi
- [ -f "$TOOL" ] || misspatch_error "patch_tool.tgz is missing"
- [ -f "$PTCH" ] || misspatch_error "patch_patches.tgz is missing"
- printtask "### verify ROM ###"
- @@ -1604,3 +1632,6 @@ done
- cd ..
- \rm -rf "$TEMP"
- +
- +# End of bash_source if wrap
- +fi
- diff --git a/batch.sh b/batch.sh
- index c5211e3..b584f7b 100755
- --- a/batch.sh
- +++ b/batch.sh
- @@ -1,48 +1,12 @@
- #!/bin/bash
- -abspath () {
- - case `uname -s` in
- - CYGWIN*)
- - echo $(cygpath -ua "$1") | sed 's:/$::g'
- - ;;
- - Darwin)
- - #[[ $(echo $1 | awk '/^\//') == $1 ]] && echo "$1" || echo "$PWD
- - [[ ${1:0:1} == "/" ]] && echo "$1" || echo "$PWD/$1"
- - ;;
- - Linux)
- - echo $(readlink -f "$1")
- - ;;
- - *)
- - if [[ ${1:0:1} == "/" ]]; then
- - echo "$1"
- - elif [[ ${1:0:2} == "./" ]]; then
- - echo "$PWD/${1:2}"
- - else
- - echo "$PWD/$1"
- - fi
- - ;;
- - esac
- -}
- +AUTOPATCHER=./auto_patcher
- -extpath () {
- - case `uname -s` in
- - CYGWIN*)
- - echo $(cygpath -da "$1")
- - ;;
- - *)
- - echo $(abspath "$1")
- - ;;
- - esac
- -}
- -ROOT=$(abspath `dirname "$0"`)
- -ROM=$(abspath "$1")
- -ROMX=$(extpath "$1")
- +if [ -e "$AUTOPATCHER" ]; then
- + source $AUTOPATCHER
- +else
- + echo "Cannot complete batch operations, cannot find file "$AUTOPATCHER"."
- + exit 1
- +fi
- -
- -cd "$ROOT/patch_tools"
- -tar cvzf ../patch_tools.tgz *.jar updatecert.pem updatekey.pk8 boot cygwin mac
- -cd "$ROOT"
- -
- -tar cvzf patch_patches.tgz patches
- -
- -zip autopatcher.zip auto_patcher patch_tools.tgz patch_patches.tgz
- +prep_patches
- mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$ ls *tgz
- patch_patches.tgz patch_tools.tgz
- mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$ rm patch_tools.tgz
- mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$ ls *tgz
- patch_patches.tgz
- mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$ ./auto_patcher ../../../Of*/Some*
- The Auto-Patcher v2.9.8
- ### verify tools ###
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! error: patch_tool.tgz is missing
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! The Auto-Patcher could not find its patches and/or tools!
- * Did you run ./batch.sh first?
- The patch_patches.tgz and patch_tools.tgz need to be in this directory,
- one way or another...
- usage: ./auto_patcher <ROM> <MODS> <ROMTYPE>
- example: ./auto_patcher CM10.zip cm
- Use ./auto_patcher -h for the help menu
- mateor@mateor-HP-Pavilion-dv6700:~/android/autopatcher/master/new/auto-patcher$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement