diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index 65cc108..50c6881 100755 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -10,7 +10,7 @@ # automatic actions when a new upstream release is detected. # Remove this exit command when you are ready to run this Action -exit 1 +#exit 1 #================================================= # FETCHING LATEST RELEASE AND ITS ASSETS diff --git a/conf/baikal.yaml b/conf/baikal.yaml index 5916a93..fd35a3d 100644 --- a/conf/baikal.yaml +++ b/conf/baikal.yaml @@ -1,5 +1,5 @@ system: - configured_version: '0.7.1' + configured_version: '0.9.2' timezone: '__TIMEZONE__' card_enabled: true cal_enabled: true diff --git a/scripts/change_url b/scripts/change_url index 6bca7a4..e0a1d95 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -94,7 +94,7 @@ fi #================================================= # UPDATE CONFIGURATION #================================================= -ynh_script_progression --message="Updating $app configuration..." +ynh_script_progression --message="Updating $app configuration..." --weight=2 ynh_backup_if_checksum_is_different --file="${final_path}/config/baikal.yaml" @@ -107,7 +107,7 @@ ynh_store_file_checksum --file="${final_path}/config/baikal.yaml" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index 7e90198..bc95c6f 100644 --- a/scripts/install +++ b/scripts/install @@ -31,7 +31,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -75,7 +75,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating a MySQL database..." +ynh_script_progression --message="Creating a MySQL database..." --weight=2 db_name=$(ynh_sanitize_dbid $app) db_user=$db_name @@ -98,7 +98,7 @@ chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config @@ -106,7 +106,7 @@ ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-FPM..." +ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 # Create a dedicated PHP-FPM config ynh_add_fpm_config @@ -125,6 +125,7 @@ ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \ #================================================= # CONFIGURE BAIKAL #================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 #bk_conf="${final_path}/config/baikal.yaml" path=${path_url%/} @@ -139,7 +140,7 @@ touch "$final_path/Specific/INSTALL_DISABLED" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index c9e3a3f..7da7426 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -26,7 +26,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database" +ynh_script_progression --message="Removing the MySQL database" --weight=1 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name @@ -34,7 +34,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." +ynh_script_progression --message="Removing dependencies..." --weight=3 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -42,7 +42,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory" +ynh_script_progression --message="Removing app main directory" --weight=3 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -50,7 +50,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration" +ynh_script_progression --message="Removing NGINX web server configuration" --weight=1 # Remove the dedicated NGINX config ynh_remove_nginx_config @@ -58,7 +58,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing PHP-FPM configuration" +ynh_script_progression --message="Removing PHP-FPM configuration" --weight=1 # Remove the dedicated PHP-FPM config ynh_remove_fpm_config @@ -68,7 +68,7 @@ ynh_remove_fpm_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user" +ynh_script_progression --message="Removing the dedicated system user" --weight=1 # Delete a system user ynh_system_user_delete --username=$app diff --git a/scripts/restore b/scripts/restore index 668eab0..e87e437 100644 --- a/scripts/restore +++ b/scripts/restore @@ -19,7 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -71,7 +71,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring Baïkal main directory..." +ynh_script_progression --message="Restoring the app main directory..." --weight=3 ynh_restore_file --origin_path="$final_path" @@ -99,7 +99,7 @@ chmod 640 "$final_path/config/baikal.yaml" #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." +ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1 ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" @@ -108,7 +108,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 44c0c69..ce35c1a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,7 +34,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up Baïkal before upgrading (may take a while)..." +ynh_script_progression --message="Backing up Baïkal before upgrading (may take a while)..." --weight=4 # Backup the current version of the app ynh_backup_before_upgrade @@ -48,7 +48,7 @@ ynh_abort_if_errors #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If final_path doesn't exist, create it if [ -z "$final_path" ]; then @@ -62,22 +62,10 @@ if [ -z "$db_name" ]; then ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -if ! ynh_permission_exists --permission="admin"; then - # Create the required permissions - ynh_permission_create --permission="admin" --url="/admin" --allowed="all_users" -fi - #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" @@ -115,7 +103,7 @@ chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config @@ -160,7 +148,9 @@ then deskey=$(ynh_app_setting_get --app=$app --key=encrypt_key) ynh_app_setting_set --app=$app --key=encrypt_key --value="$deskey" - ynh_add_config --template="../conf/baikal.yaml" --destination="$bk_conf" + ynh_add_config --template="../conf/baikal.yaml" --destination="$final_path/config/baikal.yaml" + chown $app: "$final_path/config/baikal.yaml" + chmod 640 "$final_path/config/baikal.yaml" #================================================= # UPGRADE BAIKAL @@ -181,20 +171,10 @@ then # ynh_delete_file_checksum --file="${final_path}/Specific/config.system.php" fi -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions -chown $app: "$final_path/config/baikal.yaml" -chmod 640 "$final_path/config/baikal.yaml" - #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload