2021-04-06 15:54:50 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#https://docs.nodebb.org/configuring/upgrade/
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2024-06-24 14:16:00 +02:00
|
|
|
ynh_script_progression "Stopping $app's systemd service..."
|
2021-04-06 15:54:50 +02:00
|
|
|
|
2024-06-24 14:16:00 +02:00
|
|
|
ynh_systemctl --service=$app --action="stop" --log_path="systemd"
|
2021-04-06 15:54:50 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2024-06-24 14:16:00 +02:00
|
|
|
ynh_script_progression "Upgrading source files..."
|
2021-04-06 15:54:50 +02:00
|
|
|
|
2024-04-14 18:18:35 +02:00
|
|
|
pushd $install_dir
|
|
|
|
# Shut down your forum
|
|
|
|
git config --system --add safe.directory $install_dir
|
2024-06-24 14:41:58 +02:00
|
|
|
ynh_exec_as_app $install_dir/nodebb stop
|
2024-04-14 18:18:35 +02:00
|
|
|
# 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
|
2024-06-24 14:41:58 +02:00
|
|
|
ynh_exec_as_app $install_dir/nodebb upgrade 2>/dev/null
|
2024-04-14 18:18:35 +02:00
|
|
|
popd
|
2021-04-06 15:54:50 +02:00
|
|
|
|
2023-03-16 22:28:23 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-08-09 16:29:31 +02:00
|
|
|
|
2021-04-06 15:54:50 +02:00
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2024-06-24 14:16:00 +02:00
|
|
|
ynh_script_progression "Upgrading NGINX web server configuration..."
|
2021-04-06 15:54:50 +02:00
|
|
|
|
2024-06-24 14:16:00 +02:00
|
|
|
ynh_config_add_nginx
|
2021-04-06 15:54:50 +02:00
|
|
|
|
2024-06-24 14:16:00 +02:00
|
|
|
ynh_nodejs_install
|
2021-04-06 15:54:50 +02:00
|
|
|
|
2024-06-24 14:16:00 +02:00
|
|
|
ynh_config_add_systemd
|
2021-04-06 15:54:50 +02:00
|
|
|
|
2021-09-01 18:36:40 +02:00
|
|
|
yunohost service add $app --description="Forum software" --log="/var/log/$app/$app.log"
|
2021-04-06 15:54:50 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2024-06-24 14:16:00 +02:00
|
|
|
ynh_script_progression "Starting $app's systemd service..."
|
2021-04-06 15:54:50 +02:00
|
|
|
|
2024-06-24 14:16:00 +02:00
|
|
|
ynh_systemctl --service=$app --action="start" --log_path="systemd"
|
2021-04-06 15:54:50 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2024-06-24 14:16:00 +02:00
|
|
|
ynh_script_progression "Upgrade of $app completed"
|