-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathstart.bash
43 lines (35 loc) · 880 Bytes
/
start.bash
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
#!/bin/bash
GHOST="/ghost"
OVERRIDE="/ghost-override"
CONFIG="config.js"
DATA="content/data"
IMAGES="content/images"
THEMES="content/themes"
cd "$GHOST"
# Symlink data directory.
mkdir -p "$OVERRIDE/$DATA"
rm -fr "$DATA"
ln -s "$OVERRIDE/$DATA" "content"
# Symlink images directory
mkdir -p "$OVERRIDE/$IMAGES"
rm -fr "$IMAGES"
ln -s "$OVERRIDE/$IMAGES" "$IMAGES"
# Symlink config file.
if [[ -f "$OVERRIDE/$CONFIG" ]]; then
rm -f "$CONFIG"
ln -s "$OVERRIDE/$CONFIG" "$CONFIG"
fi
# Symlink themes.
if [[ -d "$OVERRIDE/$THEMES" ]]; then
for theme in $(find "$OVERRIDE/$THEMES" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)
do
rm -fr "$THEMES/$theme"
ln -s "$OVERRIDE/$THEMES/$theme" "$THEMES/$theme"
done
fi
# Start Ghost
chown -R ghost:ghost /data /ghost /ghost-override
su ghost << EOF
cd "$GHOST"
NODE_ENV=${NODE_ENV:-production} npm start
EOF