#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= email=$(ynh_user_get_info --username="$admin" --key=mail) #================================================= # CHECK VERSION #================================================= upgrade_type=$(ynh_check_app_version_changed) #================================================= # STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." # moving the data folder to the standard ynh one if [ -d "/var/lib/$app" ]; then ynh_print_info --message="Moving the data folder from '/var/lib/$app' to '$data_dir'" mv "/var/lib/$app" "$data_dir" fi #================================================= # UPGRADE DEPENDENCIES #================================================= chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config systemctl enable "$app.service" --quiet yunohost service add "$app" --description="Web-based Game Server Management System" --log="/var/log/$app/$app.log" #================================================= # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating a configuration file..." ynh_add_config --template="config.json" --destination="/etc/$app/config.json" chmod 650 "/etc/$app/config.json" chown "$app:$app" "/etc/$app/config.json" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Listening for" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed"