# # spec file for package dhcp (Version 3.1.3) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # norootforbuild Name: dhcp %define susefw2dir %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services %define omc_prefix /usr/share/omc %define omc_svcdir %{omc_prefix}/svcinfo.d %define with_casa 0%{?sles_version} >= 10 || 0%{?suse_version} >= 1110 %if 0%{?with_casa:%with_casa} BuildRequires: CASA-devel %endif BuildRequires: dos2unix openldap2-devel License: BSD3c Group: Productivity/Networking/Boot/Servers AutoReqProv: on Version: 3.1.3 Release: 1 Summary: Common Files Used by ISC DHCP Software Url: http://www.isc.org/isc/dhcp.html Source0: dhcp-%{version}.tar.bz2 #Source0: http://ftp.isc.org/isc/dhcp/dhcp-%{version}.tar.gz #Source1: http://ftp.isc.org/isc/dhcp/dhcp-%{version}.tar.gz.asc Source2: rc.dhcpd Source3: rc.dhcrelay Source11: sysconfig.dhcpd Source12: sysconfig.syslog-dhcpd Source14: sysconfig.dhcrelay Source15: dhcp.README Source16: dhcp.LIESMICH Source17: examples.tar.gz Source18: dhcp.README.upgrade Source19: dhcpsync Source20: dhcpsync.8 Source21: DDNS-howto.txt Source30: http://www.andrew.cmu.edu/~kevinm/dhcp/leasestate Source31: http://www.andrew.cmu.edu/~kevinm/dhcp/listlease Source32: http://www.andrew.cmu.edu/~kevinm/dhcp/clearip Source33: http://www.andrew.cmu.edu/~kevinm/dhcp/reset-ip Source40: http://www3.baylor.edu/~Jeff_Wilson/GiveAway/leases.awk Source41: http://www.suse.de/~poeml/dnscompr.py Source42: dhcpd.xml Source43: SuSEfirewall2.dhcp-server Source44: if-up.d.dhcpd-restart-hook Patch0: dhcp-3.1.1-paths.dif ## chroot patch by Ari Edelkind (see readme) ## and patch supplied by Patch1: dhcp-3.1.1-paranoia.dif Patch2: dhcp-3.1.1-omapi-test.c.dif Patch3: dhcp-3.1.1-man-includes.dif Patch4: dhcp-3.1.1-tmpfile.dif ## LDAP support for DHCP server ## patch lives here: http://www.suse.de/~mt/git/dhcp-ldap.git/ %define DHCPD_LDAP 1 %if %DHCPD_LDAP Patch10: dhcp-3.1.3-ldap-patch-mt-01.diff.bz2 %endif %if %{?suse_version:%suse_version}%{?!suse_version:99999} > 930 Patch30: dhcp-3.1.1-pie.dif %endif Patch40: dhcp-3.1.1-dhclient-exec-filedes.dif Patch41: dhcp-3.1.1-dhclient-send-hostname-rml.dif Patch42: dhcp-3.1.1-dhclient-use-script-cmdline.dif Patch50: dhcp-3.1.1-dhclient-conf.dif Patch51: dhcp-3.1.3-dhclient-conf.bnc516459.dif Patch60: dhcp-3.1.3-dhclient-script.dif Patch61: dhcp-3.1.3-dhclient-script.bnc555095.dif ## Obsoletes: dhcp-base Provides: dhcp-base:/usr/bin/omshell PreReq: /bin/touch /sbin/chkconfig sysconfig BuildRoot: %{_tmppath}/%{name}-%{version}-build %package server License: BSD3c Summary: ISC DHCP Server Group: Productivity/Networking/Boot/Servers Requires: net-tools dhcp PreReq: %insserv_prereq %fillup_prereq /bin/cat /bin/mkdir /bin/cp /usr/sbin/useradd Provides: dhcp_server dhcp:/usr/sbin/dhcpd AutoReqProv: on %package client License: BSD3c Summary: ISC DHCP Client Group: Productivity/Networking/Boot/Clients Requires: net-tools dhcp /usr/bin/host PreReq: %insserv_prereq %fillup_prereq /bin/cat /bin/mkdir /bin/cp Provides: dhcp_client dhclient Obsoletes: dhclient AutoReqProv: on %package relay License: BSD3c ; "http://www.isc.org/products/DHCP/dhcp-copyright.html: ..." Summary: DHCP Relay Agent Group: Productivity/Networking/Boot/Servers Requires: net-tools dhcp PreReq: %insserv_prereq %fillup_prereq /bin/cat /bin/mkdir /bin/cp Provides: dhcp_relay dhcrelay Obsoletes: dhcrelay AutoReqProv: on %package devel License: BSD3c ; "http://www.isc.org/products/DHCP/dhcp-copyright.html: ..." Summary: Header Files and Libraries for dhcpctl API Group: Development/Libraries/C and C++ Requires: dhcp = %{version} %if %ul_version >= 1 %define VENDOR UnitedLinux %else %define VENDOR SuSE %endif %description This package contains common files used by both the ISC DHCP server ("dhcp-server" package) and client ("dhcp-client"). Authors: -------- Ted Lemon %description server This package contains the ISC DHCP server. Please read the documentation in /usr/share/doc/packages/dhcp-server regarding configuration of the DHCP server. Authors: -------- Ted Lemon This package also contains software written by Kevin C. Miller and Jeff Wilson . %description client This is an alternative DHCP client, the ISC DHCP client for Linux. Like "dhcpcd" (the client that is installed by default), it can be used to configure the network setup. IP address, hostname, routing, nameserver, netmask, and broadcast can be dynamically assigned while booting the machine. It is configurable via the configuration file /etc/dhclient.conf and you can define your own 'hooks' to be used by the /sbin/dhclient-script (which is called by the daemon). Authors: -------- Ted Lemon %description relay This is the ISC DHCP relay agent. It can be used as a 'gateway' for DHCP messages across physical network segments. This is necessary because requests can be broadcast, and they will normally not be routed. %description devel This package contains all of the libraries and headers for developing with the Internet Software Consortium (ISC) dhcpctl API. Authors: -------- Ted Lemon %prep %setup -q -n %{name}-%{version} ## %patch0 -p0 %patch1 -p0 %patch2 -p0 %patch3 -p0 %patch4 -p0 %if %DHCPD_LDAP %patch10 -p1 %endif %if %{?suse_version:%suse_version}%{?!suse_version:99999} > 930 %patch30 -p0 %endif %patch40 -p0 %patch41 -p0 %patch42 -p0 %patch50 -p0 %patch51 -p0 %patch60 -p0 %patch61 -p0 ## find . -type f -name \*.cat\* -exec rm -f {} \; cp -p %{S:2} %{S:3} %{S:11} %{S:12} %{S:14} %{S:32} %{S:33} . for i in README LIESMICH; do sed 's/SuSE/%VENDOR/' $RPM_SOURCE_DIR/dhcp.$i > $i.%VENDOR done cp -p $RPM_SOURCE_DIR/dhcp.README.upgrade README.upgrade cp -p $RPM_SOURCE_DIR/DDNS-howto.txt . echo "exec /usr/bin/genDDNSkey \"$@\"" > genDDNSKey.sh tar xzf $RPM_SOURCE_DIR/examples.tar.gz dos2unix contrib/ms2isc/* %build export CFLAGS CFLAGS="$RPM_OPT_FLAGS -W -Wall -fno-strict-aliasing -Wno-unused -DLDAP_DEPRECATED -DUSE_SSL -DPARANOIA -DHAVE_INET_PTON -DHAVE_INET_NTOP" %if 0%{?with_casa:%with_casa} CFLAGS="$CFLAGS -DLDAP_CASA_AUTH" %endif # seems obsolete (redefined reports) => double check #%ifarch ia64 sparc64 alpha s390x ppc64 x86_64 # CFLAGS="$CFLAGS -DPTRSIZE_64BIT" #%endif %ifarch ppc ppc64 s390x # bugs 134590, 171532 CFLAGS="$CFLAGS -fsigned-char" %endif %if %{?suse_version:%suse_version}%{?!suse_version:99999} > 930 %ifarch ia64 sparc64 alpha s390x ppc64 x86_64 CFLAGS="$CFLAGS -fPIE" %else CFLAGS="$CFLAGS -fpie" %endif %endif export DEBUG_FLAGS=$CFLAGS ./configure # first, build binaries which use bsd sockets instead of lpf cp includes/site.h includes/site.h.save.lpf echo "#define USE_SOCKETS" >> includes/site.h make DEBUG="$DEBUG_FLAGS -W" all cp -p work.linux-2.2/server/dhcpd work.linux-2.2/server/dhcpd.bsd make clean # then, build the normal binaries using lpf mv includes/site.h.save.lpf includes/site.h make DEBUG="$DEBUG_FLAGS -W" all # with a minimal config, see if it runs echo "ddns-update-style interim;" > testconf work.linux-2.2/server/dhcpd -t -cf testconf || exit 1 %install MANDIR=%{_mandir} DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_libdir} make install install -m 744 work.linux-2.2/omapip/svtest $RPM_BUILD_ROOT/usr/sbin/svtest install -m 644 work.linux-2.2/dst/libdst.a $RPM_BUILD_ROOT/%{_libdir} # install the saved bsd flavor binary install -m 755 work.linux-2.2/server/dhcpd.bsd $RPM_BUILD_ROOT/usr/sbin/dhcpd.bsd mkdir -p $RPM_BUILD_ROOT/etc/init.d mkdir -p $RPM_BUILD_ROOT/%{susefw2dir} mkdir -p $RPM_BUILD_ROOT/%{omc_svcdir} mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates mkdir -p $RPM_BUILD_ROOT/var/run # set up chroot jail mkdir -p $RPM_BUILD_ROOT/var/lib/dhcp/etc mkdir -p $RPM_BUILD_ROOT/var/lib/dhcp/dev mkdir -p $RPM_BUILD_ROOT/var/lib/dhcp/%_lib mkdir -p $RPM_BUILD_ROOT/var/lib/dhcp/var/run mkdir -p $RPM_BUILD_ROOT/var/lib/dhcp/db %if %DHCPD_LDAP mkdir -p $RPM_BUILD_ROOT/etc/openldap/schema install -m 644 contrib/dhcp.schema $RPM_BUILD_ROOT/etc/openldap/schema/ %endif install -m 744 rc.dhcpd $RPM_BUILD_ROOT/etc/init.d/dhcpd install -m 744 rc.dhcrelay $RPM_BUILD_ROOT/etc/init.d/dhcrelay ln -sf ../../etc/init.d/dhcpd $RPM_BUILD_ROOT/usr/sbin/rcdhcpd ln -sf ../../etc/init.d/dhcrelay $RPM_BUILD_ROOT/usr/sbin/rcdhcrelay install -m 755 $RPM_SOURCE_DIR/dhcpsync $RPM_BUILD_ROOT/usr/sbin/ install -m 644 $RPM_SOURCE_DIR/dhcpsync.8 $RPM_BUILD_ROOT/%{_mandir}/man8/ install -m 755 $RPM_SOURCE_DIR/leasestate $RPM_BUILD_ROOT/usr/sbin/ install -m 755 $RPM_SOURCE_DIR/listlease $RPM_BUILD_ROOT/usr/sbin/ install -m 755 $RPM_SOURCE_DIR/leases.awk $RPM_BUILD_ROOT/usr/sbin/ cp -p $RPM_SOURCE_DIR/dnscompr.py . install -m 644 sysconfig.dhcpd $RPM_BUILD_ROOT/var/adm/fillup-templates/ install -m 644 sysconfig.syslog-dhcpd $RPM_BUILD_ROOT/var/adm/fillup-templates/ install -m 644 sysconfig.dhcrelay $RPM_BUILD_ROOT/var/adm/fillup-templates/ rm -f $RPM_BUILD_ROOT/var/lib/dhcp/dhcpd.leases touch $RPM_BUILD_ROOT/var/lib/dhcp/dhclient.leases install -m 644 client/dhclient.conf $RPM_BUILD_ROOT/etc/dhclient.conf sed '/^max-lease-time/ a \ \ # if you do not use dynamical DNS updates:\ #\ # this statement is needed by dhcpd-3 needs at least this statement.\ # you have to delete it for dhcpd-2, because it does not know it.\ #\ # if you want to use dynamical DNS updates, you should first read\ # read /usr/share/doc/packages/dhcp-server/DDNS-howto.txt\ ddns-update-style none; ddns-updates off;\ ' server/dhcpd.conf > dhcpd.conf install -m644 contrib/3.0b1-lease-convert 3.0b1-lease-convert find $RPM_BUILD_ROOT/%{_mandir} -type f | xargs chmod 644 install -m 644 $RPM_SOURCE_DIR/dhcpd.xml $RPM_BUILD_ROOT/%{omc_svcdir}/ install -m 644 $RPM_SOURCE_DIR/SuSEfirewall2.dhcp-server \ $RPM_BUILD_ROOT/%{susefw2dir}/dhcp-server install -m 755 -d $RPM_BUILD_ROOT/etc/sysconfig/network/if-up.d install -m 755 -d $RPM_BUILD_ROOT/etc/sysconfig/network/scripts install -m 755 $RPM_SOURCE_DIR/if-up.d.dhcpd-restart-hook \ $RPM_BUILD_ROOT/etc/sysconfig/network/scripts/dhcpd-restart-hook ln -sf ../scripts/dhcpd-restart-hook \ $RPM_BUILD_ROOT/etc/sysconfig/network/if-up.d/60-dhcpd-restart-hook %pre # In the past, the name of the source package was "dhcp" but the subpackage # with the common files was named "dhcp-base" -- thus, no subpackage had the # same name as the parent package. This lead to trouble on various ends, like # the putonftp mechanism, so "dhcp-base" was renamed to "dhcp". # # During a YaST system update, the first package to be updated is "dhcp", which # should --and does-- obsolete the dhcp-base package. # However, if RPMv4 is used, there is a peculiarity: RPMv4 automatically # invents an 'obsolete' when it sees a 'provides'. # Since the old dhcp-server package (SLES8) did provide # Provides: dhcp_server dhcp:/usr/sbin/dhcpd dhcp # RPMv4 removes the dhcp-server package. # # This in itself is not a problem because the package is re-installed later # (RPMv4 is not that intelligent). However, if the service is destined to be # started at boot time, the runlevel links will be gone, so the service will # not be started after the update. To restore the links, there is no better way # than remember that the service was running before updating the "dhcp" package, # and restore the links at "dhcp-server" installation time. if [ ${1:-0} -gt 1 ]; then # update if sbin/chkconfig -c dhcpd; then touch var/adm/dhcpd_needs_insserv fi fi %pre server /usr/sbin/useradd -r -g nogroup -s /bin/false -c "DHCP server daemon" -d /var/lib/dhcp dhcpd 2> /dev/null ||: if [ ! -x usr/sbin/dhcpd.lpf -a \ ! -d usr/share/doc/packages/dhcp-server/ms2isc ]; then # usr/sbin/dhcpd.lpf was added _after_ release of 9.1; # usr/share/doc/packages/dhcp-server/ms2isc was added with 9.0; # thus, if both are not present we are updating from pre 9.0 AND # we are NOT updating a 9.1 released package (that has not been updated before). # 9.0 already had a binary compiled with BSD sockets. touch etc/dhcpd_updating_from_lpf_style fi %post server %{fillup_and_insserv -n dhcpd dhcpd} %{fillup_only -ans syslog dhcpd} if grep -q '^DHCPD_RUN_AS="nobody"' etc/sysconfig/dhcpd; then tmpfile=$(mktemp -q etc/sysconfig/dhcpd.XXXXXX) sed 's|^DHCPD_RUN_AS="nobody"|DHCPD_RUN_AS="dhcpd"|' etc/sysconfig/dhcpd \ > $tmpfile && mv $tmpfile etc/sysconfig/dhcpd rm -f $tmpfile fi # update? if [ ${FIRST_ARG:-0} -gt 1 ]; then if [ -e etc/dhcpd_updating_from_lpf_style -a -x usr/sbin/dhcpd.lpf ]; then if /etc/init.d/dhcpd status &>/dev/null; then was_running=true /etc/init.d/dhcpd stop else was_running=false fi tmpfile=$(mktemp -q etc/sysconfig/dhcpd.XXXXXX) sed 's|^DHCPD_BINARY=""|DHCPD_BINARY="/usr/sbin/dhcpd.lpf"|' etc/sysconfig/dhcpd \ > $tmpfile && mv $tmpfile etc/sysconfig/dhcpd rm -f $tmpfile if $was_running; then /etc/init.d/dhcpd start fi fi # see comment above if [ -f var/adm/dhcpd_needs_insserv ]; then sbin/insserv dhcpd rm var/adm/dhcpd_needs_insserv fi fi rm -f etc/dhcpd_updating_from_lpf_style test -s etc/dhcpd.conf || { cp -p usr/share/doc/packages/dhcp-server/dhcpd.conf etc/; } exit 0 %postun server %restart_on_update dhcpd %insserv_cleanup %preun server %stop_on_removal dhcpd %post relay %{fillup_and_insserv -n dhcrelay dhcrelay} %postun relay %restart_on_update dhcrelay %insserv_cleanup %preun relay %stop_on_removal dhcrelay %clean if ! test -f /.buildenv; then rm -rf $RPM_BUILD_ROOT; fi %files %defattr(-,root,root) %doc LICENSE README RELNOTES doc /usr/bin/omshell %dir /var/lib/dhcp %doc %{_mandir}/man1/omshell.1.gz %doc %{_mandir}/man5/dhcp-eval.5.gz %config %{susefw2dir}/dhcp-server %files server %defattr(-,root,root) %doc clearip reset-ip %doc dnscompr.py /usr/sbin/dhcpd /usr/sbin/dhcpd.bsd /usr/sbin/rcdhcpd /usr/sbin/svtest %config /usr/sbin/dhcpsync %config /usr/sbin/leasestate %config /usr/sbin/listlease %config /usr/sbin/leases.awk %config /etc/init.d/dhcpd %dir /var/lib/dhcp/var %dir /var/lib/dhcp/var/run %attr(755,dhcpd,root) %dir /var/lib/dhcp/db %dir /var/lib/dhcp/etc %dir /var/lib/dhcp/dev %doc %{_mandir}/man5/dhcpd.conf.5.gz %doc %{_mandir}/man5/dhcp-options.5.gz %doc %{_mandir}/man5/dhcpd.leases.5.gz %doc %{_mandir}/man8/dhcpd.8.gz %doc %{_mandir}/man8/dhcpsync.8.gz %doc dhcpd.conf LIESMICH.%VENDOR README.%VENDOR README.upgrade 3.0b1-lease-convert DDNS-howto.txt genDDNSKey.sh %doc examples %doc contrib/ms2isc %if %DHCPD_LDAP %doc contrib/dhcp.schema %doc contrib/dhcpd-conf-to-ldap.pl %doc README.ldap doc/draft-ietf-dhc-ldap-schema-01.txt %dir /etc/openldap %dir /etc/openldap/schema %attr(0644, root, root) %config /etc/openldap/schema/dhcp.schema %endif /var/adm/fillup-templates/sysconfig.dhcpd /var/adm/fillup-templates/sysconfig.syslog-dhcpd %dir /var/lib/dhcp/%_lib %{omc_svcdir}/dhcpd.xml /etc/sysconfig/network/scripts/dhcpd-restart-hook /etc/sysconfig/network/if-up.d/60-dhcpd-restart-hook %files client %defattr(-,root,root) /sbin/dhclient /sbin/dhclient-script %config(noreplace) /etc/dhclient.conf %config(noreplace) /var/lib/dhcp/dhclient.leases %doc %{_mandir}/man5/dhclient.conf.5.gz %doc %{_mandir}/man5/dhclient.leases.5.gz %doc %{_mandir}/man8/dhclient.8.gz %doc %{_mandir}/man8/dhclient-script.8.gz %files relay %defattr(-,root,root) /usr/sbin/dhcrelay /usr/sbin/rcdhcrelay %config /etc/init.d/dhcrelay %doc %{_mandir}/man8/dhcrelay.8.gz /var/adm/fillup-templates/sysconfig.dhcrelay %files devel %defattr(-,root,root) %_libdir/lib* %{_prefix}/include/* %doc %{_mandir}/man3/omapi.3.gz %doc %{_mandir}/man3/dhcpctl.3.gz %changelog