Created
September 10, 2016 13:18
-
-
Save rebebop/42f0219d73abcd65e598c322d1cc4195 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
set -e | |
if [ -z $1 ]; then | |
echo "You need to provide a version number." | |
echo "Exiting..." | |
exit | |
else | |
GHOST_VERSION=$1 | |
fi | |
GHOST_DIR=/var/www/ghost | |
DOWNLOAD_DIR=/var/www | |
cd ${DOWNLOAD_DIR} | |
echo "Downloading ghost..." | |
wget https://ghost.org/zip/ghost-${GHOST_VERSION}.zip | |
echo "Done." | |
echo "Installing new version..." | |
unzip ghost-${GHOST_VERSION}.zip -d ghost-temp | |
cd ghost/ | |
rm -rf core/ | |
cd ${DOWNLOAD_DIR}/ghost-temp | |
cp -R core ${GHOST_DIR} | |
cp index.js ${GHOST_DIR} | |
cp *.json ${GHOST_DIR} | |
cd ${GHOST_DIR} | |
chown -R ghost:ghost * | |
npm install --production | |
echo "Done." | |
echo "Restarting ghost..." | |
systemctl restart ghost | |
echo "Cleaning..." | |
cd ${DOWNLOAD_DIR} | |
rm ghost-${GHOST_VERSION}.zip | |
rm -R ghost-temp | |
echo "All done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment