Ghost Updater for MySQL (GUM)

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 allaboutghost.com. 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.

#!/bin/bash

DATE=$(date +%d-%m-%Y_%H_%M)
bkdir="/var/www/ghost"
bkdir1="/var/www/ghost/mysql_exports"

if [ -f config.js ]
    then
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
    wget https://ghost.org/zip/ghost-latest.zip
    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."
else
    echo "Please cd to your Ghost directory."

fi