From aca238a3084e7e8eed8656905e24f1bbf1612f64 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 24 Oct 2019 20:25:01 +0200 Subject: [PATCH] Apply example_ynh --- conf/config.ini | 2 +- scripts/backup | 3 ++- scripts/install | 6 +++--- scripts/remove | 8 ++++---- scripts/upgrade | 2 ++ 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/conf/config.ini b/conf/config.ini index e65100e..f005993 100644 --- a/conf/config.ini +++ b/conf/config.ini @@ -1,7 +1,7 @@ [server] hidden_host = port = __PORT__ -bind = localhost +bind = 127.0.0.1 tls_cert_path = tls_key_path = templates_parent_dir = diff --git a/scripts/backup b/scripts/backup index a21be75..4340e07 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -44,7 +45,7 @@ ynh_systemd_action --service_name=$app --action="stop" #================================================= ynh_print_info --message="Backing up the main app directory..." -ynh_backup "$final_path" +ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index c82280a..367bbd5 100755 --- a/scripts/install +++ b/scripts/install @@ -57,7 +57,7 @@ final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register $app $domain $path_url +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST @@ -76,7 +76,7 @@ ynh_app_setting_set --app=$app --key=single_user --value=$single_user #================================================= # FIND AND OPEN A PORT #================================================= -ynh_print_info --message="Configuring firewall ..." +ynh_print_info --message="Configuring firewall..." # Find a free port port=$(ynh_find_port --port=8095) @@ -123,7 +123,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Configuring a systemd service ..." +ynh_print_info --message="Configuring a systemd service..." # Create a dedicated systemd config ynh_add_systemd_config diff --git a/scripts/remove b/scripts/remove index c09197b..72e5063 100755 --- a/scripts/remove +++ b/scripts/remove @@ -29,7 +29,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # Remove a service from the admin panel, added by `yunohost service add` -if yunohost service status $app >/dev/null 2>&1 +if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_print_info --message="Removing $app service..." yunohost service remove $app @@ -46,7 +46,7 @@ ynh_remove_systemd_config #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_print_info --message="Removing the MySQL database" +ynh_print_info --message="Removing the MySQL database..." # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name @@ -54,7 +54,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info --message="Removing app main directory" +ynh_print_info --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -62,7 +62,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Removing nginx web server configuration" +ynh_print_info --message="Removing nginx web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config diff --git a/scripts/upgrade b/scripts/upgrade index f486d9a..f8dc3f4 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -99,6 +99,7 @@ ynh_abort_if_errors #================================================= # STOP SYSTEMD SERVICE #================================================= +ynh_print_info --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action=stop @@ -135,6 +136,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # MAKE UPGRADE #================================================= +ynh_print_info --message="Making the upgrade..." chown -R "$app":"$app" "$final_path"