This repository has been archived by the owner on Jul 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ghoster.sh
executable file
·96 lines (81 loc) · 2.67 KB
/
ghoster.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env fish
#
# # Ghoster - Ghost upgrade script
#
# ## Config
set -l GHOST_INSTALL_PATH "/var/www/ghost/"
if test (count $argv) -lt 1
echo ""
echo "Ghoster command required. See the following command for help"
echo "./ghoster help"
echo ""
else
switch $argv[1]
case "help"
echo ""
echo "Commands:"
echo ""
echo "install <version> # Install a Ghost version"
echo ""
echo "Example of Ghost install command:"
echo ""
echo "./ghoster.sh install <version>"
echo ""
exit 0
case "install"
echo ""
if test $argv[2] = "latest"
echo "Step 1: getting the latest Ghost version"
and curl -LOk https://ghost.org/zip/ghost-latest.zip
and mv ghost-latest.zip /tmp/ghost-temp.zip
else
echo "Step 1: getting Ghost version $argv[2]"
and curl -LOk https://github.com/TryGhost/Ghost/archive/$argv[2].zip
and mv $argv[2].zip /tmp/ghost-temp.zip
end
and echo ""
and echo "Step 2: unziping to a temporary location"
and unzip /tmp/ghost-temp.zip -d /tmp/ghost-temp
and rm /tmp/ghost-temp.zip
and echo ""
and echo "Step 3: changing directory into your current ghost install"
and cd $GHOST_INSTALL_PATH
and echo ""
and echo "Step 4: removing the core directory completely"
and rm -rf core
and echo ""
and echo "Step 5: changing back to your download of Ghost latest"
and cd /tmp/ghost-temp
and echo ""
and echo "Step 6: copying the new core directory to your Ghost install"
and cp -R core $GHOST_INSTALL_PATH
and echo ""
and echo "Step 7: copying the other key files to your Ghost install directory"
and cp index.js $GHOST_INSTALL_PATH
and cp *.json $GHOST_INSTALL_PATH
and echo ""
and echo "Step 8: changing back to your ghost install directory"
and cd $GHOST_INSTALL_PATH
and echo ""
and echo "Step 9: updating permissions"
and chown -R ghost:ghost *
and echo ""
and echo "Step 10: upgrading dependencies"
and rm -rf node_modules
and npm cache clean
and npm install --production
and echo ""
and echo "Step 11: restarting Ghost!"
and service ghost restart
and rm -rf /tmp/ghost-temp
and echo ""
and echo "Step 12: Ghost upgrade finished!"
and echo ""
or begin
set -l err $status
echo "Ghost upgrade encountered an error. Exit status: $err."
exit $err
end
exit 0
end
end