- Refreshed spec-file via spec-cleaner and manual optimization.

* Removed file dovecot.init (droped SystemV support).
  * Added parameter -p to all install command in spec-file.
  * Added %{name} macro wherever possible.

OBS-URL: https://build.opensuse.org/package/show/server:mail/dovecot?expand=0&rev=23
This commit is contained in:
Peter Varkoly 2021-04-21 14:08:31 +00:00 committed by Git OBS Bridge
parent ea7d0a91bd
commit 0db101c419
2 changed files with 38 additions and 63 deletions

View File

@ -5,6 +5,14 @@ Wed Apr 21 11:50:25 UTC 2021 - Peter Varkoly <varkoly@suse.com>
deprecated, please use /run instead deprecated, please use /run instead
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Apr 16 10:58:13 UTC 2021 - Илья Индиго <ilya@ilya.pp.ua>
- Refreshed spec-file via spec-cleaner and manual optimization.
* Removed file dovecot.init (droped SystemV support).
* Added parameter -p to all install command in spec-file.
* Added %{name} macro wherever possible.
-------------------------------------------------------------------
Wed Apr 21 11:50:25 UTC 2021 - Peter Varkoly <varkoly@suse.com>
Fri Nov 13 14:11:59 UTC 2020 - Thorsten Kukuk <kukuk@suse.com> Fri Nov 13 14:11:59 UTC 2020 - Thorsten Kukuk <kukuk@suse.com>
- Check first if they exist before creating user and group accounts - Check first if they exist before creating user and group accounts

View File

@ -16,12 +16,6 @@
# #
%if 0%{?suse_version} > 1230
%bcond_without systemd
%else
%bcond_with systemd
%endif
Name: dovecot Name: dovecot
Version: 2.3 Version: 2.3
Release: 0 Release: 0
@ -31,23 +25,22 @@ Group: Productivity/Networking/Email/Servers
URL: http://www.dovecot.org/ URL: http://www.dovecot.org/
PreReq: dovecot-implementation PreReq: dovecot-implementation
PreReq: shadow PreReq: shadow
Recommends: dovecot23 Recommends: %{name}23
#!BuildIgnore: dovecot-implementation #!BuildIgnore: dovecot-implementation
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch BuildArch: noarch
Source0: dovecot-2.0.configfiles Source0: %{name}-2.0.configfiles
Source1: dovecot-2.1.configfiles Source1: %{name}-2.1.configfiles
Source2: dovecot-2.2.configfiles Source2: %{name}-2.2.configfiles
Source3: %{name}.init
Source4: %{name}.pam Source4: %{name}.pam
Source5: %{name}.README.SUSE Source5: %{name}.README.SUSE
Source7: dovecot.tmpfiles.d Source7: %{name}.tmpfiles.d
Source8: dovecot.service Source8: %{name}.service
Source9: dovecot.socket Source9: %{name}.socket
Source10: dovecot-2.1-pigeonhole.configfiles Source10: %{name}-2.1-pigeonhole.configfiles
Source11: dovecot-2.2-pigeonhole.configfiles Source11: %{name}-2.2-pigeonhole.configfiles
Source12: dovecot-2.3.configfiles Source12: %{name}-2.3.configfiles
Source13: dovecot-2.3-pigeonhole.configfiles Source13: %{name}-2.3-pigeonhole.configfiles
%description %description
Dovecot is an IMAP and POP3 server for Linux and UNIX-like systems, Dovecot is an IMAP and POP3 server for Linux and UNIX-like systems,
@ -73,87 +66,61 @@ for i in $RPM_SOURCE_DIR/*.configfiles ; do
done done
done done
install -D -m 0644 %{S:5} %{buildroot}%{_datadir}/doc/packages/dovecot/README.SUSE install -D -p -m 0644 %{S:5} %{buildroot}%{_datadir}/doc/packages/%{name}/README.SUSE
install -d %{buildroot}%{_sbindir} install -d %{buildroot}%{_sbindir}
# install the init script %{__install} -D -m 644 %{S:7} %{buildroot}/usr/lib/tmpfiles.d/%{name}.conf
%if %{with systemd}
%{__install} -D -m 644 %{S:7} %{buildroot}/usr/lib/tmpfiles.d/dovecot.conf
%{__ln_s} -f %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name} %{__ln_s} -f %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
install -D -m 0644 %{S:8} %{buildroot}%{_unitdir}/dovecot.service install -D -p -m 0644 %{S:8} %{buildroot}%{_unitdir}/%{name}.service
install -D -m 0644 %{S:9} %{buildroot}%{_unitdir}/dovecot.socket install -D -p -m 0644 %{S:9} %{buildroot}%{_unitdir}/%{name}.socket
%else
%{__install} -D -m 0755 %{S:3} %{buildroot}%{_sysconfdir}/init.d/%{name}
%{__ln_s} -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
%endif
# install pam config # install pam config
%{__install} -D -m 0644 %{S:4} %{buildroot}%{_sysconfdir}/pam.d/%{name} %{__install} -D -p -m 0644 %{S:4} %{buildroot}%{_sysconfdir}/pam.d/%{name}
# create /var directories # create /var directories
%{__install} -m 0755 -Dd \ %{__install} -p -m 0755 -Dd \
%{buildroot}%{_var}/run/%{name}/login/ \ %{buildroot}%{_var}/run/%{name}/login/ \
%{buildroot}%{_var}/lib/%{name}/ %{buildroot}%{_var}/lib/%{name}/
%pre %pre
getent group %{name} > /dev/null || /usr/sbin/groupadd -r %{name} >/dev/null 2>&1 || : getent group %{name} > /dev/null || /usr/sbin/groupadd -r %{name} >/dev/null 2>&1 || :
getent passwd %{name} > /dev/null || /usr/sbin/useradd -g %{name} -s /bin/false -r -c "User for Dovecot imapd" -d %{_var}/run/%{name} %{name} >/dev/null 2>&1 || : getent passwd %{name} > /dev/null || /usr/sbin/useradd -g %{name} -s /bin/false -r -c "User for Dovecot imapd" -d %{_var}/run/%{name} %{name}
getent passwd dovenull > /dev/null || /usr/sbin/useradd -g %{name} -s /bin/false -r -c "User for Dovecot login" -d %{_var}/run/%{name} dovenull >/dev/null 2>&1 || : getent passwd dovenull > /dev/null || /usr/sbin/useradd -g %{name} -s /bin/false -r -c "User for Dovecot login" -d %{_var}/run/%{name} dovenull
# try to copy the default configuration. # try to copy the default configuration.
# #
# we fail silently if the dovecot-implementation package is not # we fail silently if the dovecot-implementation package is not
# installed yet. This allows us to break a little build loop between # installed yet. This allows us to break a little build loop between
# dovecot and dovecotXY. # dovecot and dovecotXY.
if [ ! -e %{_sysconfdir}/%{name}/dovecot.conf -a -e %{_datadir}/%{name}/example-config/dovecot.conf ] ; then if [ ! -e %{_sysconfdir}/%{name}/%{name}.conf -a -e %{_datadir}/%{name}/example-config/%{name}.conf ] ; then
# install default config # install default config
echo "Did not find a /etc/dovecot/dovecot.conf. copying default configuration" echo "Did not find a /etc/dovecot/dovecot.conf. copying default configuration"
cp -na %{_datadir}/%{name}/example-config/* %{_sysconfdir}/%{name}/ cp -na %{_datadir}/%{name}/example-config/* %{_sysconfdir}/%{name}/
# the chmod breaks the lda. lets use the more open permissions # the chmod breaks the lda. lets use the more open permissions
#chmod -Rv o= %{_sysconfdir}/%{name}/ #chmod -Rv o= %{_sysconfdir}/%{name}/
fi fi
%if %{with systemd}
%service_add_pre %{name}.service %{name}.socket %service_add_pre %{name}.service %{name}.socket
%endif
%preun %preun
%if %{with systemd}
%service_del_preun %{name}.service %{name}.socket %service_del_preun %{name}.service %{name}.socket
%else
%stop_on_removal %{name}
%endif
%if %{with systemd}
%post %post
%tmpfiles_create dovecot.conf %tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%service_add_post %{name}.service %{name}.socket %service_add_post %{name}.service %{name}.socket
%endif
%postun %postun
%if %{with systemd}
%service_del_postun %{name}.service %service_del_postun %{name}.service
%else
%restart_on_update %{name}
%insserv_cleanup
%endif
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%doc %{_datadir}/doc/packages/dovecot/ %doc %{_datadir}/doc/packages/%{name}/
# conf # conf
%dir /etc/dovecot/ %dir /etc/%{name}/
%ghost %config(noreplace) /etc/dovecot/* %ghost %config(noreplace) /etc/%{name}/*
%config(noreplace) %{_sysconfdir}/pam.d/%{name} %config(noreplace) %{_sysconfdir}/pam.d/%{name}
%{_sbindir}/rc%{name} %{_sbindir}/rc%{name}
%if %{with systemd} /usr/lib/tmpfiles.d/%{name}.conf
/usr/lib/tmpfiles.d/dovecot.conf %{_unitdir}/%{name}.service
%{_unitdir}/dovecot.service %{_unitdir}/%{name}.socket
%{_unitdir}/dovecot.socket %dir %{_localstatedir}/lib/%{name}
%else %ghost %dir /run/%{name}
%{_sysconfdir}/init.d/%{name} %ghost %dir /run/%{name}/login
%endif
# setting up permissions
%if ! %{with systemd}
%dir %attr(0755,root,root) %ghost %{_var}/run/%{name}/
%dir %attr(0750,root,%{name}) %ghost %{_var}/run/%{name}/login/
%endif
%dir %attr(0750,root,root) %{_var}/lib/%{name}/
%changelog %changelog