-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall
More file actions
executable file
·44 lines (34 loc) · 1.6 KB
/
install
File metadata and controls
executable file
·44 lines (34 loc) · 1.6 KB
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
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
############################################
# Install Ghost
############################################
dir=$PWD
export NVM_DIR=/opt/nvm && source /opt/nvm/nvm.sh
nvm use v20
# Create the 'ghost' user if it doesn't already exist
if ! id -u ghost > /dev/null 2>&1; then
useradd --system --create-home --shell /usr/sbin/nologin ghost
fi
# Install Ghost CLI globally if not already installed
if [[ ! $(which ghost) ]]; then
npm install ghost-cli@latest -g
fi
# Set up the Ghost installation directory
if [ ! -d "/opt/ghost/versions" ]; then
mkdir -p /opt/ghost
chown -R ghost:ghost /opt/ghost
chmod -R 755 /opt/ghost # Ensure directories are readable and executable by others
# Run the Ghost installation as the 'ghost' user
su -s /bin/bash ghost -c "export NVM_DIR=/opt/nvm && source /opt/nvm/nvm.sh && nvm use v20 && ghost install --dir /opt/ghost --no-prompt --no-setup --no-start --no-enable --no-checkmem --auto"
# Set permissions for files: rw for owner, r for group/others, preserve executable
find /opt/ghost -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \) -exec chmod u=rw,go=r,a+x {} \; \
-o -exec chmod u=rw,go=r {} \;
# Set permissions for directories: rwx for owner, rx for group/others
find /opt/ghost -type d -exec chmod 755 {} \;
fi
# Copy over our Quick Install App
cd "$dir" || exit
rsync -r ./Installers/ /usr/local/hestia/web/src/app/WebApp/Installers/
# Notify installation has finished
/usr/local/hestia/bin/v-add-user-notification admin "Ghost" "👻 Ghost plugin has finished installing."