Drop map rebuild (gdbm -> tokyocabinet) support

This commit is contained in:
Matej Muzila 2018-06-12 10:39:28 +02:00
parent c87625a1cb
commit 8d2a32a70e
1 changed files with 4 additions and 70 deletions

View File

@ -1,5 +1,3 @@
%global first_tc_version 2.29-2
%global commit0 5bfba760283060087aefeb417342bcc66d349b2e
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
@ -7,7 +5,7 @@ Summary: The NIS (Network Information Service) server
Url: http://www.linux-nis.org/nis/ypserv/index.html
Name: ypserv
Version: 4.0
Release: 8.20170331git%{shortcommit0}%{?dist}
Release: 9.20170331git%{shortcommit0}%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source0: https://github.com/thkukuk/%{name}/archive/%{commit0}.tar.gz#/%{name}-%{shortcommit0}.tar.gz
@ -160,73 +158,6 @@ install -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/rpc.yppasswdd.env
%systemd_postun_with_restart ypxfrd.service
%systemd_postun_with_restart yppasswdd.service
%if 0%{?fedora}>=18
# After switching from gdbm to Tokyo Cabinet we need to rebuild maps
# during update, but without pushing to slave servers
# In case domainname is not set, but it is defined in
# /etc/sysconfig/network, we do the same work as service yppasswdd
# do before starting.
# The original domainname value is set back in the end.
# The whole work is created before installing new ypserv, so we use old
# utilities and commands are stored into temporary file (that is necessary,
# because we cannot read old maps using new package)
# If old package used gdbm, the prepared script is executed after new package
# is installed.
%global rebuild_maps_script /var/yp/rpm_rebuild_maps
%pre
if [ $1 == 2 ] ; then
# stop ypserv if running and then start it again
ypservactive=0
if /usr/bin/systemctl is-active ypserv.service>/dev/null 2>&1 ; then
ypservactive=1
/usr/bin/systemctl stop ypserv.service>/dev/null 2>&1
fi
# store old domainname and set the correct one
olddomain=`domainname`
[ -f /etc/sysconfig/network ] $$ . /etc/sysconfig/network
DOMAINNAME=`domainname`
if [ "$olddomain" = "(none)" -o "x$olddomain" = "x" ]; then
if [ -n "$NISDOMAIN" ]; then
domainname $NISDOMAIN
fi
fi
newdomain=`domainname`
if [ "$newdomain" != "(none)" -a "x$newdomain" != "x" ]; then
pushd "/var/yp/$newdomain">/dev/null
echo "" > %rebuild_maps_script
chmod 0600 %rebuild_maps_script
# loop through maps
for map in * ; do
# this server is a master for this map
if %{_libdir}/yp/yphelper -i "$map" >/dev/null 2>&1 ; then
echo "rm -f `pwd`/$map" >> %rebuild_maps_script
# this server is a slave for this map
else
master=`%{_libdir}/yp/makedbm -u $map 2>/dev/null | grep YP_MASTER_NAME | sed -e 's/YP_MASTER_NAME//'`
if [ "x$master" != "x" ] ; then
echo "%{_libdir}/yp/ypxfr -f -h $master -c -d $newdomain $map" >> %rebuild_maps_script
fi
fi
done
echo "make NOPUSH=true -C /var/yp" >> %rebuild_maps_script
fi
/bin/domainname "$olddomain"
# if ypserv was running before, start it again
if [ $ypservactive -eq 1 ] ; then
/usr/bin/systemctl start ypserv.service>/dev/null 2>&1
fi
fi
%triggerpostun -- ypserv < %{first_tc_version}
if [ -e %rebuild_maps_script ] ; then
bash %rebuild_maps_script >/dev/null 2>&1 || :
rm -f %rebuild_maps_script >/dev/null 2>&1
fi
%endif
%files
%doc AUTHORS README INSTALL ChangeLog TODO NEWS COPYING
%doc etc/ypserv.conf etc/securenets etc/README.etc
@ -242,6 +173,9 @@ fi
%{_includedir}/rpcsvc
%changelog
* Tue Jun 12 2018 Matej Mužila <mmuzila@redhat.com> - 4.0-9.20170331git5bfba76
- Drop map rebuild (gdbm -> tokyocabinet) support
* Mon Jun 11 2018 Matej Mužila <mmuzila@redhat.com> - 4.0-8.20170331git5bfba76
- Clean spec