Enhance running hooks and write config_vars to .profile.d/