Skip to content

Instantly share code, notes, and snippets.

@Gipetto
Created February 4, 2012 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Gipetto/1733948 to your computer and use it in GitHub Desktop.
Save Gipetto/1733948 to your computer and use it in GitHub Desktop.
Simple OpenVBX Upgrade Script
#! /bin/bash
#
# A script that will upgrade the version of OpenVBX that resides in the /OpenVBX
# directory, back-up the database, copy the current version for backup and replace
# it with the develop branch. The old version is not deleted.
#
# Used for testing, not approved for production!
# Does not take 3rd party plugins in to account.
# customize this for your install
DBHOST=''
DBNM=''
DBUSER=''
DBPASS=''
DBBACKUPDIR='../backups'
# @todo - allow the branch to be passed in
BRANCH="develop"
echo "downloading OpenVBX $BRANCH"
wget --no-check-certificate -O "OpenVBX.zip" "https://github.com/twilio/OpenVBX/zipball/$BRANCH"
echo "backing up database"
BKDT=$(date +%m-%d-%y_%H-%I-%S);
mysqldump -u$DBUSER -p$DBPASS -h $DBHOST $DBNM > "$DBBACKUPDIR/openvbx-$BKDT.sql"
echo "moving current install"
mv "OpenVBX" "OpenVBX.bak"
echo "extracting $BRANCH"
unzip -q "OpenVBX.zip"
echo "moving new OpenVBX in to place"
find . -type d -name "twilio*" -exec mv {} OpenVBX \;
chmod 0755 OpenVBX/audio-uploads
chmod 0755 OpenVBX/OpenVBX/config
echo "copying files from old install to upgrade"
cp OpenVBX.bak/OpenVBX/config/database.php OpenVBX/OpenVBX/config/
cp OpenVBX.bak/OpenVBX/config/openvbx.php OpenVBX/OpenVBX/config/
cp OpenVBX.bak/audio-uploads/* OpenVBX/audio-uploads/*
echo "cleaning up"
rm OpenVBX.zip
echo "upgrade successful. The old install is located in ./OpenVBX.bak"
echo "done"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment