Last active
August 29, 2015 14:08
-
-
Save mkrogh/87d4438c44ed70e70416 to your computer and use it in GitHub Desktop.
Simple upgrate script for vanilla forums (2.1)
This file contains hidden or 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 | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: sudo $(basename $0) /path/to/updated_vanilla_git/ /path/to/current_vanilla_installation/" | |
exit 1 | |
fi | |
new_vanilla=$1 | |
install_dir=${2:=/var/www/vanilla/} | |
tmp=/tmp | |
branch=2.1 | |
http_group=www-data | |
url=http://yourpage.net/index.php?p=/utility/update | |
function today() { | |
date +"%Y-%m-%d" | |
} | |
function timestamp() { | |
date +"%H:%M:%S" | |
} | |
########## | |
# DO stuff | |
echo "Backing up old vanilla installation to: $tmp - started: $(timestamp)" | |
cd $install_dir | |
cp conf/config.php $tmp/ | |
cp conf/locale.php $tmp/ | |
cd .. | |
tar cfz $tmp/vanilla-$(today).tgz $(basename $install_dir) | |
#copy new files | |
echo "Copying new installation from $new_vanilla - $(timestamp)" | |
cd $new_vanilla | |
git archive $branch | tar x -C $install_dir | |
echo "Restoring config - $(timestamp)" | |
cd $install_dir | |
cp $tmp/config.php conf/ | |
cp $tmp/locale.php conf/ | |
#fix permissions | |
echo "Fixing permissions" | |
cd $install_dir | |
sudo chmod -R g+w cache/ | |
sudo chgrp -R $http_group cache/ | |
sudo chmod -R g+w conf/ | |
sudo chgrp -R $http_group conf/ | |
sudo chmod -R g+w uploads/ | |
sudo chgrp -R $http_group uploads/ | |
echo "Finished upgrading - $(timestamp)" | |
echo "If everything works, you should delete the vanilla-date.tgz and config.php file from $tmp" | |
echo "Go check $url" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment