Accepting request 828436 from home:kukuk:container
- Use sysusers.d to create system accounts - Remove wrong %config for systemd directory content OBS-URL: https://build.opensuse.org/request/show/828436 OBS-URL: https://build.opensuse.org/package/show/server:mail/postfix?expand=0&rev=383
This commit is contained in:
parent
5b2b84fcec
commit
3e9d059e37
6
postfix-user.conf
Normal file
6
postfix-user.conf
Normal file
@ -0,0 +1,6 @@
|
||||
# Type Name ID GECOS [HOME]
|
||||
g maildrop 59 - -
|
||||
g postfix 51 - -
|
||||
u postfix 51 "Postfix Daemon" /var/spool/postfix
|
||||
m postfix maildrop
|
||||
m postfix mail
|
3
postfix-vmail-user.conf
Normal file
3
postfix-vmail-user.conf
Normal file
@ -0,0 +1,3 @@
|
||||
# Type Name ID GECOS [HOME]
|
||||
g vmail - - -
|
||||
u vmail - "Virtual Mail User" /srv/maildirs
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 21 08:44:22 UTC 2020 - Thorsten Kukuk <kukuk@suse.com>
|
||||
|
||||
- Use sysusers.d to create system accounts
|
||||
- Remove wrong %config for systemd directory content
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Aug 9 06:55:01 UTC 2020 - Arjen de Korte <suse+build@de-korte.org>
|
||||
|
||||
|
62
postfix.spec
62
postfix.spec
@ -31,15 +31,17 @@
|
||||
%define pf_html_directory %{_docdir}/%{name}-doc/html
|
||||
%define pf_sample_directory %{_docdir}/%{name}-doc/samples
|
||||
%define pf_data_directory %{_localstatedir}/lib/%{name}
|
||||
%if 0%{?suse_version} < 1330
|
||||
%define pf_uid 51
|
||||
%define pf_gid 51
|
||||
%define maildrop_gid 59
|
||||
%define mail_group mail
|
||||
%define vmusr vmail
|
||||
%define vmgid 303
|
||||
%define vmid 303
|
||||
%define vmdir /srv/maildirs
|
||||
%endif
|
||||
%define mail_group mail
|
||||
%define conf_backup_dir %{_localstatedir}/adm/backup/%{name}
|
||||
%define vmusr vmail
|
||||
%define vmgid 303
|
||||
%define vmid 303
|
||||
%define vmdir /srv/maildirs
|
||||
%define unitdir %{_prefix}/lib/systemd
|
||||
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
||||
%if ! %{defined _fillupdir}
|
||||
@ -67,6 +69,8 @@ Source3: %{name}-mysql.tar.bz2
|
||||
Source4: postfix.keyring
|
||||
Source10: %{name}-rpmlintrc
|
||||
Source11: check_mail_queue
|
||||
Source12: postfix-user.conf
|
||||
Source13: postfix-vmail-user.conf
|
||||
Patch1: %{name}-no-md5.patch
|
||||
Patch2: pointer_to_literals.patch
|
||||
Patch3: ipv6_disabled.patch
|
||||
@ -97,7 +101,6 @@ Requires: iproute2
|
||||
Requires(post): permissions
|
||||
Requires(pre): %fillup_prereq
|
||||
Requires(pre): permissions
|
||||
Requires(pre): shadow
|
||||
Conflicts: exim
|
||||
Conflicts: sendmail
|
||||
Provides: smtp_daemon
|
||||
@ -109,9 +112,13 @@ BuildRequires: lmdb-devel
|
||||
BuildRequires: libnsl-devel
|
||||
%endif
|
||||
%if 0%{?suse_version} >= 1330
|
||||
BuildRequires: sysuser-tools
|
||||
Requires: system-user-nobody
|
||||
Requires: group(%{mail_group})
|
||||
Requires(pre): group(%{mail_group})
|
||||
%sysusers_requires
|
||||
%else
|
||||
Requires(pre): shadow
|
||||
%endif
|
||||
|
||||
%description
|
||||
@ -138,7 +145,11 @@ This package contains the documentation for %{name}
|
||||
Summary: Postfix plugin to support MySQL maps
|
||||
Group: Productivity/Networking/Email/Servers
|
||||
Requires(pre): %{name} = %{version}
|
||||
%if 0%{?suse_version} >= 1330
|
||||
%sysusers_requires
|
||||
%else
|
||||
Requires(pre): shadow
|
||||
%endif
|
||||
|
||||
%description mysql
|
||||
Postfix plugin to support MySQL maps. This library will be loaded by
|
||||
@ -240,13 +251,14 @@ make makefiles pie=yes shared=yes dynamicmaps=yes \
|
||||
config_directory=%{_sysconfdir}/%{name} \
|
||||
SHLIB_RPATH="-Wl,-rpath,%{pf_shlib_directory} -Wl,-z,relro,-z,now"
|
||||
make %{?_smp_mflags}
|
||||
%if 0%{?suse_version} >= 1330
|
||||
# Create postfix user
|
||||
%sysusers_generate_pre %{SOURCE12} postfix
|
||||
%sysusers_generate_pre %{SOURCE13} vmail
|
||||
%endif
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
%install
|
||||
groupadd -g %{pf_gid} -o -r %{name} 2> /dev/null || :
|
||||
groupadd -g %{maildrop_gid} -o -r maildrop 2> /dev/null || :
|
||||
useradd -r -o -g %{name} -u %{pf_uid} -s /bin/false -c "Postfix Daemon" -d /%{pf_queue_directory} %{name} 2> /dev/null || :
|
||||
usermod -a -G %{maildrop_gid},%{mail_group} %{name} 2> /dev/null || :
|
||||
mkdir -p %{buildroot}/%{_libdir}
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
|
||||
cp conf/* %{buildroot}%{_sysconfdir}/%{name}
|
||||
@ -378,8 +390,22 @@ do
|
||||
done
|
||||
# ---------------------------------------------------------------------------
|
||||
install -m 755 %{SOURCE11} %{buildroot}%{_sbindir}/
|
||||
%if 0%{?suse_version} >= 1330
|
||||
mkdir -p %{buildroot}%{_sysusersdir}
|
||||
install -m 644 %{SOURCE12} %{buildroot}%{_sysusersdir}/
|
||||
install -m 644 %{SOURCE13} %{buildroot}%{_sysusersdir}/
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version} >= 1330
|
||||
%pre -f postfix.pre
|
||||
%else
|
||||
%pre
|
||||
getent group %{name} >/dev/null || groupadd -g %{pf_gid} -o -r %{name}
|
||||
getent group maildrop >/dev/null || groupadd -g %{maildrop_gid} -o -r maildrop
|
||||
getent passwd %{name} >/dev/null || useradd -r -o -g %{name} -u %{pf_uid} -s /bin/false -c "Postfix Daemon" -d /%{pf_queue_directory} %{name}
|
||||
usermod -a -G %{maildrop_gid},%{mail_group} %{name}
|
||||
%endif
|
||||
|
||||
%service_add_pre %{name}.service
|
||||
|
||||
VERSIONTEST=$(test -x usr/sbin/postconf && usr/sbin/postconf proxy_read_maps 2>/dev/null || :)
|
||||
@ -390,12 +416,11 @@ if [ -z "$VERSIONTEST" -a -f %{pf_queue_directory}/pid/master.pid ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
getent group %{name} >/dev/null || groupadd -g %{pf_gid} -o -r %{name}
|
||||
getent group maildrop >/dev/null || groupadd -g %{maildrop_gid} -o -r maildrop
|
||||
getent passwd %{name} >/dev/null || useradd -r -o -g %{name} -u %{pf_uid} -s /bin/false -c "Postfix Daemon" -d /%{pf_queue_directory} %{name}
|
||||
usermod -a -G %{maildrop_gid},%{mail_group} %{name}
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
%if 0%{?suse_version} >= 1330
|
||||
%pre mysql -f vmail.pre
|
||||
%else
|
||||
%pre mysql
|
||||
#echo "PARAM_pre: "$1
|
||||
# on `rpm -ivh` PARAM is 1
|
||||
@ -409,6 +434,7 @@ if [ "$1" = "1" ]; then
|
||||
useradd -c "maildirs chef" -d %{vmdir} -g %{vmusr} -u %{vmid} -r -s /bin/false %{vmusr}
|
||||
fi
|
||||
fi
|
||||
%endif
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
%preun
|
||||
@ -543,7 +569,7 @@ fi
|
||||
%dir %{_sysconfdir}/%{name}/ssl/certs
|
||||
%{_sysconfdir}/%{name}/ssl/cacerts
|
||||
%dir %{pf_shlib_directory}/systemd
|
||||
%config %attr(0755,root,root) %{pf_shlib_directory}/systemd/*
|
||||
%attr(0755,root,root) %{pf_shlib_directory}/systemd/*
|
||||
%{_unitdir}/%{name}.service
|
||||
%verify(not mode) %attr(2755,root,%{pf_setgid_group}) %{_sbindir}/postdrop
|
||||
%verify(not mode) %attr(2755,root,%{pf_setgid_group}) %{_sbindir}/postqueue
|
||||
@ -598,6 +624,9 @@ fi
|
||||
%dir %attr(0700,%{name},root) /%{pf_queue_directory}/trace
|
||||
%dir %attr(0730,%{name},maildrop) /%{pf_queue_directory}/maildrop
|
||||
%dir %attr(0710,%{name},maildrop) /%{pf_queue_directory}/public
|
||||
%if 0%{?suse_version} >= 1330
|
||||
%{_sysusersdir}/postfix-user.conf
|
||||
%endif
|
||||
|
||||
%files devel
|
||||
%{_includedir}/%{name}/
|
||||
@ -611,6 +640,9 @@ fi
|
||||
%config(noreplace) %attr(640, root, %{name}) %{_sysconfdir}/%{name}/*_maps.cf
|
||||
%config(noreplace) %{_sysconfdir}/%{name}/main.cf-mysql
|
||||
%{pf_shlib_directory}/%{name}-mysql.so
|
||||
%if 0%{?suse_version} >= 1330
|
||||
%{_sysusersdir}/postfix-vmail-user.conf
|
||||
%endif
|
||||
|
||||
%files postgresql
|
||||
%{pf_shlib_directory}/%{name}-pgsql.so
|
||||
|
Loading…
Reference in New Issue
Block a user