rpms/sendmail/devel sendmail.etc-mail-make, 1.1, 1.2 sendmail.init, 1.19, 1.20 sendmail.spec, 1.96, 1.97

Miroslav Lichvar mlichvar at fedoraproject.org
Fri Dec 19 13:24:11 UTC 2008


Author: mlichvar

Update of /cvs/pkgs/rpms/sendmail/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7170

Modified Files:
	sendmail.etc-mail-make sendmail.init sendmail.spec 
Log Message:
- run newaliases only when necessary



Index: sendmail.etc-mail-make
===================================================================
RCS file: /cvs/pkgs/rpms/sendmail/devel/sendmail.etc-mail-make,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sendmail.etc-mail-make	3 Dec 2008 18:29:05 -0000	1.1
+++ sendmail.etc-mail-make	19 Dec 2008 13:23:41 -0000	1.2
@@ -23,6 +23,43 @@
   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() {
   mc=${1%.cf}.mc
 
@@ -76,8 +113,11 @@
     all)
       makeall
       ;;
+    aliases)
+      makealiasesdb
+      ;;
     clean)
-      rm -f *.db *~
+      rm -f *.db *~ aliasesdb-stamp
       ;;
     start|stop|restart)
       service sendmail "$target"


Index: sendmail.init
===================================================================
RCS file: /cvs/pkgs/rpms/sendmail/devel/sendmail.init,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- sendmail.init	3 Dec 2008 18:29:05 -0000	1.19
+++ sendmail.init	19 Dec 2008 13:23:41 -0000	1.20
@@ -50,7 +50,7 @@
 	warning
 	echo
     fi
-    /usr/bin/newaliases > /dev/null 2>&1
+    /etc/mail/make aliases > /dev/null 2>&1
 }
 
 start() {


Index: sendmail.spec
===================================================================
RCS file: /cvs/pkgs/rpms/sendmail/devel/sendmail.spec,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- sendmail.spec	3 Dec 2008 18:29:05 -0000	1.96
+++ sendmail.spec	19 Dec 2008 13:23:41 -0000	1.97
@@ -15,7 +15,7 @@
 Summary: A widely used Mail Transport Agent (MTA)
 Name: sendmail
 Version: 8.14.3
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: Sendmail
 Group: System Environment/Daemons
 URL: http://www.sendmail.org/
@@ -352,6 +352,8 @@
 	chmod 0644 %{buildroot}%{maildir}/${map}.db
 done
 
+touch %{buildroot}%{maildir}/aliasesdb-stamp
+
 install -p -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/sendmail
 install -p -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/sendmail
 install -p -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/10-sendmail
@@ -426,8 +428,8 @@
 	chown root %{_sysconfdir}/aliases.db %{maildir}/access.db \
 		%{maildir}/mailertable.db %{maildir}/domaintable.db \
 		%{maildir}/virtusertable.db
-	%{_bindir}/newaliases
-	SM_FORCE_DBREBUILD=1 /etc/mail/make
+	SM_FORCE_DBREBUILD=1 %{maildir}/make
+	SM_FORCE_DBREBUILD=1 %{maildir}/make aliases
 } > /dev/null 2>&1
 exit 0
 
@@ -491,6 +493,7 @@
 %config(noreplace) %{maildir}/trusted-users
 %config(noreplace) %{maildir}/virtusertable
 
+%ghost %{maildir}/aliasesdb-stamp
 %ghost %{maildir}/virtusertable.db
 %ghost %{maildir}/access.db
 %ghost %{maildir}/domaintable.db
@@ -541,6 +544,9 @@
 
 
 %changelog
+* Fri Dec 19 2008 Miroslav Lichvar <mlichvar at redhat.com> 8.14.3-3
+- run newaliases only when necessary
+
 * Wed Dec 03 2008 Miroslav Lichvar <mlichvar at redhat.com> 8.14.3-2
 - add NM dispatcher script (#451575)
 - print warning on service start when sendmail-cf is required (#447148)




More information about the fedora-extras-commits mailing list