Advertisement
mateorod

file-dependent-auto_updater.diff

Aug 7th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.      echo ""
  2.       printtask "### Update failed ###"
  3.       printtask ""
  4. -     printtask "It appears you may have made some changes to the script that prevent automatic updating."
  5. +     printtask "It appears you may have made some changes that prevent automatic updating."
  6. +     echo ""
  7.       printtask "You could run 'git reset --hard' to return the autopatcher to its original form"
  8.       printtask " or set AUTO_UPDATE to false in the .config file to stop getting this message."
  9.       echo ""
  10. @@ -513,11 +514,12 @@ establish_repo() {
  11.  }
  12.  
  13.  export_log_and_variables () {
  14. -     cp -a "$LOG" .updated.log
  15. -     rm -f "$LOG"
  16.       AUTO_PATCHER_OLD_VERSION=$VERSION
  17.       AUTO_PATCHER_OLD_PATCHES_VERSION=$PATCHES_VERSION
  18.       AUTO_PATCHER_WAS_UPDATED=true
  19. +     UPDATED_LOG="$PATCHES_VERSION".updated.log
  20. +     cp -a "$LOG" "$UPDATED_LOG"
  21. +     rm -f "$LOG"
  22.  }
  23.  
  24.  print_changelog () {
  25. @@ -1215,12 +1217,6 @@ else
  26.       GIT=false
  27.  fi
  28.  
  29. -# If program was updated, merge the logs
  30. -if [[ -n "$AUTO_PATCHER_WAS_UPDATED" ]]; then
  31. -     cat .updated.log >> "$LOG"
  32. -     rm -f .updated.log
  33. -fi
  34. -
  35.  if [[ "$AUTO_UPDATE" == true ]] && [[ "$GIT" == true ]]; then
  36.       PING_CHECK "www.github.com" > /dev/null 2>&1 && NETWORK=true || no_network_access
  37.       if [[ "$NETWORK" == true ]]; then
  38. @@ -1263,13 +1259,20 @@ if [[ "$AUTO_UPDATE" == true ]] && [[ "$GIT" == true ]]; then
  39.       fi
  40.  fi
  41.  
  42. -if [[ -n "$AUTO_PATCHER_WAS_UPDATED" ]]; then
  43. -     if [[ $PATCHES_VERSION -gt $AUTO_PATCHER_OLD_PATCHES_VERSION ]]; then
  44. +if ( [[ -n "$AUTO_PATCHER_WAS_UPDATED" ]] || [ -f *".updated.log" ] ); then
  45. +     ORIGINAL_PATCHES_VERSION=$( ls *.updated.log | sed -e 's/\.updated.log//' )
  46. +     if ( [[ $PATCHES_VERSION -gt $AUTO_PATCHER_OLD_PATCHES_VERSION ]] || [[ $PATCHES_VERSION -gt $ORIGINAL_PATCHES_VERSION ]] ); then
  47.            echo "... integrating new patches ..."
  48.            sh batch.sh >> /dev/null 2>> "$LOG"
  49.       fi
  50.  fi
  51.  
  52. +# If program was updated, merge the logs
  53. +if ( [[ -n "$AUTO_PATCHER_WAS_UPDATED" ]] || [ -f *".updated.log" ] ); then
  54. +     cat *".updated.log" >> "$LOG"
  55. +     rm -f *".updated.log"
  56. +fi
  57. +
  58.  #remove old zips, if built under identical parameters.
  59.  \rm -f $RESTORE.zip $UPDATE.zip
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement