PLCRTPATH=/usr/share/plcrt
+function gethostbyaddr ()
+{
+ python -c 'import socket; import sys; print socket.gethostbyaddr(sys.argv[1])[0]' $1 2>/dev/null
+}
+
+
# Be verbose
set -x
sed -i -e "s/^security.*root//g" /etc/aliases
cat <<EOF >> /etc/aliases
# added by RT init scripts for default queues.
-support: "|/usr/sbin/rt-mailgate --queue support --action correspond --url http://localhost/rt3/"
-monitor: "|/usr/sbin/rt-mailgate --queue monitor --action correspond --url http://localhost/rt3/"
-security: "|/usr/sbin/rt-mailgate --queue security --action correspond --url http://localhost/rt3/"
-legal: "|/usr/sbin/rt-mailgate --queue legal --action correspond --url http://localhost/rt3/"
+support: "|/usr/sbin/rt-mailgate --queue support --action correspond --url http://$PLC_RT_HOST/rt3/"
+monitor: "|/usr/sbin/rt-mailgate --queue monitor --action correspond --url http://$PLC_RT_HOST/rt3/"
+security: "|/usr/sbin/rt-mailgate --queue security --action correspond --url http://$PLC_RT_HOST/rt3/"
+legal: "|/usr/sbin/rt-mailgate --queue legal --action correspond --url http://$PLC_RT_HOST/rt3/"
EOF
/usr/bin/newaliases
fi
if ! grep "$PLC_RT_HOST" /etc/mail/local-host-names ; then
# edit /etc/mail/local-host-names
echo "$PLC_RT_HOST" >> /etc/mail/local-host-names
+ IP=$( gethostbyname $PLC_RT_HOST )
+ REVHOST=$( gethostbyaddr $IP )
+ if [ -n "$REVHOST" ] ; then
+ echo "$REVHOST" >> /etc/mail/local-host-names
+ fi
fi
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
service sendmail restart