blob: da8d2a0b7f4241461604c5ac537370e439595fee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
#!/bin/sh
CHMOD=/bin/chmod
CP=/bin/cp
DATADIR=%%DATADIR%%
ECHO=echo
LN=/bin/ln
PERL=%%PERL%%
RM=/bin/rm
PKGVERSION=%%PKGVERSION%%
WITHOUT_SPAMASSASSIN_SYMLINK=%%WITHOUT_SPAMASSASSIN_SYMLINK%%
upgrade_lang_conf()
{
for LANG_DIR in ${DATADIR}/reports/*
do
if [ -f ${LANG_DIR}/languages.conf ] ; then
${ECHO} -n Upgrading ${LANG_DIR}/languages.conf... Please wait..
ms-upgrade-conf \
${LANG_DIR}/languages.conf \
${LANG_DIR}/languages.conf.sample > \
${LANG_DIR}/languages.conf.new.${PKGVERSION} \
2> /dev/null
if /usr/bin/diff -bBq ${LANG_DIR}/languages.conf \
${LANG_DIR}/languages.conf.new.${PKGVERSION}
then ${ECHO} " no changes"
${RM} ${LANG_DIR}/languages.conf.new.${PKGVERSION}
else ${ECHO} " done"
${CP} ${LANG_DIR}/languages.conf.new.${PKGVERSION} \
${LANG_DIR}/languages.conf
${CHMOD} u+w ${LANG_DIR}/languages.conf
fi
fi
done
}
upgrade_mailscanner_conf()
{
ms-upgrade-conf \
${PKG_PREFIX}/etc/MailScanner/MailScanner.conf \
${PKG_PREFIX}/etc/MailScanner/MailScanner.conf.sample > \
${PKG_PREFIX}/etc/MailScanner/MailScanner.conf.new.${PKGVERSION} \
2> /dev/null
if diff -b -B -q ${PKG_PREFIX}/etc/MailScanner/MailScanner.conf \
${PKG_PREFIX}/etc/MailScanner/MailScanner.conf.new.${PKGVERSION}
then ${ECHO} "No changes in MailScanner.conf options found"
else ${ECHO} -n "Changes in MailScanner.conf found. Please look at"
${ECHO} \
"${PKG_PREFIX}/etc/MailScanner/MailScanner.conf.new.${PKGVERSION}"
fi
}
initial_config()
{
for LANG_DIR in ${DATADIR}/reports/*
do
for REPORT_FILE in ${LANG_DIR}/*.sample
do
[ ! -f ${REPORT_FILE%.sample} ] \
&& cp -p ${REPORT_FILE} ${REPORT_FILE%.sample} \
&& ${CHMOD} u+w ${REPORT_FILE%.sample}
done
done
for WRAPPER in ${PKG_PREFIX}/libexec/MailScanner/*-wrapper.sample
do
[ ! -f ${WRAPPER%.sample} ] \
&& cp -p ${WRAPPER} ${WRAPPER%.sample} \
&& ${CHMOD} u+w ${WRAPPER%.sample}
done
for AUTOUPDATE in ${PKG_PREFIX}/libexec/MailScanner/*-autoupdate.sample
do
[ ! -f ${AUTOUPDATE%.sample} ] \
&& cp -p ${AUTOUPDATE} ${AUTOUPDATE%.sample} \
&& ${CHMOD} u+w ${AUTOUPDATE%.sample}
done
for RULES in ${PKG_PREFIX}/etc/MailScanner/rules/*.rules.sample
do
[ ! -f ${RULES%.sample} ] \
&& cp -p ${RULES} ${RULES%.sample} \
&& ${CHMOD} u+w ${RULES%.sample}
done
for MCP_FILES in %%MCP_FILES%%
do
[ ! -f ${PKG_PREFIX}/etc/MailScanner/mcp/${MCP_FILES} ] \
&& cp -p ${PKG_PREFIX}/etc/MailScanner/mcp/${MCP_FILES}.sample \
${PKG_PREFIX}/etc/MailScanner/mcp/${MCP_FILES} \
&& ${CHMOD} u+w ${PKG_PREFIX}/etc/MailScanner/mcp/${MCP_FILES}
done
for ETC in ${PKG_PREFIX}/etc/MailScanner/*.sample
do
[ ! -f ${ETC%.sample} ] \
&& cp -p ${ETC} ${ETC%.sample} \
&& ${CHMOD} u+w ${ETC%.sample}
done
}
case $2 in
POST-INSTALL)
if [ "${WITHOUT_SPAMASSASSIN_SYMLINK}" = "no" ] && \
[ ! -r ${PKG_PREFIX}/etc/mail/spamassassin/mailscanner.cf ]; then
if [ -r ${PKG_PREFIX}/etc/MailScanner/spam.assassin.prefs.conf ]; then
${LN} -s ${PKG_PREFIX}/etc/MailScanner/spam.assassin.prefs.conf \
${PKG_PREFIX}/etc/mail/spamassassin/mailscanner.cf
else
${LN} -s ${PKG_PREFIX}/etc/MailScanner/spamassassin.conf \
${PKG_PREFIX}/etc/mail/spamassassin/mailscanner.cf
fi
fi
upgrade_lang_conf
[ -f ${PKG_PREFIX}/etc/MailScanner/MailScanner.conf ] \
&& upgrade_mailscanner_conf
exit 0
;;
esac
|