mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Compile sieve script as needed and fix permissions in dovecot conf_regen
This commit is contained in:
parent
0d30ef6277
commit
6c7e202321
1 changed files with 12 additions and 8 deletions
|
@ -29,20 +29,24 @@ do_pre_regen() {
|
|||
}
|
||||
|
||||
do_post_regen() {
|
||||
regen_conf_files=$1
|
||||
|
||||
# create vmail user
|
||||
id vmail > /dev/null 2>&1 \
|
||||
|| sudo adduser --system --ingroup mail --uid 500 vmail
|
||||
|
||||
# compile sieve script
|
||||
# TODO: only compile if script changed
|
||||
sudo sievec /etc/dovecot/global_script/dovecot.sieve
|
||||
|
||||
# fix permissions
|
||||
sudo chown -R vmail:mail /etc/dovecot/global_script
|
||||
sudo chmod -R 770 /etc/dovecot/global_script
|
||||
sudo chmod 660 /etc/dovecot/global_script/dovecot.{sieve,svbin}
|
||||
sudo chmod 770 /etc/dovecot/global_script
|
||||
|
||||
[ -z "$regen_conf_files" ] && exit 0
|
||||
|
||||
# compile sieve script
|
||||
[[ "$regen_conf_files" =~ dovecot\.sieve ]] && {
|
||||
sudo sievec /etc/dovecot/global_script/dovecot.sieve
|
||||
sudo chown -R vmail:mail /etc/dovecot/global_script
|
||||
}
|
||||
|
||||
# TODO: only restart if conf changed
|
||||
sudo service dovecot restart
|
||||
}
|
||||
|
||||
|
@ -53,7 +57,7 @@ case "$1" in
|
|||
do_pre_regen $3
|
||||
;;
|
||||
post)
|
||||
do_post_regen
|
||||
do_post_regen $3
|
||||
;;
|
||||
*)
|
||||
echo "hook called with unknown argument \`$1'" >&2
|
||||
|
|
Loading…
Add table
Reference in a new issue