Conf_regen Hook execution timing

Hello,

I am working on a package for YunoHost that involves modifying Postfix configurations. During the installation process, I have encountered a challenge with the conf_regen hook’s execution timing.

The conf_regen hook, along with other hooks, is copied to the disk only towards the end of the installation process. For the package requirements, I’d like that conf_regen is executed before the installation completes. When the installation script executes yunohost tools regen-conf, the hook, not yet copied at this stage, is not considered.

Also, I’m open to exploring alternatives:

  1. Implementing a one-shot post-installation script to trigger the required configuration changes.
  2. Using a command like yunohost hook exec, though I have faced challenges in its effective execution (tbh I don’t understand how it works).

Iv’e noticed, in the app_install function, operations related to cleaning hooks, setting permissions, and invoking hook_callback. Unless I misunderstood, it appears these are for hooks already installed.

Thanks for any help you can provide me.

I would just have your custom hook in the app’s conf/ folder, then “manually” copy it to the appropriate destination and call the regen conf with :

ynh_add_config --template="regenconf_postfix" --destination="/usr/share/yunohost/hooks/conf_regen/98-postfix_$app"
yunohost tools regen-conf postfix
1 Like