Skip to content

Commit 422bb0a

Browse files
committed
Refactor: Ghost
1 parent b9ec651 commit 422bb0a

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

ct/ghost.sh

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,27 @@ color
2020
catch_errors
2121

2222
function update_script() {
23-
header_info
24-
check_container_storage
25-
check_container_resources
26-
msg_info "Updating ${APP} LXC"
23+
header_info
24+
check_container_storage
25+
check_container_resources
2726

28-
if command -v ghost &>/dev/null; then
29-
current_version=$(ghost version | grep 'Ghost-CLI version' | awk '{print $3}')
30-
latest_version=$(npm show ghost-cli version)
31-
if [ "$current_version" != "$latest_version" ]; then
32-
msg_info "Updating ${APP} from version v${current_version} to v${latest_version}"
33-
$STD npm install -g ghost-cli@latest
34-
msg_ok "Updated Successfully"
35-
else
36-
msg_ok "${APP} is already at v${current_version}"
37-
fi
27+
NODE_VERSION="22" setup_nodejs
28+
msg_info "Updating ${APP} LXC"
29+
if command -v ghost &>/dev/null; then
30+
current_version=$(ghost version | grep 'Ghost-CLI version' | awk '{print $3}')
31+
latest_version=$(npm show ghost-cli version)
32+
if [ "$current_version" != "$latest_version" ]; then
33+
msg_info "Updating ${APP} from version v${current_version} to v${latest_version}"
34+
$STD npm install -g ghost-cli@latest
35+
msg_ok "Updated Successfully"
3836
else
39-
msg_error "No ${APP} Installation Found!"
40-
exit
37+
msg_ok "${APP} is already at v${current_version}"
4138
fi
39+
else
40+
msg_error "No ${APP} Installation Found!"
4241
exit
42+
fi
43+
exit
4344
}
4445

4546
start
@@ -49,4 +50,4 @@ description
4950
msg_ok "Completed Successfully!\n"
5051
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
5152
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
52-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:2368${CL}"
53+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:2368${CL}"

install/ghost-install.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@ $STD apt-get install -y \
1919
ca-certificates
2020
msg_ok "Installed Dependencies"
2121

22-
setup_mariadb
22+
setup_mysql
2323

2424
msg_info "Configuring Database"
2525
DB_NAME=ghost
2626
DB_USER=ghostuser
2727
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
28-
$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;"
29-
$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
30-
$STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
31-
28+
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
29+
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
30+
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
3231
{
3332
echo "Ghost-Credentials"
3433
echo "Ghost Database User: $DB_USER"
@@ -37,7 +36,7 @@ $STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUS
3736
} >>~/ghost.creds
3837
msg_ok "Configured MySQL"
3938

40-
NODE_VERSION="20" setup_nodejs
39+
NODE_VERSION="22" setup_nodejs
4140

4241
msg_info "Installing Ghost CLI"
4342
$STD npm install ghost-cli@latest -g

0 commit comments

Comments
 (0)