From 28eb50320602227400d67595f8ecd1e785fdc9d9 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 09:35:29 +0200 Subject: [PATCH] cleaning --- manifest.toml | 2 +- scripts/backup | 1 - scripts/change_url | 9 --------- scripts/install | 12 ------------ scripts/remove | 5 +---- scripts/restore | 5 ----- scripts/upgrade | 25 ++++--------------------- 7 files changed, 6 insertions(+), 53 deletions(-) diff --git a/manifest.toml b/manifest.toml index 518c04d..7daabad 100644 --- a/manifest.toml +++ b/manifest.toml @@ -18,7 +18,7 @@ userdoc = "https://galene.org/faq.html" code = "https://github.com/jech/galene" [integration] -yunohost = ">= 11.2.18" +yunohost = ">= 11.2.29" helpers_version = "2.1" architectures = "all" multi_instance = false diff --git a/scripts/backup b/scripts/backup index e6176d5..0411be2 100755 --- 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 8b3e248..35f5473 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -36,30 +36,21 @@ ynh_script_progression "Updating configuration..." domain="$new_domain" # Configure Galène ynh_config_add --template="config.json" --destination="$install_dir/live/data/config.json" -#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/live/data/config.json" -#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/live/data/config.json" # Configure Galene LDAP #ynh_config_add --template="galene-ldap.json" --destination="$install_dir/live_ldap/data/galene-ldap.json" -#chmod 400 "$install_dir/live_ldap/data/galene-ldap.json" -#chown $app:$app "$install_dir/live_ldap/data/galene-ldap.json" # Create a group name config #ynh_config_add --template="groupname.json" --destination="$data_dir/groups/$group_name.json" -##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 "$data_dir/groups/$group_name.json" -##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 "$data_dir/groups/$group_name.json" # Create a group name authenticated on LDAP ynh_config_add --template="groupname-ldap.json" --destination="$data_dir/groups/YunoHost_Users.json" -#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 "$data_dir/groups/YunoHost_Users.json" -#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 "$data_dir/groups/YunoHost_Users.json" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression "Starting $app's systemd service..." -# Start a systemd service ynh_systemctl --service=$app --action="start" --log_path="systemd" ynh_systemctl --service=${app}_ldap --action="start" --log_path="systemd" diff --git a/scripts/install b/scripts/install index 48de33f..da0a6ca 100755 --- a/scripts/install +++ b/scripts/install @@ -23,7 +23,6 @@ ynh_hide_warnings yunohost firewall allow UDP -4 49152:65535 #================================================= ynh_script_progression "Setting up source files..." -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir/build" ynh_setup_source --dest_dir="$install_dir/build_ldap" --source_id="ldap" @@ -33,8 +32,6 @@ mkdir -p "$install_dir/live_ldap/data" cp -r "$install_dir/build/static/" "$install_dir/live/" ynh_replace --match="
Galène
" --replace="
Galène
" --file="$install_dir/live/static/galene.html" -#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:www-data "$install_dir" #================================================= # SPECIFIC SETUP #================================================= @@ -75,8 +72,6 @@ ynh_app_setting_set --key=password_hash --value="$password_hash" # Configure Galène ynh_config_add --template="config.json" --destination="$install_dir/live/data/config.json" -#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/live/data/config.json" -#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/live/data/config.json" # Configure Galène LDAP key=$(jose jwk gen -i '{"kty":"oct","alg":"HS256"}') @@ -87,13 +82,9 @@ chown $app:$app "$install_dir/live_ldap/data/galene-ldap.json" # Create a group name config ynh_config_add --template="groupname.json" --destination="$data_dir/groups/$group_name.json" -#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 "$data_dir/groups/$group_name.json" -#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 "$data_dir/groups/$group_name.json" # Create a group name authenticated on LDAP ynh_config_add --template="groupname-ldap.json" --destination="$data_dir/groups/YunoHost_Users.json" -#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 "$data_dir/groups/YunoHost_Users.json" -#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 "$data_dir/groups/YunoHost_Users.json" #================================================= # SYSTEM CONFIGURATION @@ -102,10 +93,8 @@ ynh_script_progression "Adding system configurations related to $app..." public_ip4="$(curl -s ip.yunohost.org)" || true -# Create a dedicated NGINX config ynh_config_add_nginx -# Create a dedicated systemd config ynh_config_add_systemd ynh_config_add_systemd --service=${app}_ldap --template="ldap.service" @@ -117,7 +106,6 @@ yunohost service add ${app}_ldap --description="LDAP integration for the videoco #================================================= ynh_script_progression "Starting $app's systemd service..." -# Start a systemd service ynh_systemctl --service=$app --action="start" --log_path="systemd" ynh_systemctl --service=${app}_ldap --action="start" --log_path="systemd" diff --git a/scripts/remove b/scripts/remove index 6e8756c..02d2565 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,24 +10,21 @@ 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 ynh_script_progression "Removing $app service integration..." yunohost service remove $app fi -# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) + if ynh_hide_warnings yunohost service status ${app}_ldap >/dev/null then ynh_script_progression "Removing ${app}_ldap service integration..." yunohost service remove ${app}_ldap fi -# Remove the dedicated systemd config ynh_config_remove_systemd ynh_config_remove_systemd${app}_ldap -# Remove the dedicated NGINX config ynh_config_remove_nginx #================================================= diff --git a/scripts/restore b/scripts/restore index ff5a255..bea4358 100755 --- 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 @@ -11,8 +10,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:www-data "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= @@ -25,8 +22,6 @@ chown -R $app:www-data "$data_dir" #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= ynh_script_progression "Restoring system configurations related to $app..." ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" diff --git a/scripts/upgrade b/scripts/upgrade index daa47c1..2933a6a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -49,8 +49,6 @@ ynh_safe_rm "$install_dir/live/static/" cp -r "$install_dir/build/static/" "$install_dir/live/" ynh_replace --match="
Galène
" --replace="
Galène
" --file="$install_dir/live/static/galene.html" -#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:www-data "$install_dir" #================================================= # BUILD APP #================================================= @@ -83,36 +81,23 @@ chmod +x "$install_dir/galene-password-generator" ynh_script_progression "Updating configuration..." # If password_hash doesn't exist, create it -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=password_hash --value=$(echo $($install_dir/galene-password-generator $password)) -if [ -z "${password_hash:-}" ]; then - password_hash=$(echo $($install_dir/galene-password-generator $password)) - ynh_app_setting_set --key=password_hash --value="$password_hash" -fi +ynh_app_setting_set_default --key=password_hash --value=$(echo $($install_dir/galene-password-generator $password)) + # Configure Galène ynh_config_add --template="config.json" --destination="$install_dir/live/data/config.json" -#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/live/data/config.json" -#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/live/data/config.json" # Configure Galène LDAP -# If key doesn't exist, create it -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=key --value=$(jose jwk gen -i '{"kty":"oct","alg":"HS256"}') -if [ -z "${key:-}" ]; then - key=$(jose jwk gen -i '{"kty":"oct","alg":"HS256"}') - ynh_app_setting_set --key=key --value=$key -fi +ynh_app_setting_set_default --key=key --value=$(jose jwk gen -i '{"kty":"oct","alg":"HS256"}') + ynh_config_add --template="galene-ldap.json" --destination="$install_dir/live_ldap/data/galene-ldap.json" chmod 400 "$install_dir/live_ldap/data/galene-ldap.json" chown $app:$app "$install_dir/live_ldap/data/galene-ldap.json" # Create a group name config ynh_config_add --template="groupname.json" --destination="$data_dir/groups/$group_name.json" -#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 "$data_dir/groups/$group_name.json" -#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 "$data_dir/groups/$group_name.json" # Create a group name authenticated on LDAP ynh_config_add --template="groupname-ldap.json" --destination="$data_dir/groups/YunoHost_Users.json" -#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 "$data_dir/groups/YunoHost_Users.json" -#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 "$data_dir/groups/YunoHost_Users.json" #================================================= # REAPPLY SYSTEM CONFIGURATIONS @@ -121,10 +106,8 @@ ynh_script_progression "Upgrading system configurations related to $app..." public_ip4="$(curl -s ip.yunohost.org)" || true -# Create a dedicated NGINX config ynh_config_add_nginx -# Create a dedicated systemd config ynh_config_add_systemd ynh_config_add_systemd --service=${app}_ldap --template="ldap.service"