install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/{rc.d/init.d,sysconfig}} \
$RPM_BUILD_ROOT/var/{lib/pgsql,log} \
$RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} \
- $RPM_BUILD_ROOT%{_mandir} \
- $RPM_BUILD_ROOT/home/services/postgres
+ $RPM_BUILD_ROOT%{_mandir}
install src/tutorial/*.sql $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
/usr/sbin/usermod -d /home/services/postgres postgres
fi
+%triggerpostun -- %{name} < 10.2-2
+if [ -n "`/bin/id -u postgres 2>/dev/null`" ]; then
+ /usr/sbin/usermod -d /var/lib/pgsql postgres
+fi
+
%post
/sbin/chkconfig --add postgresql10
%service postgresql10 restart "postgresql10 server"
%pre -n postgresql-common
%groupadd -g 88 -r postgres
-%useradd -M -o -r -u 88 -d /home/services/postgres -s /bin/sh -g postgres -c "PostgreSQL Server" postgres
+%useradd -M -o -r -u 88 -d /var/lib/pgsql -s /bin/sh -g postgres -c "PostgreSQL Server" postgres
%post clients
update-alternatives \
%dir %{pgsqldatadir}/contrib
-%attr(700,postgres,postgres) /home/services/postgres
-%attr(700,postgres,postgres) %dir /var/lib/pgsql
%attr(640,postgres,postgres) %config(noreplace) %verify(not md5 mtime size) /var/log/pgsql
%{pgsqldatadir}/man/man1/initdb.1*
%defattr(644,root,root,755)
%dir %{_libdir}/postgresql
%dir %{_datadir}/postgresql
+%attr(700,postgres,postgres) %dir /var/lib/pgsql
%files dirs
%defattr(644,root,root,755)