# HG changeset patch # User Carl Byington # Date 1486406707 28800 # Node ID 37793d4c90a00de3f7b33afcd69f71eeafc02e9f # Parent 67481a1a502ff606e30aced59ae083b4f5dd4893 changes for rhel7 systemd and /var/run on tmpfs diff -r 67481a1a502f -r 37793d4c90a0 Makefile.am --- a/Makefile.am Fri Dec 24 15:15:41 2010 -0800 +++ b/Makefile.am Mon Feb 06 10:45:07 2017 -0800 @@ -2,18 +2,23 @@ SUBDIRS = src man html info hackdir = $(sysconfdir)/sm-archive -hack_SCRIPTS = sm-archive +hack_SCRIPTS = sm-archive sm-archive.service sm-archive-tmpfs.conf hack_DATA = sm-archive.conf htmldir = ${datadir}/doc/@PACKAGE@-@VERSION@ html_DATA = AUTHORS COPYING ChangeLog NEWS README -CLEANFILES = sm-archive xml/sm-archive xml/Makefile -EXTRA_DIST = sm-archive.rc $(hack_DATA) sm-archive.spec $(wildcard m4/*) $(wildcard xml/h*) $(wildcard xml/M*) $(wildcard xml/sm*) +CLEANFILES = sm-archive.service sm-archive xml/sm-archive xml/Makefile +EXTRA_DIST = sm-archive-tmpfs.conf sm-archive.service.rc sm-archive.rc $(hack_DATA) sm-archive.spec $(wildcard m4/*) $(wildcard xml/h*) $(wildcard xml/M*) $(wildcard xml/sm*) sm-archive: sm-archive.rc cat $(srcdir)/sm-archive.rc | \ sed -e "s,SBINDIR,$(sbindir),g" | \ sed -e "s,SYSCONFDIR,$(sysconfdir),g" >>sm-archive +sm-archive.service: sm-archive.service.rc + cat $(srcdir)/sm-archive.service.rc | \ + sed -e "s,SBINDIR,$(sbindir),g" | \ + sed -e "s,SYSCONFDIR,$(sysconfdir),g" >>sm-archive.service + chkconfig: sm-archive /usr/bin/getent passwd sm-archive || /usr/sbin/useradd -r -d /etc/sm-archive -M -c "sm-archive pseudo-user" -s /sbin/nologin sm-archive mv -f $(sysconfdir)/sm-archive /etc/rc.d/init.d diff -r 67481a1a502f -r 37793d4c90a0 configure.in --- a/configure.in Fri Dec 24 15:15:41 2010 -0800 +++ b/configure.in Mon Feb 06 10:45:07 2017 -0800 @@ -1,5 +1,5 @@ AC_PREREQ(2.59) -AC_INIT(sm-archive,1.8,carl@five-ten-sg.com) +AC_INIT(sm-archive,1.9,carl@five-ten-sg.com) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADER([config.h]) diff -r 67481a1a502f -r 37793d4c90a0 sm-archive-tmpfs.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sm-archive-tmpfs.conf Mon Feb 06 10:45:07 2017 -0800 @@ -0,0 +1,1 @@ +d /var/run/sm-archive 750 sm-archive root diff -r 67481a1a502f -r 37793d4c90a0 sm-archive.service.rc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sm-archive.service.rc Mon Feb 06 10:45:07 2017 -0800 @@ -0,0 +1,17 @@ +[Unit] +Description = Mail filter for Archiving +Wants = sendmail.service +After = syslog.target +After = local-fs.target +After = network.target +Before = sendmail.service + +[Service] +Type = simple +UMask = 0022 +User = sm-archive +WorkingDirectory = SYSCONFDIR/sm-archive +ExecStart = SBINDIR/smarchive -d 10 -p local:/var/run/sm-archive/sm-archive.sock + +[Install] +WantedBy = multi-user.target diff -r 67481a1a502f -r 37793d4c90a0 sm-archive.spec.in --- a/sm-archive.spec.in Fri Dec 24 15:15:41 2010 -0800 +++ b/sm-archive.spec.in Mon Feb 06 10:45:07 2017 -0800 @@ -18,7 +18,15 @@ BuildRequires: sendmail-devel >= 8.12.1 Requires: sendmail >= 8.12.1 Requires: sendmail-cf - +%if "%{?dist}" == ".el7" +Requires(pre): systemd-sysv, shadow-utils +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units +Requires: coreutils +Requires: systemd-units +BuildRequires: systemd-units +%endif %description This milter adds recipient addresses to messages passing thru it, based @@ -39,11 +47,22 @@ make %{?_smp_mflags} %install -rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT install -mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d -mv -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/%{name} $RPM_BUILD_ROOT/etc/rc.d/init.d -mkdir -p $RPM_BUILD_ROOT/var/run/%{name} +rm -rf %{buildroot} +make DESTDIR=%{buildroot} install +%if "%{?dist}" == ".el7" +install -m 644 -D %{buildroot}%{_sysconfdir}/%{name}/%{name}.service \ + %{buildroot}%{_unitdir}/%{name}.service +install -m 755 -d %{buildroot}%{_prefix}/lib/tmpfiles.d +install -m 644 %{buildroot}%{_sysconfdir}/%{name}/%{name}-tmpfs.conf \ + %{buildroot}%{_prefix}/lib/tmpfiles.d/%{name}.conf +%else +install -m 755 -D %{buildroot}%{_sysconfdir}/%{name}/%{name} \ + %{buildroot}%{_initrddir}/%{name} +%endif +mkdir -p %{buildroot}/var/run/%{name} +rm -f %{buildroot}%{_sysconfdir}/%{name}/%{name} +rm -f %{buildroot}%{_sysconfdir}/%{name}/%{name}.service +rm -f %{buildroot}%{_sysconfdir}/%{name}/%{name}-tmpfs.conf %pre @@ -51,23 +70,46 @@ %post +if [ $1 = 1 ]; then + # initial install +%if "%{?dist}" == ".el7" + /bin/systemctl daemon-reload &>/dev/null || : +%else /sbin/chkconfig --add %{name} echo Remember to edit %{_sysconfdir}/%{name}/%{name}.conf and add the following line to your sendmail.mc: echo "INPUT_MAIL_FILTER(\`sm-archive', \`S=local:/var/run/sm-archive/sm-archive.sock, F=T, T=C:30s;S:5m;R:5m;E:5m')" echo +%endif +fi %preun -[ $1 = 0 ] && /sbin/service %{name} stop || : +if [ $1 = 0 ]; then + # package removal, not upgrade +%if "%{?dist}" == ".el7" + /bin/systemctl --no-reload disable %{name}.service &>/dev/null || : + /bin/systemctl stop %{name}.service &>/dev/null || : +%else + /sbin/service %{name} stop || : + /sbin/chkconfig --del %{name} +%endif +userdel %{name} || : +fi %postun -[ $1 = 0 ] && /sbin/chkconfig --del %{name} -[ $1 = 0 ] && userdel %{name} || : +if [ $1 -ge 1 ]; then + # package upgrade, not uninstall +%if "%{?dist}" == ".el7" + /bin/systemctl try-restart %{name}.service &>/dev/null || : +%else + /sbin/service %{name} restart || : +%endif +fi %clean -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} %files @@ -78,11 +120,19 @@ %docdir %{_datadir}/doc/%{name}-%{version} %{_datadir}/doc/%{name}-%{version} %config(noreplace) %attr(0750,%{name},root) %{_sysconfdir}/%{name} -/etc/rc.d/init.d/%{name} +%if "%{?dist}" == ".el7" +%{_prefix}/lib/tmpfiles.d/%{name}.conf +%{_unitdir}/%{name}.service +%else +%{_initrddir}/%{name} +%endif %dir %attr(0750,%{name},root) /var/run/%{name} %changelog +* Mon Feb 06 2017 Carl Byington - 1.9-1 +- enable rhel7 systemd and /var/run is on tmpfs + * Fri Dec 24 2010 Carl Byington - 1.8-1 - patches from Marco d'Itri for postfix