From 8159bad2501c38a3203bbd99bee18c5b442a0390 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 20 Apr 2023 22:50:00 +0200 Subject: [PATCH] Fix hooks --- hooks/post_app_addaccess | 3 +++ hooks/post_app_removeaccess | 3 +++ scripts/install | 8 ++++++++ scripts/upgrade | 8 ++++++++ 4 files changed, 22 insertions(+) diff --git a/hooks/post_app_addaccess b/hooks/post_app_addaccess index 521614d..2e6544d 100644 --- a/hooks/post_app_addaccess +++ b/hooks/post_app_addaccess @@ -1,6 +1,9 @@ #!/bin/bash app=$1 +# Run only if we are altering aeneria's permissions +[[ "$app" != "__APP__" ]] && exit 0 + # Source YunoHost helpers source /usr/share/yunohost/helpers source /etc/yunohost/apps/$app/scripts/_common.sh diff --git a/hooks/post_app_removeaccess b/hooks/post_app_removeaccess index 1cd9c1c..6e3479e 100644 --- a/hooks/post_app_removeaccess +++ b/hooks/post_app_removeaccess @@ -1,6 +1,9 @@ #!/bin/bash app=$1 +# Run only if we are altering aeneria's permissions +[[ "$app" != "__APP__" ]] && exit 0 + # Source YunoHost helpers source /usr/share/yunohost/helpers source /etc/yunohost/apps/$app/scripts/_common.sh diff --git a/scripts/install b/scripts/install index 23ca50b..7834718 100644 --- a/scripts/install +++ b/scripts/install @@ -149,6 +149,14 @@ ynh_add_config --template="../conf/aeneria.cron" --destination="/etc/cron.d/$app chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" +#================================================= +# ADAPT HOOK FOR AENERIA INSTANCE +#================================================= +ynh_script_progression --message="Adapting hooks..." --weight=1 + +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_addaccess" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_removeaccess" + #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f33b523..e4eb1b3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -188,6 +188,14 @@ ynh_add_config --template="../conf/aeneria.cron" --destination="/etc/cron.d/$app chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" +#================================================= +# ADAPT HOOK FOR AENERIA INSTANCE +#================================================= +ynh_script_progression --message="Adapting hooks..." --weight=1 + +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_addaccess" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_removeaccess" + #================================================= # RELOAD NGINX #=================================================