diff --git a/scripts/backup b/scripts/backup index 4ae7ff3..a107bf4 100755 --- a/scripts/backup +++ b/scripts/backup @@ -19,7 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -32,21 +32,21 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_print_info "Backing up the main app directory..." +ynh_script_progression --message="Backing up the main app directory..." --weight=30 ynh_backup "$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info "Backing up nginx web server configuration..." +ynh_script_progression --message="Backing up nginx web server configuration..." --weight=1 ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_print_info "Backing up the MySQL database..." +ynh_script_progression --message="Backing up the MySQL database..." --weight=20 ynh_mysql_dump_db "$db_name" > db.sql @@ -56,4 +56,4 @@ ynh_mysql_dump_db "$db_name" > db.sql #================================================= ynh_backup "/etc/systemd/system/$app.service" -ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)" --last \ No newline at end of file diff --git a/scripts/install b/scripts/install index 0943cc0..fa3c8dd 100755 --- a/scripts/install +++ b/scripts/install @@ -32,7 +32,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info "Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -48,7 +48,7 @@ ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info "Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url @@ -70,7 +70,7 @@ ynh_app_setting_set $app port $port #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_print_info "Creating a MySQL database..." +ynh_script_progression --message="Creating a MySQL database..." --weight=20 db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set $app db_name $db_name @@ -79,7 +79,7 @@ ynh_mysql_setup_db $db_name $db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Setting up source files..." +ynh_script_progression --message="Setting up source files..." --weight=6 ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src @@ -88,7 +88,7 @@ ynh_setup_source "$final_path" $architecture #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Configuring nginx web server..." +ynh_script_progression --message="Configuring nginx web server..." --weight=2 # Create a dedicated nginx config ynh_add_nginx_config @@ -96,7 +96,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Configuring system user..." +ynh_script_progression --message="Configuring system user..." --weight=2 # Create a system user ynh_system_user_create $app @@ -112,7 +112,7 @@ ynh_add_systemd_config #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_print_info "Create config file..." +ynh_script_progression --message="Create config file..." --weight=1 cp ../conf/config.yml "$final_path/config.yml" ynh_replace_string "__APP__" $app "$final_path/config.yml" @@ -150,7 +150,7 @@ yunohost service add $app #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Configuring SSOwat..." +ynh_script_progression --message="Configuring SSOwat..." --weight=1 # Make app public if necessary ynh_permission_update --permission "main" --add visitors @@ -158,9 +158,9 @@ ynh_permission_update --permission "main" --add visitors #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." --weight=1 systemctl reload nginx systemctl start $app -ynh_print_info "Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" --last \ No newline at end of file diff --git a/scripts/remove b/scripts/remove index 371964c..ae063a3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -31,7 +31,7 @@ final_path=$(ynh_app_setting_get $app final_path) # Remove a service from the admin panel, added by `yunohost service add` if yunohost service status | grep -q $app then - echo "Remove $app service" + ynh_script_progression --message="Remove $app service" --weight=1 yunohost service remove $app fi @@ -46,7 +46,7 @@ ynh_remove_systemd_config #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_print_info "Removing the MySQL database" +ynh_script_progression --message="Removing the MySQL database..." --weight=10 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db $db_user $db_name @@ -54,7 +54,7 @@ ynh_mysql_remove_db $db_user $db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info "Removing app main directory" +ynh_script_progression --message="Removing app main directory..." --weight=30 # Remove the app directory securely ynh_secure_remove "$final_path" @@ -62,7 +62,7 @@ ynh_secure_remove "$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info "Removing nginx web server configuration" +ynh_script_progression --message="Removing nginx web server configuration..." --weight=5 # Remove the dedicated nginx config ynh_remove_nginx_config @@ -72,9 +72,9 @@ ynh_remove_nginx_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info "Removing the dedicated system user" +ynh_script_progression --message="Removing the dedicated system user..." --weight=5 # Delete a system user ynh_system_user_delete $app -ynh_print_info "Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" --last \ No newline at end of file diff --git a/scripts/restore b/scripts/restore index b1034a0..4b31907 100755 --- a/scripts/restore +++ b/scripts/restore @@ -19,7 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading settings..." +ynh_script_progression --message="Loading settings.." app=$YNH_APP_INSTANCE_NAME @@ -31,7 +31,7 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info "Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters.." --weight=1 ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -43,21 +43,21 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_print_info "Restoring nginx configuration..." +ynh_script_progression --message="Restoring nginx configuration..." --weight=1 ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info "Restoring the app main directory..." +ynh_script_progression --message="Restoring the app main directory.." --weight=1 ynh_restore_file "$final_path" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_print_info "Restoring the MySQL database..." +ynh_script_progression --message="Restoring the MySQL database.." --weight=20 db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_mysql_setup_db $db_name $db_name $db_pwd @@ -66,7 +66,7 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info "Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user.." --weight=1 # Create the dedicated user (if not existing) ynh_system_user_create $app @@ -90,7 +90,7 @@ yunohost service add $app #================================================= # RESTORE SYSTEMD #================================================= -ynh_print_info "Restoring service..." +ynh_script_progression --message="Restoring service..." --weight=10 ynh_restore_file "/etc/systemd/system/$app.service" systemctl enable $app.service @@ -98,8 +98,8 @@ systemctl start $app #================================================= # GENERIC FINALIZATION #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server ..." --weight=1 systemctl reload nginx -ynh_print_info "Restoration completed for $app" +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 11d0893..1f53155 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading settings.." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -29,7 +29,7 @@ password=$(ynh_app_setting_get $app password) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info "Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility.." --weight=1 # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then @@ -55,7 +55,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info "Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=30 # Backup the current version of the app ynh_backup_before_upgrade @@ -78,7 +78,7 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Upgrading source files..." +ynh_script_progression --message="Upgrading source files..." --weight=6 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" $architecture @@ -86,7 +86,7 @@ ynh_setup_source "$final_path" $architecture #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 # Create a dedicated nginx config if [ "$path_url" != "/" ] @@ -99,7 +99,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 # Create a dedicated user (if not existing) ynh_system_user_create $app @@ -151,7 +151,7 @@ chown -R $app: $final_path/data #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Upgrading SSOwat configuration..." +ynh_script_progression --message="Configuring SSOwat..." --weight=1 unprotected_uris=$(ynh_app_setting_get --app=$app --key=unprotected_uris) if [ ! -z "$unprotected_uris" ]; then @@ -163,15 +163,15 @@ ynh_permission_update --permission "main" --add visitors #================================================= # RELOAD SERVICE #================================================= -ynh_print_info "Reloading service..." +ynh_script_progression --message="Reloading service..." --weight=1 systemctl restart $app #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." --weight=1 systemctl reload nginx -ynh_print_info "Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed" --last \ No newline at end of file