diff --git a/scripts/change_url b/scripts/change_url index 8b90e29..0dfd5f0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -25,7 +25,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -85,7 +85,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_print_info --message="Updating nginx web server configuration..." +ynh_script_progression --message="Updating nginx web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -116,7 +116,7 @@ fi #================================================= # SETUP LSTU #================================================= -ynh_print_info --message="Updating lstu configuration..." +ynh_script_progression --message="Updating lstu configuration..." domain="$new_domain" path_url="$new_path" @@ -153,7 +153,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" -- #================================================= # UPDATE SSOWAT #================================================= -ynh_print_info --message="Reconfigure SSOwat" +ynh_script_progression --message="Reconfigure SSOwat" if [ $is_public -eq 0 ] then @@ -170,7 +170,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -178,4 +178,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Change of URL completed for $app" +ynh_script_progression --message="Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index cf6325f..5fd1153 100644 --- a/scripts/install +++ b/scripts/install @@ -38,7 +38,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info --message="Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -54,7 +54,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info --message="Storing installation settings..." +ynh_script_progression --message="Configuring firewall..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -68,7 +68,7 @@ ynh_app_setting_set --app=$app --key=hashed_password --value=$hashed_password #================================================= # FIND AND OPEN A PORT #================================================= -ynh_print_info --message="Configuring firewall..." +ynh_script_progression --message="Storing installation settings..." # Find an available port port=$(ynh_find_port --port=8095) @@ -84,9 +84,7 @@ ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_print_info --message="Installing dependencies..." - -ynh_install_app_dependencies $pkg_dependencies +ynh_script_progression --message="Installing dependencies..." # Install Carton echo yes | cpanm Carton @@ -94,7 +92,7 @@ echo yes | cpanm Carton #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Creating a PostgreSQL database..." +ynh_script_progression --message="Creating a PostgreSQL database..." # Create postgresql database ynh_psql_test_if_first_run @@ -107,7 +105,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) # Password created in ynh #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info --message="Setting up source files..." +ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src @@ -116,7 +114,7 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring nginx web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -124,7 +122,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Configuring system user..." +ynh_script_progression --message="Configuring system user..." # Create a system user ynh_system_user_create --username=$app @@ -132,7 +130,7 @@ ynh_system_user_create --username=$app #================================================= # Copy and fix variable into lstu config #================================================= -ynh_print_info --message="Configuring lstu..." +ynh_script_progression --message="Configuring lstu..." config="${final_path}/lstu.conf" cp ../conf/lstu.conf.template "$config" @@ -156,7 +154,7 @@ ynh_store_file_checksum --file="$config" #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Configuring a systemd service..." +ynh_script_progression --message="Configuring a systemd service..." # Create a dedicated systemd config ynh_add_systemd_config @@ -164,7 +162,7 @@ ynh_add_systemd_config #================================================= # BUILD LSTU #================================================= -ynh_print_info --message="Building lstu..." +ynh_script_progression --message="Installing lstu..." pushd $final_path carton install --deployment --without=sqlite --without=mysql @@ -183,7 +181,7 @@ chown -R www-data $final_path #================================================= # SETUP LOGROTATE #================================================= -ynh_print_info --message="Configuring log rotation..." +ynh_script_progression --message="Configuring log rotation..." # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -206,7 +204,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l #================================================= # SETUP SSOWAT #================================================= -ynh_print_info --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring SSOwat..." ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" if [ $is_public -eq 0 ] @@ -224,7 +222,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -232,4 +230,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index e46d36b..63cf3ff 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -39,7 +39,7 @@ fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_print_info --message="Stopping and removing the systemd service..." +ynh_script_progression --message="Stopping and removing the systemd service" # Remove the dedicated systemd config ynh_remove_systemd_config @@ -63,7 +63,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info --message="Removing app main directory..." +ynh_script_progression --message="Removing app main directory" # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -71,7 +71,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config @@ -79,7 +79,7 @@ ynh_remove_nginx_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_print_info --message="Removing logrotate configuration..." +ynh_script_progression --message="Removing logrotate configuration" # Remove the app-specific logrotate config ynh_remove_logrotate @@ -100,7 +100,7 @@ fi #================================================= # REMOVE LOG FILES #================================================= -ynh_print_info --message="Removing log files..." +ynh_script_progression --message="Removing log files..." ynh_secure_remove --file="/var/log/$app.log" @@ -109,7 +109,7 @@ ynh_secure_remove --file="/var/log/$app.log" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info --message="Removing the dedicated system user..." +ynh_script_progression --message="Removing the dedicated system user" # Delete a system user ynh_system_user_delete --username=$app @@ -118,4 +118,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_print_info --message="Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 2b3d8df..6a71188 100644 --- a/scripts/restore +++ b/scripts/restore @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading settings..." +ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -36,7 +36,7 @@ db_user=$db_name #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info --message="Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -55,14 +55,14 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info --message="Restoring the app main directory..." +ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info --message="Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create --username=$app @@ -101,7 +101,7 @@ ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./d #================================================= # RESTORE SYSTEMD #================================================= -ynh_print_info --message="Restoring the systemd configuration..." +ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service @@ -132,7 +132,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -140,4 +140,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Restoration completed for $app" +ynh_script_progression --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 48e0aa7..2c82a36 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -31,7 +31,7 @@ hashed_password=$(ynh_app_setting_get --app=$app --key=hashed_password) #================================================= # CHECK VERSION #================================================= -ynh_print_info --message="Checking version..." +ynh_script_progression --message="Ensuring downward compatibility..." upgrade_type=$(ynh_check_app_version_changed) @@ -92,7 +92,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info --message="Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -128,7 +128,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config @@ -143,7 +143,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create --username=$app @@ -153,7 +153,7 @@ ynh_system_user_create --username=$app #================================================= # UPGRADE LSTU CONFIGURATION #================================================= -ynh_print_info --message="Upgrading lstu configuration..." +ynh_script_progression --message="Upgrading lstu configuration..." config="${final_path}/lstu.conf" ynh_backup_if_checksum_is_different --file="$config" @@ -167,12 +167,14 @@ ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --targ ynh_replace_string --match_string="__SELECTED_THEME__" --replace_string="$theme" --target_file="$config" ynh_replace_string --match_string="__PASSWORD_HASHED__" --replace_string="$hashed_password" --target_file="$config" ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$config" + if [ $is_public -eq 0 ]; then ynh_replace_string --match_string="__IS_PUBLIC__" --replace_string="" --target_file="$config" else ynh_replace_string --match_string="__IS_PUBLIC__" --replace_string="#" --target_file="$config" fi + ynh_store_file_checksum --file="$config" #================================================= @@ -187,7 +189,7 @@ popd #================================================= # SETUP LOGROTATE #================================================= -ynh_print_info --message="Upgrading logrotate configuration..." +ynh_script_progression --message="Upgrading logrotate configuration..." # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append @@ -195,7 +197,7 @@ ynh_use_logrotate --non-append #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Upgrading systemd configuration..." +ynh_script_progression --message="Upgrading systemd configuration..." # Create a dedicated systemd config ynh_add_systemd_config @@ -213,7 +215,7 @@ chown -R www-data $final_path #================================================= # SETUP SSOWAT #================================================= -ynh_print_info --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Upgrading SSOwat configuration..." ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" if [ $is_public -eq 0 ] @@ -238,7 +240,7 @@ ynh_systemd_action --service_name=$app --action=reload --line_match="Reloaded Sh #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -246,4 +248,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed"