File: 0.02.36a/vm-upgrade.sh (View as HTML)

  1: #!/bin/bash
  2: # FreeNATS vm-upgade.sh : VM Specific Upgrader
  3: # Copyright 2008 PurplePixie Systems, All Rights Reserved
  4: # Part of the FreeNATS Package released under the GNU GPL v3
  5: # See http://www.purplepixie.org/freenats for more information
  6: #
  7: 
  8: if [ "$1" == "dummy" ]; then
  9:  VM_DUMMY="1"
 10: else
 11:  VM_DUMMY="0"
 12: fi
 13: 
 14: echo "Upgrading Virtual Machine..."
 15: if [ "$VM_DUMMY" == "1" ]; then
 16:  echo "-- Dummy Run --"
 17: fi
 18: echo
 19: if [ ! -f "shell-install.sh" ]; then
 20:  echo "shell-install.sh not found - must be in the same directory"
 21:  echo "and have the same working directory!"
 22:  echo
 23:  exit 0
 24: fi
 25: 
 26: FN_WEB="/srv/www/html/"
 27: export FN_WEB
 28: 
 29: echo
 30: echo "**************** FreeNATS Virtual Appliance Upgrade ****************"
 31: echo
 32: echo "The upgrade process will now call the file upgrade script with values"
 33: echo "pre-set for the FreeNATS rPath Virtual Appliance. You to just select"
 34: echo "upgrade (press return) and accept the default directory locations"
 35: echo "(by pressing return)."
 36: echo 
 37: echo
 38: echo -n "Proceed with upgrade (y/N): "
 39: read proccheck
 40: if [ "$proccheck" != "y" ]; then
 41:  echo
 42:  echo "Upgrade Aborted at User Request"
 43:  echo
 44:  FN_WEB=""
 45:  export FN_WEB
 46:  exit 0
 47: fi
 48: echo
 49: echo "**************** FreeNATS Virtual Appliance Upgrade ****************"
 50: echo
 51: echo "Proceeding with upgrade..."
 52: echo
 53:  
 54:  
 55: if [ "$VM_DUMMY" == "1" ]; then
 56:  ./shell-install.sh dummy
 57: else
 58:  ./shell-install.sh
 59: fi
 60: 
 61: FN_WEB=""
 62: export FN_WEB
 63: 
 64: echo
 65: echo "**************** FreeNATS Virtual Appliance Upgrade ****************"
 66: echo
 67: echo "File structure update completed."
 68: echo
 69: 
 70: echo "You must now optionally upgrade the database schema (recommended). To"
 71: echo "do this please:"
 72: echo
 73: echo "Go to your FreeNATS web folder (where the web system is installed) and"
 74: echo "rename the firstrun-.php file to firstrun.php"
 75: echo
 76: echo "Browse to http://YOUR.FREENATS/firstrun.php and follow the instructions"
 77: echo
 78: echo "MAKE SURE YOU RENAME firstrun.php BACK TO firstrun-.php AFTERWARDS!!"
 79: echo
 80: echo "Update script complete."
 81: 
 82: exit 0
 83: # Ignored below - NYI - not here yet
 84: 
 85: echo "You must now decide whether to update the database schema (recommended)"
 86: echo "and how to do this."
 87: echo
 88: echo -n "Update database schema [Y/n]: "
 89: read updatesch
 90: if [ "$updatesch" == "n" ]; then
 91:  echo "You have chosen not to update the schema. Please be aware this can"
 92:  echo "cause adverse affects and failures."
 93:  echo
 94:  exit 0
 95: fi
 96: echo
 97: echo "Please select the update method - fresh (recommended) will wipe all"
 98: echo "existing data from the FreeNATS system. Alternatively you can try"
 99: echo "the update method (experimental) to upgrade the schema with the data"
100: echo "kept intact."
101: echo
102: 
103: UDMETH=0
104: while [ "$UDMETH" == 0 ]; do
105:  echo -n "Update Method [Fresh/Upgrade]: "
106:  read udinp
107:  if [ "$udinp" == "f" ]; then
108:   UDMETH=1
109:  elif [ "$udinp" == "u" ]; then
110:   UDMETH=1
111:  else
112:   echo "Please enter f for fresh or u for upgrade (Control-C to abort)"
113:   echo
114:  fi
115: done
116: 
117: