6 # sa-update must create keyring
7 if [ ! -d /etc/spamassassin/sa-update-keys ]; then
11 # Initialize Channels and Keys
14 # Process each channel defined in /etc/spamassassin/channel.d/
15 for file in /etc/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 # Using --channelfile breaks channel.d support :-/ Need better way but stays for now for backward compat
34 grep -q "^[a-zA-Z0-9]" /etc/spamassassin/channels && OPT="$OPT --channelfile /etc/spamassassin/channels"
36 # Run sa-update on each channel, restart spam daemon if success
37 for channel in $CHANNELLIST; do
38 OPT="$OPT --channel $channel"
40 for keyid in $KEYLIST; do
41 OPT="$OPT --gpgkey $keyid"
44 # Only restart spamd if sa-update returns 0, meaning it updated the rules
45 /usr/bin/sa-update $OPT || exit $?
47 if [ -x /usr/bin/sa-compile ]; then
48 out=$(/usr/bin/sa-compile 2>&1)
50 if [ $rc -gt 0 ]; then
56 if [ -x /etc/rc.d/init.d/spamd -a -e /var/lock/subsys/spamd ]; then
57 /sbin/service spamd restart > /dev/null