comparison sm-archive.spec.in @ 23:37793d4c90a0

changes for rhel7 systemd and /var/run on tmpfs
author Carl Byington <carl@five-ten-sg.com>
date Mon, 06 Feb 2017 10:45:07 -0800
parents 09564d4acd9e
children 7d599c9b7d65
comparison
equal deleted inserted replaced
22:67481a1a502f 23:37793d4c90a0
16 Requires(post,preun): /sbin/chkconfig 16 Requires(post,preun): /sbin/chkconfig
17 Requires(post,preun): /sbin/service 17 Requires(post,preun): /sbin/service
18 BuildRequires: sendmail-devel >= 8.12.1 18 BuildRequires: sendmail-devel >= 8.12.1
19 Requires: sendmail >= 8.12.1 19 Requires: sendmail >= 8.12.1
20 Requires: sendmail-cf 20 Requires: sendmail-cf
21 21 %if "%{?dist}" == ".el7"
22 Requires(pre): systemd-sysv, shadow-utils
23 Requires(post): systemd-units
24 Requires(preun): systemd-units
25 Requires(postun): systemd-units
26 Requires: coreutils
27 Requires: systemd-units
28 BuildRequires: systemd-units
29 %endif
22 30
23 %description 31 %description
24 This milter adds recipient addresses to messages passing thru it, based 32 This milter adds recipient addresses to messages passing thru it, based
25 on a configuration file. 33 on a configuration file.
26 34
37 %build 45 %build
38 %configure 46 %configure
39 make %{?_smp_mflags} 47 make %{?_smp_mflags}
40 48
41 %install 49 %install
42 rm -rf $RPM_BUILD_ROOT 50 rm -rf %{buildroot}
43 make DESTDIR=$RPM_BUILD_ROOT install 51 make DESTDIR=%{buildroot} install
44 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d 52 %if "%{?dist}" == ".el7"
45 mv -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/%{name} $RPM_BUILD_ROOT/etc/rc.d/init.d 53 install -m 644 -D %{buildroot}%{_sysconfdir}/%{name}/%{name}.service \
46 mkdir -p $RPM_BUILD_ROOT/var/run/%{name} 54 %{buildroot}%{_unitdir}/%{name}.service
55 install -m 755 -d %{buildroot}%{_prefix}/lib/tmpfiles.d
56 install -m 644 %{buildroot}%{_sysconfdir}/%{name}/%{name}-tmpfs.conf \
57 %{buildroot}%{_prefix}/lib/tmpfiles.d/%{name}.conf
58 %else
59 install -m 755 -D %{buildroot}%{_sysconfdir}/%{name}/%{name} \
60 %{buildroot}%{_initrddir}/%{name}
61 %endif
62 mkdir -p %{buildroot}/var/run/%{name}
63 rm -f %{buildroot}%{_sysconfdir}/%{name}/%{name}
64 rm -f %{buildroot}%{_sysconfdir}/%{name}/%{name}.service
65 rm -f %{buildroot}%{_sysconfdir}/%{name}/%{name}-tmpfs.conf
47 66
48 67
49 %pre 68 %pre
50 /usr/bin/getent passwd sm-archive >/dev/null || useradd -r -d /etc/sm-archive -M -c "sm-archive pseudo-user" -s /sbin/nologin sm-archive >/dev/null 69 /usr/bin/getent passwd sm-archive >/dev/null || useradd -r -d /etc/sm-archive -M -c "sm-archive pseudo-user" -s /sbin/nologin sm-archive >/dev/null
51 70
52 71
53 %post 72 %post
54 /sbin/chkconfig --add %{name} 73 if [ $1 = 1 ]; then
55 echo Remember to edit %{_sysconfdir}/%{name}/%{name}.conf and add the following line to your sendmail.mc: 74 # initial install
56 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')" 75 %if "%{?dist}" == ".el7"
57 echo 76 /bin/systemctl daemon-reload &>/dev/null || :
77 %else
78 /sbin/chkconfig --add %{name}
79 echo Remember to edit %{_sysconfdir}/%{name}/%{name}.conf and add the following line to your sendmail.mc:
80 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')"
81 echo
82 %endif
83 fi
58 84
59 85
60 %preun 86 %preun
61 [ $1 = 0 ] && /sbin/service %{name} stop || : 87 if [ $1 = 0 ]; then
88 # package removal, not upgrade
89 %if "%{?dist}" == ".el7"
90 /bin/systemctl --no-reload disable %{name}.service &>/dev/null || :
91 /bin/systemctl stop %{name}.service &>/dev/null || :
92 %else
93 /sbin/service %{name} stop || :
94 /sbin/chkconfig --del %{name}
95 %endif
96 userdel %{name} || :
97 fi
62 98
63 99
64 %postun 100 %postun
65 [ $1 = 0 ] && /sbin/chkconfig --del %{name} 101 if [ $1 -ge 1 ]; then
66 [ $1 = 0 ] && userdel %{name} || : 102 # package upgrade, not uninstall
103 %if "%{?dist}" == ".el7"
104 /bin/systemctl try-restart %{name}.service &>/dev/null || :
105 %else
106 /sbin/service %{name} restart || :
107 %endif
108 fi
67 109
68 110
69 %clean 111 %clean
70 rm -rf $RPM_BUILD_ROOT 112 rm -rf %{buildroot}
71 113
72 114
73 %files 115 %files
74 %defattr(-,root,root,-) 116 %defattr(-,root,root,-)
75 %{_sbindir}/* 117 %{_sbindir}/*
76 %{_mandir}/man1/* 118 %{_mandir}/man1/*
77 %{_mandir}/man5/* 119 %{_mandir}/man5/*
78 %docdir %{_datadir}/doc/%{name}-%{version} 120 %docdir %{_datadir}/doc/%{name}-%{version}
79 %{_datadir}/doc/%{name}-%{version} 121 %{_datadir}/doc/%{name}-%{version}
80 %config(noreplace) %attr(0750,%{name},root) %{_sysconfdir}/%{name} 122 %config(noreplace) %attr(0750,%{name},root) %{_sysconfdir}/%{name}
81 /etc/rc.d/init.d/%{name} 123 %if "%{?dist}" == ".el7"
124 %{_prefix}/lib/tmpfiles.d/%{name}.conf
125 %{_unitdir}/%{name}.service
126 %else
127 %{_initrddir}/%{name}
128 %endif
82 %dir %attr(0750,%{name},root) /var/run/%{name} 129 %dir %attr(0750,%{name},root) /var/run/%{name}
83 130
84 131
85 %changelog 132 %changelog
133 * Mon Feb 06 2017 Carl Byington <carl@five-ten-sg.com> - 1.9-1
134 - enable rhel7 systemd and /var/run is on tmpfs
135
86 * Fri Dec 24 2010 Carl Byington <carl@five-ten-sg.com> - 1.8-1 136 * Fri Dec 24 2010 Carl Byington <carl@five-ten-sg.com> - 1.8-1
87 - patches from Marco d'Itri for postfix 137 - patches from Marco d'Itri for postfix
88 138
89 * Thu Jun 12 2008 Carl Byington <carl@five-ten-sg.com> - 1.7-1 139 * Thu Jun 12 2008 Carl Byington <carl@five-ten-sg.com> - 1.7-1
90 - Fedora 9 compile and const correctness. 140 - Fedora 9 compile and const correctness.