1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nodebb_ynh.git synced 2024-09-03 19:46:29 +02:00
nodebb_ynh/scripts/upgrade
Éric Gaspar f3dfd81099 cleaning
2024-06-24 14:16:00 +02:00

63 lines
1.9 KiB
Bash

#!/bin/bash
#https://docs.nodebb.org/configuring/upgrade/
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service=$app --action="stop" --log_path="systemd"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
pushd $install_dir
# Shut down your forum
git config --system --add safe.directory $install_dir
ynh_exec_as_app node_load_PATH" $install_dir/nodebb stop
# Grab the latest and greatest code
git fetch # Grab the latest code from the NodeBB Repository
git reset --hard origin/$nodebb_version # Replace v1.12.x with the branch name!
# Run the NodeBB upgrade script
ynh_exec_as_app node_load_PATH $install_dir/nodebb upgrade 2>/dev/null
popd
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression "Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_config_add_nginx
# Install Nodejs
ynh_nodejs_install
# Create a dedicated systemd config
ynh_config_add_systemd
yunohost service add $app --description="Forum software" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service=$app --action="start" --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"