Skip to content

Instantly share code, notes, and snippets.

@mseri
Last active December 25, 2015 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mseri/7059958 to your computer and use it in GitHub Desktop.
Save mseri/7059958 to your computer and use it in GitHub Desktop.
A small bash script to update ghost. It assumes that your ghost blog is installed in a subfolder called ghost and you are running it from the parent folder. Moreover it assumes that you use forever to manage your ghost server and that you run it from a script called starter.sh
#!/bin/bash
if [[ -z $GHOSTUPDATEFILE ]];
then
export GHOSTUPDATEFILE='ghost-0.4.0.zip'
fi
if [[ -z $GHOSTUPDATELOCATION ]];
then
export GHOSTUPDATELOCATION='update-ghost'
fi
if [[ -z $GHOSTINSTALLDIR ]];
then
export GHOSTINSTALLDIR=`pwd`'/ghost'
fi
export STARTLOCATION=`pwd`
wget https://ghost.org/zip/$(echo $GHOSTUPDATEFILE)
unzip $GHOSTUPDATEFILE -d $GHOSTUPDATELOCATION
echo "Ghost downloaded and unzipped"
cd $GHOSTUPDATELOCATION
cp *.md *.js *.txt *.json $GHOSTINSTALLDIR
rm -rf $GHOSTINSTALLDIR/core
cp -R core $GHOSTINSTALLDIR
rm -rf $GHOSTINSTALLDIR/content/themes/casper
cp -R content/themes/casper $GHOSTINSTALLDIR/content/themes
echo "Ghost has been updated with" $GHOST
cd $GHOSTINSTALLDIR
npm install --production
echo "NPM updated"
cd $STARTLOCATION
rm -rf $GHOSTUPDATELOCATION $GHOSTUPDATEFILE
echo "Folder cleaned"
echo "Restarting ghost..."
forever stop 0
sh $GHOSTINSTALLDIR/starter.sh
echo "Done!"
@mseri
Copy link
Author

mseri commented Oct 21, 2013

Copyright (C) 2013 Marcello Seri - Released under the MIT Lincense.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment