- run newaliases only when necessary
This commit is contained in:
parent
e861a83e20
commit
45fbb3396d
@ -23,6 +23,43 @@ makedb() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
makealiasesdb() {
|
||||||
|
uptodate=1
|
||||||
|
|
||||||
|
if [ -z "$SM_FORCE_DBREBUILD" ]; then
|
||||||
|
files=$(grep '^O AliasFile=' sendmail.cf |
|
||||||
|
while read a; do echo ${a#*=}; done)
|
||||||
|
|
||||||
|
for a in $files; do
|
||||||
|
if [ "$a" = /etc/aliases ]; then
|
||||||
|
# /etc/aliases.db may be used by other MTA, make sure nothing
|
||||||
|
# has touched it since our last newaliases call
|
||||||
|
test "$a" -nt "${a}.db" ||
|
||||||
|
test aliasesdb-stamp -nt "${a}.db" ||
|
||||||
|
test aliasesdb-stamp -ot "${a}.db" || continue
|
||||||
|
else
|
||||||
|
test "$a" -nt "${a}.db" || continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
uptodate=0
|
||||||
|
break
|
||||||
|
done
|
||||||
|
else
|
||||||
|
uptodate=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ $uptodate = 1 ] && return 0
|
||||||
|
|
||||||
|
# check if alternatives is configured to sendmail
|
||||||
|
if [ "$(readlink -e /usr/bin/newaliases)" = /usr/sbin/sendmail.sendmail ]
|
||||||
|
then
|
||||||
|
/usr/bin/newaliases > /dev/null
|
||||||
|
touch -r /etc/aliases.db aliasesdb-stamp 2> /dev/null
|
||||||
|
else
|
||||||
|
rm -f aliasesdb-stamp
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
makecf() {
|
makecf() {
|
||||||
mc=${1%.cf}.mc
|
mc=${1%.cf}.mc
|
||||||
|
|
||||||
@ -76,8 +113,11 @@ for target; do
|
|||||||
all)
|
all)
|
||||||
makeall
|
makeall
|
||||||
;;
|
;;
|
||||||
|
aliases)
|
||||||
|
makealiasesdb
|
||||||
|
;;
|
||||||
clean)
|
clean)
|
||||||
rm -f *.db *~
|
rm -f *.db *~ aliasesdb-stamp
|
||||||
;;
|
;;
|
||||||
start|stop|restart)
|
start|stop|restart)
|
||||||
service sendmail "$target"
|
service sendmail "$target"
|
||||||
|
@ -50,7 +50,7 @@ updateconf() {
|
|||||||
warning
|
warning
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
/usr/bin/newaliases > /dev/null 2>&1
|
/etc/mail/make aliases > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
Summary: A widely used Mail Transport Agent (MTA)
|
Summary: A widely used Mail Transport Agent (MTA)
|
||||||
Name: sendmail
|
Name: sendmail
|
||||||
Version: 8.14.3
|
Version: 8.14.3
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
License: Sendmail
|
License: Sendmail
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
URL: http://www.sendmail.org/
|
URL: http://www.sendmail.org/
|
||||||
@ -352,6 +352,8 @@ for map in virtusertable access domaintable mailertable ; do
|
|||||||
chmod 0644 %{buildroot}%{maildir}/${map}.db
|
chmod 0644 %{buildroot}%{maildir}/${map}.db
|
||||||
done
|
done
|
||||||
|
|
||||||
|
touch %{buildroot}%{maildir}/aliasesdb-stamp
|
||||||
|
|
||||||
install -p -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/sendmail
|
install -p -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/sendmail
|
||||||
install -p -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/sendmail
|
install -p -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/sendmail
|
||||||
install -p -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/10-sendmail
|
install -p -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/10-sendmail
|
||||||
@ -426,8 +428,8 @@ exit 0
|
|||||||
chown root %{_sysconfdir}/aliases.db %{maildir}/access.db \
|
chown root %{_sysconfdir}/aliases.db %{maildir}/access.db \
|
||||||
%{maildir}/mailertable.db %{maildir}/domaintable.db \
|
%{maildir}/mailertable.db %{maildir}/domaintable.db \
|
||||||
%{maildir}/virtusertable.db
|
%{maildir}/virtusertable.db
|
||||||
%{_bindir}/newaliases
|
SM_FORCE_DBREBUILD=1 %{maildir}/make
|
||||||
SM_FORCE_DBREBUILD=1 /etc/mail/make
|
SM_FORCE_DBREBUILD=1 %{maildir}/make aliases
|
||||||
} > /dev/null 2>&1
|
} > /dev/null 2>&1
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
@ -491,6 +493,7 @@ exit 0
|
|||||||
%config(noreplace) %{maildir}/trusted-users
|
%config(noreplace) %{maildir}/trusted-users
|
||||||
%config(noreplace) %{maildir}/virtusertable
|
%config(noreplace) %{maildir}/virtusertable
|
||||||
|
|
||||||
|
%ghost %{maildir}/aliasesdb-stamp
|
||||||
%ghost %{maildir}/virtusertable.db
|
%ghost %{maildir}/virtusertable.db
|
||||||
%ghost %{maildir}/access.db
|
%ghost %{maildir}/access.db
|
||||||
%ghost %{maildir}/domaintable.db
|
%ghost %{maildir}/domaintable.db
|
||||||
@ -541,6 +544,9 @@ exit 0
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Dec 19 2008 Miroslav Lichvar <mlichvar@redhat.com> 8.14.3-3
|
||||||
|
- run newaliases only when necessary
|
||||||
|
|
||||||
* Wed Dec 03 2008 Miroslav Lichvar <mlichvar@redhat.com> 8.14.3-2
|
* Wed Dec 03 2008 Miroslav Lichvar <mlichvar@redhat.com> 8.14.3-2
|
||||||
- add NM dispatcher script (#451575)
|
- add NM dispatcher script (#451575)
|
||||||
- print warning on service start when sendmail-cf is required (#447148)
|
- print warning on service start when sendmail-cf is required (#447148)
|
||||||
|
Loading…
Reference in New Issue
Block a user