Skip to content

Instantly share code, notes, and snippets.

@Thijzer
Last active June 22, 2018 11:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thijzer/d658b2b94c8ea3e1a569 to your computer and use it in GitHub Desktop.
Save Thijzer/d658b2b94c8ea3e1a569 to your computer and use it in GitHub Desktop.
a simple script for fork CMS clean installing & testing
#!/bin/bash
#
# This script will remove everything and pull in the new version
#
# @version 1.0.0
# @author <thijs@wijs.be>
# mySQL settings
user=$1
password=$2
database=$3
if [ $# -eq 0 ] || [ $# -eq 1 ] || [ $# -eq 2 ]
then
echo "please supply these DB arguments <user> <password> <database>"
exit 1
fi
shopt -s extglob
rm -rf !(.git|clean_install_fork)
echo 'Freddy : fork files removed'
git fetch
git reset --hard origin/master
# composer selfupdate # only root can update a global installed composer
composer install -o
echo 'Freddy : composer ready'
chmod 777 app library src -R # this step is only needed when user www-data has limited permissions
echo 'Freddy : removing database'
mysql --user="$user" --password="$password" --database="$database" --execute="DROP DATABASE $database; CREATE$
echo 'Freddy : ready to install fork'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment