##%define initdir /etc/rc.d/init.d

Summary: The NIS (Network Information Service) server.
Summary(ja): NIS (Network Information Service) サーバ
Name: ypserv
Version: 4.1
Release: 1%{_dist_release}
License: GPLv2
Group: System Environment/Daemons
URL: https://github.com/thkukuk/ypserv
Source0: https://github.com/thkukuk/ypserv/releases/download/v%{version}/ypserv-%{version}.tar.xz
Source1: ypserv-ypserv.init
Source2: ypserv-yppasswdd.init
Source3: ypserv-ypxfrd.init

Patch0: ypserv-2.5-redhat.patch
Patch2: ypserv-2.5-nfsnobody2.patch
Patch3: ypserv-2.13-ypxfr-zeroresp.patch
Patch4: ypserv-2.13-nonedomain.patch
Patch5: ypserv-2.19-slp-warning.patch
Patch6: ypserv-4.0-manfix.patch
Patch7: ypserv-2.24-aliases.patch
Patch8: ypserv-2.27-confpost.patch
Patch10: ypserv-2.31-netgrprecur.patch
Patch12: ypserv-4.0-headers.patch

Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: gdbm-devel
BuildRequires: libxcrypt-devel
BuildRequires: libnsl2-devel
BuildRequires: libtirpc-devel
Requires: gawk portmap tcp_wrappers bash gdbm
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig /sbin/service
Requires(postun): /sbin/service
Obsoletes: yppasswd

Vendor: Project Vine
Distribution: Vine Linux

%description
The Network Information Service (NIS) is a system which provides
network information (login names, passwords, home directories, group
information) to all of the machines on a network.  NIS can enable
users to login on any machine on the network, as long as the machine
has the NIS client programs running and the user's password is
recorded in the NIS passwd database.  NIS was formerly known as Sun
Yellow Pages (YP).

This package provides the NIS server, which will need to be running on
your network.  NIS clients do not need to be running the server.

Install ypserv if you need an NIS server for your network.  You'll
also need to install the yp-tools and ypbind packages onto any NIS
client machines.

%description -l ja
Network Information Service (NIS) とは各種ネットワーク情報
(ログイン名，パスワード，ホームディレクトリ，グループ情報等) を
ネットワーク上の全マシンに提供する為のシステムです．
NIS を使うと，そのユーザのパスワードが NIS データベースに登録されて
さえいれば，NIS クライアントが動作しているどのマシンからでも
ログインすることが出来ます．NIS はかつて Sun Yellow Pages (YP) と
して広く知られていました．

このパッケージは NIS サーバを提供します．NIS サーバは
NIS サービスを利用する際ネットワーク上に必ず稼働していなければなりません．
NIS クライアント機上で動作する必要はありません．

ネットワーク上に NIS サーバが必要な場合，この ypserv パッケージを
インストールして下さい．同時に NIS クライアント機に yp-tools と
ypbind パッケージをインストールする必要があります．


%prep
%setup -q
%patch0 -p1 -b .redhat
%patch2 -p1 -b .nfsnobody
%patch3 -p1 -b .respzero
%patch4 -p1 -b .nonedomain
%patch5 -p1 -b .slp-warning
%patch6 -p1 -b .manfix
%patch7 -p1 -b .aliases
%patch8 -p1 -b .confpost
%patch10 -p1 -b .netgrprecur
%patch12  -b .headers

autoreconf -vif

%build
cp etc/README etc/README.etc
export CFLAGS="$RPM_OPT_FLAGS -fpic"
%configure \
	--enable-checkroot \
	--enable-fqdn \
	--enable-yppasswd \
	--libexecdir=%{_libdir}/yp \
    --localstatedir=%{_localstatedir}

make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=%{buildroot}

mkdir -p $RPM_BUILD_ROOT%{_initdir}
install -m644 etc/ypserv.conf $RPM_BUILD_ROOT%{_sysconfdir}
install -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_initdir}/ypserv
install -m755 %{SOURCE2} $RPM_BUILD_ROOT%{_initdir}/yppasswdd
install -m755 %{SOURCE3} $RPM_BUILD_ROOT%{_initdir}/ypxfrd

mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
cat > $RPM_BUILD_ROOT/etc/sysconfig/yppasswdd <<EOF
# The passwd and shadow files are located under the specified
# directory path. rpc.yppasswdd will use these files, not /etc/passwd
# and /etc/shadow.
#ETCDIR=/etc

# This options tells rpc.yppasswdd to use a different source file
# instead of /etc/passwd
# You can't mix usage of this with ETCDIR
#PASSWDFILE=/etc/passwd

# This  options  tells rpc.yppasswdd to use a different source file
# instead of /etc/passwd. 
# You can't mix usage of this with ETCDIR
#SHADOWFILE=/etc/shadow

# Additional arguments passed to yppasswd
YPPASSWDD_ARGS=
EOF

%clean
rm -rf $RPM_BUILD_ROOT

%post
/sbin/chkconfig --add ypserv
/sbin/chkconfig --add yppasswdd
/sbin/chkconfig --add ypxfrd

%triggerpostun -- yppasswd
/sbin/chkconfig --add yppasswdd

%preun
if [ $1 = 0 ]; then
	/sbin/service ypserv stop > /dev/null 2>&1
	/sbin/chkconfig --del ypserv
	/sbin/service yppasswdd stop > /dev/null 2>&1
	/sbin/chkconfig --del yppasswdd
	/sbin/service ypxfrd stop > /dev/null 2>&1
	/sbin/chkconfig --del ypxfrd
fi

%postun
if [ "$1" -ge "1" ]; then
	/sbin/service ypserv condrestart > /dev/null 2>&1
	/sbin/service yppasswdd condrestart > /dev/null 2>&1
	/sbin/service ypxfrd condrestart > /dev/null 2>&1
fi
exit 0

 
%files
%defattr(-,root,root)
%license COPYING
%doc AUTHORS README INSTALL ChangeLog TODO NEWS
%doc etc/ypserv.conf etc/securenets etc/README.etc
%doc etc/netgroup etc/locale etc/netmasks etc/timezone
%config(noreplace) %{_sysconfdir}/ypserv.conf
%config(noreplace) %{_sysconfdir}/sysconfig/yppasswdd
%config(noreplace) /var/yp/*
%dir /var/yp
%config %{initdir}/*
%{_libdir}/yp
%{_sbindir}/*
%{_mandir}/*/*
%{_includedir}/*/*

%changelog
* Mon May 13 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 4.1-1
- new upstream release.
- dropped all patches.
- imported patches from rawhide.

* Sat Dec 28 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.19-5
- rebuild with VineSeed environment

* Sun Dec  6 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 2.19-4 
- added Patches from Fedora
  * Tue Mar  3 2009 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.19-12
  - Mark apropriate config files as noreplace
  * Thu Sep 25 2008 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.19-10
  - Rediff all patches to work with patch --fuzz=0
  * Wed Feb 13 2008 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.19-9
  - Mark /var/yp/Makefile as %%config(noreplace)
    Resolves: #432582
  - Comment "slp" part of ypserv.conf to avoid ypserv warnings
    Resolves: #154806
  - Spec file cleanup - remove period from end of Summary,
    fix license, remove macros from Changelog
  * Mon Feb  4 2008 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.19-8
  - Fix Buildroot
  - Fix /var/yp/Makefile
    Resolves: #431008
  * Tue Jan  8 2008 Steve Dickson <steved@redhat.com> 2.19-7
  - Changed Makefiles.in so binaries are not stripped.
  * Sat Sep 15 2007 Steve Dickson <steved@redhat.com> 2.19-6
  - Fixed init scripts to return correct exit code on
   'service status' (bz 248097)
  * Tue Jul 31 2007 Steve Dickson <steved@redhat.com> 2.19-5
  - Changed install process to create an useful debuginfo package (bz 249961)
  * Fri Dec 22 2006 Steve Dickson <steved@redhat.com> - 2.19-4
  - Made ypserver less verbose on common errors (bz #199236)
  - Don't allow a make for empty domainname's or domainname's set to (none)
    (bz #197646)
  * Wed Sep 13 2006 Steve Dickson <steved@redhat.com> - 2.19-3
  - Added range checks to port values given on command line 
    (bz 205354)
  * Tue Jul 25 2006 Steve Dickson <steved@redhat.com> - 2.19-2
  - fixed typo in ypxfrd initscript (bz 185403)

* Mon May  4 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.19-3
- spec in UTF-8

* Sun Apr 20 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.19-2
- rebuilt without openslp-devel

* Thu Apr 10 2008 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 2.19-1
- new upstream release.

* Sun May 21 2006 NAKAMURA Kenta <kenta@vinelinux.org> 2.18-0vl2
- use License instead of Copyright

* Tue Sep  6 2005 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 2.18-0vl1
- new upstream release.

* Sun Jun 20 2004 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 2.13-0vl1
- new upstream release.
- remove patch2 (no longer needed).

* Fri Apr  9 2004 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 2.12.1-0vl1
- new upstream release.
- replace patch3.

* Mon Dec  8 2003 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 2.9-0vl1
- add gdbm[-devel] to 'Requires:' / 'BuildPreReq:'.
- new upstream release.

* Mon May 19 2003 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 2.8-1vl1
- new upstream release.

* Fri Feb  7 2003 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 2.7-1vl1
- updated ypserv-2.7

* Fri Dec 13 2002 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 2.5-1vl3
- rebuild with new toolchain.

* Tue Oct 22 2002 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 2.5-1vl2
- updated ypserv-2.5
- merge patches from RedHat-8.0.
- add some files to %%doc.

* Thu Jun 06 2002 Satoshi MACHINO <machino@vinelinux.org> 2.2-10-0vl1
- updated ypserv-2.2
- fixed patches
	-- merged Rawhide's ypserv-2.2-10
	
* Mon Jan 08 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 1.3.11-9vl1
- based on 1.3.11-9 from Rawhide
- %%{initdir} -> %%{_initdir}
- added Japanese summary and description

* Wed Aug 16 2000 Than Ngo <than@redhat.com>
- fix typo in startup script (Bug #15999)

* Wed Jul 19 2000 Than Ngo <than@redhat.de>
- inits back to rc.d/init.d, using service
- fix initscript again

* Mon Jul 17 2000 Bill Nottingham <notting@redhat.com>
- move initscript back
- fix format syslog bug

* Thu Jul 13 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Fri Jul  7 2000 Florian La Roche <Florian.LaRoche@redhat.de>
- prereq /etc/init.d

* Tue Jun 27 2000 Than Ngo <than@redhat.de>
- /etc/rc.d/init.d -> /etc/init.d
- fix initscript

* Sun Jun 18 2000 Than Ngo <than@redhat.de>
- FHS fixes,
- fix docdir

* Fri May 19 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- disable "netgrp" target in default all: (/var/yp/Makefile)

* Thu May 18 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- update to 1.3.11

* Mon Mar 06 2000 Cristian Gafton <gafton@redhat.com>
- add patch to avoid potential deadlock on the server (fix #9968)

* Wed Feb  2 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- fix typo in %triggerpostun

* Mon Oct 25 1999 Bill Nottingham <notting@redhat.com>
- update to 1.3.9
- use gdbm, move back to /usr/sbin

* Tue Aug 17 1999 Bill Nottingham <notting@redhat.com>
- initscript munging
- ypserv goes on root partition

* Fri Aug 13 1999 Cristian Gafton <gafton@redhat.com>
- version 1.3.7

* Thu Jul  1 1999 Bill Nottingham <notting@redhat.com>
- start after network FS

* Tue Jun  1 1999 Jeff Johnson <jbj@redhat.com>
- update to 1.3.6.94.

* Sun May 30 1999 Jeff Johnson <jbj@redhat.com>
- improved daemonization.

* Sat May 29 1999 Jeff Johnson <jbj@redhat.com>
- fix buffer overflow in rpc.yppasswd (#3126).

* Fri May 28 1999 Jeff Johnson <jbj@redhat.com>
- update to 1.3.6.92.

* Fri Mar 26 1999 Cristian Gafton <gafton@redhat.com>
- version 1.3.6.91

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 4)

* Mon Feb  8 1999 Bill Nottingham <notting@redhat.com>
- move to start before ypbind

* Thu Dec 17 1998 Cristian Gafton <gafton@redhat.com>
- build for glibc 2.1
- upgraded to 1.3.5

* Tue Aug  4 1998 Jeff Johnson <jbj@redhat.com>
- yppasswd.init: lock file must have same name as init.d script, not daemon

* Sat Jul 11 1998 Cristian Gafton <gafton@redhat.com>
- upgraded to 1.3.4
- fixed the fubared Makefile
- link against gdbm instead of ndbm (it seems to work better)

* Sat May 02 1998 Cristian Gafton <gafton@redhat.com>
- upgraded to 1.3.1
- enhanced init scripts

* Fri May 01 1998 Jeff Johnson <jbj@redhat.com>
- added triggerpostun
- Use libdb fro dbp_*().

* Fri Apr 24 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Mon Apr 13 1998 Cristian Gafton <gafton@redhat.com>
- updated to 1.3.0

* Wed Dec 03 1997 Cristian Gafton <gafton@redhat.com>
- updated to 1.2.5
- added buildroot; updated spec file
- added yppasswdd init file

* Tue Nov 04 1997 Erik Troan <ewt@redhat.com>
- init script shouldn't set the domain name

* Tue Oct 14 1997 Erik Troan <ewt@redhat.com>
- supports chkconfig
- updated initscript for status and restart
- turned off in all runlevels, by default
- removed postinstall script which didn't do anything

* Thu Oct 09 1997 Erik Troan <ewt@redhat.com>
- added patch to build against later glibc

* Mon Jul 21 1997 Erik Troan <ewt@redhat.com>
- built against glibc

* Wed Apr 23 1997 Erik Troan <ewt@redhat.com>
- updated to 1.1.7.

* Fri Mar 14 1997 Erik Troan <ewt@redhat.com>
- Updated to ypserv 1.1.5, ported to Alpha (glibc).

* Fri Mar 07 1997 Erik Troan <ewt@redhat.com>
- Removed -pedantic which confuses the SPARC :-(
