6 # sa-update must create keyring
7 if [ ! -d /etc/mail/spamassassin/sa-update-keys ]; then
11 # Initialize Channels and Keys
14 # Process each channel defined in /etc/mail/spamassassin/channel.d/
15 for file in /etc/mail/spamassassin/channel.d/*.conf; do
16 [ ! -f "$file" ] && continue
17 # Validate config file
18 PREFIXES="CHANNELURL KEYID BEGIN"
19 for prefix in $PREFIXES; do
20 if ! grep -q "$prefix" $file; then
21 echo "ERROR: $file missing $prefix"
26 #echo "CHANNELURL=$CHANNELURL"
28 CHANNELLIST="$CHANNELLIST $CHANNELURL"
29 KEYLIST="$KEYLIST $KEYID"
30 sa-update --import "$file"
33 [ -f /etc/mail/spamassassin/channels ] && OPT="$OPT --channelfile /etc/mail/spamassassin/channels"
35 # Run sa-update on each channel, restart spam daemon if success
36 for channel in $CHANNELLIST; do
37 OPT="$OPT --channel $channel"
39 for keyid in $KEYLIST; do
40 OPT="$OPT --gpgkey $keyid"
43 # Only restart spamd if sa-update returns 0, meaning it updated the rules
44 /usr/bin/sa-update $OPT || exit $?
46 if [ -x /usr/bin/sa-compile ]; then
47 out=$(/usr/bin/sa-compile 2>&1)
49 if [ $rc -gt 0 ]; then
55 if [ -x /etc/rc.d/init.d/spamd -a -e /var/lock/subsys/spamd ]; then
56 /sbin/service spamd restart > /dev/null