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 f67a0d8d85 fix
2024-06-24 14:41:58 +02:00

58 lines
1.8 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 $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 $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..."
ynh_config_add_nginx
ynh_nodejs_install
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"