As of December 2016 this updater is not maintained and is here for historical prurposes only.

Ghost MySQL

Ghost Update for MySQL or GUM for short is a script I wrote inspired by I noticed there was a gap in that there were no updater scripts for those that use the MySQL database. Here is a script I cobbled together from a number of different sources. I plan to improve this so its more useable going forward.


DATE=$(date +%d-%m-%Y_%H_%M)

if [ -f config.js ]
cp -R /var/www/ghost/app/ /var/www/ghost/gupdgrade-bk-$DATE
    echo `whoami`
    # Make temporary directory and download latest Ghost.
    mkdir temp
    cd temp
    unzip *.zip
    cd ..

    # Make database backups.

mysqldump -u<username> -p<password> --databases ghost --lock-tables=false --no-create-db > $bkdir1/ghostdb-$DATE.sql

    # Copy the new files over.
    yes | cp -R temp/*.md 
    yes | cp -R temp/*.js 
    yes | cp -R temp/*.json .
    rm -R core
    yes | cp -R temp/core .
    yes | cp -R temp/content/themes/casper content/themes
    npm install --production

    # Delete temp folder.
    rm -R temp
  echo "You can now start Ghost with npm, forever or whatever else you use."
    echo "Please cd to your Ghost directory."