Created
July 18, 2016 12:02
-
-
Save evdenis/25fe0a5ad8721ce877beb38665acfdb0 to your computer and use it in GitHub Desktop.
Upgrade script for Ghost blogging platform
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/bash -x | |
# Остановить скрипт, если любая команда завершится с ошибкой | |
set -e | |
# -- BEGIN CONFIGURATION -- | |
## Директория, где располагаются файлы Ghost | |
ghost_dir='/var/www/ghost' | |
## Директория, куда загрузить обновлённую версию | |
download_dir="$(mktemp -d)" | |
## Пользователь и группа файлов Ghost | |
ghost_user='ghost' | |
ghost_group="$ghost_user" | |
## Обновить стандартную тему Casper? yes|no | |
upgrade_default_theme='yes' | |
# -- END CONFIGURATION -- | |
systemctl stop ghost | |
cd "$download_dir" | |
curl -LOk https://ghost.org/zip/ghost-latest.zip | |
unzip ghost-latest.zip | |
cd "$ghost_dir" | |
rm -fr ./core | |
rm -f index.js *.md *.json | |
mv "$download_dir"/core . | |
mv -f "$download_dir"/{index.js,package.json,npm-shrinkwrap.json} . | |
mv -f "$download_dir"/*.md . | |
if [[ $upgrade_default_theme == "yes" ]] | |
then | |
rm -fr content/themes/casper | |
cp -R "$download_dir"/content/themes/casper ./content/themes | |
fi | |
rm -fr "$download_dir" | |
chown -R "$ghost_user:$ghost_group" ./* | |
# В случае проблем: | |
# rm -fr ./node_modules; npm cache clean; | |
npm install --production | |
systemctl start ghost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment