#!/bin/bash # Exit on command errors and treat unset variables as an error set -eu if [ ! -e _common ]; then # Get file fonction if not been to the current directory sudo cp ../settings/scripts/_common ./_common sudo chmod a+rx _common fi # Source app helpers source ./_common source /usr/share/yunohost/helpers app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) is_public=$(ynh_app_setting_get $app is_public) ynh_backup_before_upgrade # Backup the current version of the app ynh_clean_setup () { ynh_backup_fail_upgrade # restore it if the upgrade fails } ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée. CHECK_PATH # Checks and corrects the syntax of the path. # Create system user dedicace for this app ynh_system_user_create $app # Init final_path, if ever it got deleted somehow final_path=/var/www/$app # Clean all files and directory except the data directory ynh_secure_remove $final_path # Create directory sudo mkdir -p $final_path # Copy files to the right place extract_source $final_path # Fix owner sudo chown -R $app: $final_path # Modify Nginx configuration file and copy it to Nginx conf directory ynh_nginx_config # Create the php-fpm pool config ynh_fpm_config # Set ssowat config if [ "$is_public" = "Yes" ]; then ynh_app_setting_set $app is_public 1 # Fixe is_public en booléen is_public=1 elif [ "$is_public" = "No" ]; then ynh_app_setting_set $app is_public 0 is_public=0 fi # Reload Nginx sudo systemctl reload nginx sudo yunohost app ssowatconf