From 3d09a54ac352464b37243150e6a264f22473664d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 29 Sep 2023 16:36:47 +0200 Subject: [PATCH] cleaning --- manifest.toml | 2 +- scripts/backup | 15 --------------- scripts/change_url | 4 ++-- scripts/install | 15 +++++---------- scripts/remove | 4 ---- scripts/restore | 10 ++-------- scripts/upgrade | 22 +++------------------- 7 files changed, 13 insertions(+), 59 deletions(-) diff --git a/manifest.toml b/manifest.toml index 2ebbca4..156b3c6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -18,7 +18,7 @@ cpe = "cpe:2.3:a:pydio:cells" fund = "https://pydio.com/en/pricing" [integration] -yunohost = ">= 11.1.21" +yunohost = ">= 11.2" architectures = ["amd64", "armhf", "arm64"] multi_instance = true ldap = false diff --git a/scripts/backup b/scripts/backup index ebf2cf1..4606e12 100755 --- a/scripts/backup +++ b/scripts/backup @@ -34,21 +34,6 @@ ynh_backup --src_path="$data_dir" --is_big ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP FAIL2BAN CONFIGURATION -#================================================= - -# ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" -# ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" - -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - -# ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/change_url b/scripts/change_url index ae914ad..3a9b28d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF @@ -32,7 +32,7 @@ ynh_change_url_nginx_config #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index d92e899..8c94655 100755 --- a/scripts/install +++ b/scripts/install @@ -29,25 +29,20 @@ ynh_add_nginx_config ynh_add_systemd_config -yunohost service add "$app" --description="Pydio - A file sharing platform" --log="/var/log/$app/$app.log" - -# ynh_use_logrotate - -# Create a dedicated Fail2Ban config -# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" +yunohost service add "$app" --description="File sharing platform" --log="/var/log/$app/$app.log" #================================================= # APP INITIAL CONFIGURATION #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Configuring Pydio..." --weight=1 +ynh_script_progression --message="Configuring $app..." --weight=1 ynh_add_config --template="install-conf.yml" --destination="$install_dir/install-conf.yml" -pushd "$install_dir" || ynh_die +pushd "$install_dir" ynh_exec_as "$app" ./cells configure --cli --yaml "$install_dir/install-conf.yml" -popd || ynh_die +popd ynh_secure_remove --file="$install_dir/install-conf.yml" ynh_delete_file_checksum --file="$install_dir/install-conf.yml" @@ -59,7 +54,7 @@ ynh_delete_file_checksum --file="$install_dir/install-conf.yml" #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 8686684..46cdd26 100755 --- a/scripts/remove +++ b/scripts/remove @@ -25,10 +25,6 @@ ynh_remove_systemd_config ynh_remove_nginx_config -# ynh_remove_logrotate - -# ynh_remove_fail2ban_config - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 105e37c..f3625de 100755 --- a/scripts/restore +++ b/scripts/restore @@ -46,13 +46,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable "$app.service" --quiet -yunohost service add "$app" --description="Pydio - A file sharing platform" --log="/var/log/$app/$app.log" - -# ynh_restore_file --origin_path="/etc/logrotate.d/$app" - -# ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" -# ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" -# ynh_systemd_action --action=restart --service_name=fail2ban +yunohost service add "$app" --description="File sharing platform" --log="/var/log/$app/$app.log" #================================================= # GENERIC FINALIZATION @@ -61,7 +55,7 @@ yunohost service add "$app" --description="Pydio - A file sharing platform" --lo #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index ccf013c..a809b5c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,7 +23,7 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= # "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) @@ -49,30 +49,14 @@ ynh_add_nginx_config ynh_add_systemd_config -yunohost service add "$app" --description="Pydio - A file sharing platform" --log="/var/log/$app/$app.log" - -# ynh_use_logrotate --non-append - -# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" - -#================================================= -# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) -#================================================= -# UPDATE A CONFIG FILE -#================================================= -#ynh_script_progression --message="Updating a configuration file..." --weight=1 - -#ynh_add_config --template="some_config_file" --destination="$install_dir/some_config_file" - -#chmod 400 "$install_dir/some_config_file" -#chown $app:$app "$install_dir/some_config_file" +yunohost service add "$app" --description="File sharing platform" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT