Fix sdb-chroot devices upgrade (#1592873)

Move common part to rpm define, use similar parts with different
parameter. Correct /dev/zero instead of missing /dev/dev.
This commit is contained in:
Petr Menšík 2018-08-13 15:05:22 +02:00
parent 35334375ff
commit e1f8ad2217

View File

@ -52,7 +52,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv
Name: bind
License: MPLv2.0
Version: 9.11.4
Release: 5%{?PATCHVER:.%{PATCHVER}}%{?PREVER:.%{PREVER}}%{?dist}
Release: 6%{?PATCHVER:.%{PATCHVER}}%{?PREVER:.%{PREVER}}%{?dist}
Epoch: 32
Url: http://www.isc.org/products/BIND/
#
@ -1019,17 +1019,21 @@ fi
%postun export-libs -p /sbin/ldconfig
%endif
# Fix permissions on existing device files on upgrade
%define chroot_fix_devices() \
if [ $1 -gt 1 ]; then \
for DEV in "%{1}/dev"/{null,random,zero}; do \
if [ -e "$DEV" -a "$(/bin/stat --printf="%G %a" "$DEV")" = "root 644" ]; \
then \
/bin/chmod 0664 "$DEV" \
/bin/chgrp named "$DEV" \
fi \
done \
fi
%post chroot
%systemd_post named-chroot.service
if [ $1 -gt 1 ]; then
# Fix permissions on existing device files on upgrade
for DEV in "%{chroot_prefix}/dev"/{null,random,dev}; do
if [ -e "$DEV" -a "$(stat --printf="%G %a" "$DEV")" = "root 644" ]; then
chmod 0664 "$DEV"
chgrp named "$DEV"
fi
done
fi
%chroot_fix_devices %{chroot_prefix}
:;
%posttrans chroot
@ -1052,15 +1056,7 @@ fi;
%post sdb-chroot
%systemd_post named-sdb-chroot.service
if [ $1 -gt 1 ]; then
# Fix permissions on existing device files on upgrade
for DEV in "%{chroot_prefix}/dev"/{null,random,dev}; do
if [ -e "$DEV" -a "$(stat --printf="%G %a" "$DEV")" = "root 644" ]; then
chmod 0664 "$DEV"
chgrp named "$DEV"
fi
done
fi
%chroot_fix_devices %{chroot_sdb_prefix}
:;
%posttrans sdb-chroot
@ -1409,6 +1405,9 @@ rm -rf ${RPM_BUILD_ROOT}
%changelog
* Mon Aug 13 2018 Petr Menšík <pemensik@redhat.com> - 32:9.11.4-6.P1
- Fix sdb-chroot devices upgrade (#1592873)
* Thu Aug 09 2018 Petr Menšík <pemensik@redhat.com> - 32:9.11.4-5.P1
- Update to 9.11.4-P1
- Adds root key sentinel support