Skip to content

Commit 23a0762

Browse files
committed
update triggers
1 parent 1287a1e commit 23a0762

File tree

2 files changed

+45
-22
lines changed

2 files changed

+45
-22
lines changed

upd/add_fwd_only.sh

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,44 @@
11
#!/bin/bash
22

3-
# Define exim config
3+
# RHEL or CentOS
44
if [ -e "/etc/exim/exim.conf" ]; then
5-
# RHEL or CentOS
6-
conf="/etc/exim/exim.conf"
7-
else
8-
# Debian or Ubuntu
9-
conf="/etc/exim4/exim4.conf.template"
10-
fi
5+
conf='/etc/exim/exim.conf'
116

12-
# Check existance
13-
if [ ! -e "$conf" ]; then
14-
exit
15-
fi
7+
# Check if fwd_only flag
8+
check_flag=$(grep localuser_fwd_only $conf)
9+
if [ ! -z "$check_flag" ]; then
10+
exit
11+
fi
12+
13+
# Define new router
14+
fwd1='localuser_fwd_only:\n driver = accept\n transport = devnull\n'
15+
fwd2=' condition = \${if exists{/etc/exim/domains/\$domain/fwd_only}'
16+
fwd3='{\${lookup{\$local_part}lsearch{/etc/exim/domains/\$domain/fwd_only}'
17+
fwd4='{true}{false}}}}\n\n'
1618

17-
# Check if fwd_only flag
18-
check_flag=$(grep localuser_fwd_only $conf)
19-
if [ ! -z "$check_flag" ]; then
20-
exit
19+
# Insert router
20+
sed -i "s%localuser_spam:%$fwd1$fwd2$fwd3${fwd4}localuser_spam:%" $conf
2121
fi
2222

23-
# Define new router
24-
fwd1='localuser_fwd_only:\n driver = accept\n transport = devnull\n'
25-
fwd2=' condition = \${if exists{/etc/exim/domains/\$domain/fwd_only}'
26-
fwd3='{\${lookup{\$local_part}lsearch{/etc/exim/domains/\$domain/fwd_only}'
27-
fwd4='{true}{false}}}}\n\n'
23+
# Debian or Ubuntu
24+
if [ -e "/etc/exim4/exim4.conf.template" ]; then
25+
conf="/etc/exim4/exim4.conf.template"
26+
27+
# Check if fwd_only flag
28+
check_flag=$(grep localuser_fwd_only $conf)
29+
if [ ! -z "$check_flag" ]; then
30+
sed -i "s%/exim/domains/%/exim4/domains/i%" $conf
31+
else
32+
# Define new router
33+
fwd1='localuser_fwd_only:\n driver = accept\n transport = devnull\n'
34+
fwd2=' condition = \${if exists{/etc/exim4/domains/\$domain/fwd_only}'
35+
fwd3='{\${lookup{\$local_part}lsearch'
36+
fwd4='{/etc/exim4/domains/\$domain/fwd_only}{true}{false}}}}\n\n'
2837

29-
# Insert router
30-
sed -i "s%localuser_spam:%$fwd1$fwd2$fwd3${fwd4}localuser_spam:%" $conf
38+
# Insert router
39+
sed -i "s%localuser_spam:%$fwd1$fwd2$fwd3${fwd4}localuser_spam:%" $conf
40+
fi
41+
fi
3142

3243
# Restart mail server
3344
/usr/local/vesta/bin/v-restart-mail

upd/fix_exim_permissions.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
if [ -e "/etc/exim4/domains/" ]; then
4+
for domain in $(ls /etc/exim4/domains/); do
5+
domain_link=$(readlink /etc/exim4/domains/$domain)
6+
chown Debian-exim:mail $domain_link
7+
chown Debian-exim:mail /etc/exim4/domains/$domain/*
8+
chown dovecot:mail /etc/exim4/domains/$domain/passwd
9+
done
10+
fi
11+
12+
exit

0 commit comments

Comments
 (0)