From a659b91efe95821833514fc1ea8268d073624485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 31 Aug 2024 22:34:54 +0200 Subject: [PATCH] cleaning --- manifest.toml | 2 +- scripts/backup | 1 - scripts/change_url | 1 - scripts/install | 14 +++----------- scripts/remove | 4 ---- scripts/restore | 4 +--- scripts/upgrade | 18 +++--------------- 7 files changed, 8 insertions(+), 36 deletions(-) diff --git a/manifest.toml b/manifest.toml index 253ef34..aa7dbb7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -20,7 +20,7 @@ code = "https://framagit.org/framasoft/peertube/search-index" fund = "https://framasoft.org/fr/#support" [integration] -yunohost = ">= 11.2.18" +yunohost = ">= 11.2.29" helpers_version = "2.1" architectures = "all" multi_instance = true diff --git a/scripts/backup b/scripts/backup index 62f35ef..142b7d0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,6 +1,5 @@ #!/bin/bash -# 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 diff --git a/scripts/change_url b/scripts/change_url index 9a952a3..df51e24 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -22,7 +22,6 @@ ynh_config_change_url_nginx #================================================= ynh_script_progression "Starting $app's systemd service..." -# Start a systemd service ynh_systemctl --service="$app" --action="start" --log_path="systemd" --wait_until="Server listening on port" #================================================= diff --git a/scripts/install b/scripts/install index 6fc4757..72c4839 100644 --- a/scripts/install +++ b/scripts/install @@ -27,8 +27,7 @@ systemctl start elasticsearch.service ynh_script_progression "Setting up source files..." _git_clone_or_pull "$install_dir/sources" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir" + #================================================= # BUILDING #================================================= @@ -36,9 +35,9 @@ ynh_script_progression "Building..." pushd "$install_dir/sources" - ynh_exec_as_app node_load_PATH" yarn install --pure-lockfile + ynh_hide_warnings ynh_exec_as_app yarn install --pure-lockfile ynh_exec_as_app mkdir -p "dist" - ynh_exec_as_app node_load_PATH" npm run build + ynh_hide_warnings ynh_exec_as_app npm run build popd #================================================= @@ -48,22 +47,16 @@ ynh_script_progression "Adding a config file..." ynh_config_add --template="default.yaml" --destination="$install_dir/sources/config/production.yaml" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/sources/config/production.yaml" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/sources/config/production.yaml" - #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression "Adding system configurations related to $app..." -# Create a dedicated NGINX config ynh_config_add_nginx -# Create a dedicated systemd config ynh_config_add_systemd yunohost service add "$app" --description="$app search index daemon" -# Use logrotate to manage application logfile(s) ynh_config_add_logrotate #================================================= @@ -71,7 +64,6 @@ ynh_config_add_logrotate #================================================= ynh_script_progression "Starting $app's systemd service..." -# Start a systemd service ynh_systemctl --service="$app" --action="start" --log_path="systemd" --wait_until="Server listening on port" #================================================= diff --git a/scripts/remove b/scripts/remove index f26b8de..114d0a3 100644 --- a/scripts/remove +++ b/scripts/remove @@ -8,18 +8,14 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression "Removing system configurations related to $app..." -# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_hide_warnings yunohost service status "$app" >/dev/null; then yunohost service remove "$app" fi -# Remove the dedicated systemd config ynh_config_remove_systemd -# Remove the app-specific logrotate config ynh_config_remove_logrotate -# Remove the dedicated NGINX config ynh_config_remove_nginx #================================================= diff --git a/scripts/restore b/scripts/restore index 2cf62f7..5d5a948 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,6 +1,5 @@ #!/bin/bash -# 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 @@ -26,8 +25,6 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir" #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= @@ -37,6 +34,7 @@ ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore "/etc/systemd/system/$app.service" systemctl enable "$app.service" --quiet + yunohost service add "$app" --description="$app search index daemon" ynh_restore "/etc/logrotate.d/$app" diff --git a/scripts/upgrade b/scripts/upgrade index b176b45..64e2faa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,28 +37,22 @@ if [ -d "$install_dir/.git" ]; then mv "${install_dir}__tmp__" "$install_dir" fi -# Fix upgrade from 0.0.1.2022.06.03~ynh1 -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression "Upgrading source files..." _git_clone_or_pull "$install_dir/sources" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir" + #================================================= # BUILDING #================================================= ynh_script_progression "Building..." pushd "$install_dir/sources" - - ynh_exec_as_app node_load_PATH" yarn install --pure-lockfile + ynh_hide_warnings ynh_exec_as_app yarn install --pure-lockfile ynh_exec_as_app mkdir -p "dist" - ynh_exec_as_app node_load_PATH" npm run build + ynh_hide_warnings ynh_exec_as_app npm run build popd #================================================= @@ -68,22 +62,16 @@ ynh_script_progression "Updating a config file..." ynh_config_add --template="default.yaml" --destination="$install_dir/sources/config/production.yaml" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/sources/config/production.yaml" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/sources/config/production.yaml" - #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= ynh_script_progression "Upgrading system configurations related to $app..." -# Create a dedicated NGINX config ynh_config_add_nginx -# Create a dedicated systemd config ynh_config_add_systemd yunohost service add "$app" --description="$app search index daemon" -# Use logrotate to manage app-specific logfile(s) ynh_config_add_logrotate #=================================================