Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DmitryMiroshnichenko/8696d0ad2e7a736ab9bfad79a1bc16bb to your computer and use it in GitHub Desktop.
Save DmitryMiroshnichenko/8696d0ad2e7a736ab9bfad79a1bc16bb 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