forked from dictvm/shellscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-ghost.sh
executable file
·63 lines (49 loc) · 1.91 KB
/
update-ghost.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# basic script to update the Ghost blog-software to a given version
# only works on Uberspace-systems. Depends on strictly following
# the documentation of the Uberspace-wiki: http://goo.gl/eW5TlR
# set the current ghost-version here
VERSION='0.11.3'
# set the ghost installation directory
GHOSTDIR=~/ghost
# let's save the current CentOS-version
RHEL='cat /etc/redhat-release | cut -d" " -f3 | cut -d "." -f1"'
for DIR in $GHOSTDIR ; do
if [ -d DIR ] ; then
echo "you do not seem to have ghost-directory in your ~/."
echo "please make sure you have followed the documentation."
echo "if you are unsure, check the wiki: http://goo.gl/eW5TlR"
exit 1
fi
done
# let's make sure we're in the user's home directory
cd /home/$USER/
echo "stopping your current ghost-service to perform upgrade..."
svc -d ~/service/ghost/
# let's backup the current ghost-directory
cp -r $GHOSTDIR $GHOSTDIR-$(date +%T-%F)
echo "your ghost-directory has been backed up.";
export TMPDIR=`mktemp -d /tmp/XXXXXX`
curl -L "https://github.com/TryGhost/Ghost/releases/download/${VERSION}/Ghost-${VERSION}.zip" -O
unzip ghost-$VERSION.zip -d ghost-$VERSION
rm -rf $GHOSTDIR/core
mv ~/ghost-$VERSION/core $GHOSTDIR/core
rm -rf $GHOSTDIR/content/themes/casper/
echo "updated default-theme casper. Check your custom theme for compatibility."
mv ~/ghost-$VERSION/content/themes/casper $GHOSTDIR/content/themes/
cd ~/ghost-$VERSION/
cp *.js *.json *.md LICENSE $GHOSTDIR
echo "entering ~/ghost-directory to perform final steps."
cd $GHOSTDIR
# if RHEL is not 6 assume it's 5. Do not use this on RHEL7 beta.
if [ "$RHEL" == 6 ];
then
npm install --production
else
npm install --python="/usr/local/bin/python2.7" --production
fi
echo "starting your ghost-service."
echo "Check for errors by executing 'tail -F ~/service/ghost/log/main/current'"
svc -u ~/service/ghost/
echo "cleaning up..."
rm -rf ~/ghost-$VERSION*