2019-03-04 21:10:34 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-03-05 21:46:39 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
2023-04-06 14:36:04 +02:00
|
|
|
install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
2019-03-05 21:46:39 +01:00
|
|
|
|
2019-03-04 21:10:34 +01:00
|
|
|
set -e
|
|
|
|
|
|
|
|
do_pre_regen() {
|
|
|
|
pending_dir=$1
|
|
|
|
|
|
|
|
# Patch postfix conf
|
|
|
|
postfix_main_cf="${pending_dir}/../postfix/etc/postfix/main.cf"
|
|
|
|
|
|
|
|
# FIXME : check this file actually exists to not crash when only running this
|
|
|
|
# hook alone
|
|
|
|
|
2023-04-06 14:36:04 +02:00
|
|
|
sudo sed -e "s@^virtual_alias_maps\s*=\s*\(.*\)@virtual_alias_maps = hash:$install_dir/var/virtual,\1@"\
|
2019-03-04 21:10:34 +01:00
|
|
|
-i $postfix_main_cf
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
do_post_regen() {
|
|
|
|
|
|
|
|
regen_conf_files=$1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
FORCE=${2:-0}
|
|
|
|
DRY_RUN=${3:-0}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
pre)
|
|
|
|
do_pre_regen $4
|
|
|
|
;;
|
|
|
|
post)
|
|
|
|
do_post_regen $4
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "hook called with unknown argument \`$1'" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|