Created
February 4, 2012 00:12
-
-
Save Gipetto/1733948 to your computer and use it in GitHub Desktop.
Simple OpenVBX Upgrade Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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