X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=dhcp.spec;h=0f02a6d434870c021d7c175fd5e47b687f71e892;hb=c6618b277986e86620a3752092c4b087c0cfb032;hp=35c0b99f464d932e07461f9506d5bee8a8021fc1;hpb=34e657b017c990cdcaa610f0337a2bc2c88c6612;p=packages%2Fdhcp.git diff --git a/dhcp.spec b/dhcp.spec index 35c0b99..0f02a6d 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -1,42 +1,67 @@ # # Conditional build: %bcond_without ldap # without support for ldap storage +%bcond_without static_libs # don't build static library + +# vendor string +%define vvendor PLD/Linux # Summary: DHCP Server Summary(es.UTF-8): Servidor DHCP Summary(pl.UTF-8): Serwer DHCP Summary(pt_BR.UTF-8): Servidor DHCP (Protocolo de configuração dinâmica de hosts) Name: dhcp -Version: 3.1.0 -Release: 3 +# 4.1.0a1 is on DEVEL +Version: 4.0.0 +Release: 6 Epoch: 4 -License: distributable +License: MIT Group: Networking/Daemons Source0: ftp://ftp.isc.org/isc/dhcp/%{name}-%{version}.tar.gz -# Source0-md5: 27d179a3c3fbef576566b456a1168246 +# Source0-md5: 31d79b27ce4a94089a0b9ce7f72307fa Source1: %{name}.init -Source2: %{name}-relay.init -Source3: %{name}.sysconfig -Source4: %{name}-relay.sysconfig -Source5: %{name}-libdhcp4client.pc -Source6: %{name}-dhcp4client.h -Source7: %{name}-libdhcp4client.make -Source8: %{name}-libdhcp_control.h -Patch0: %{name}-dhclient.script.patch -Patch1: %{name}-if_buffer_size.patch -# http://home.ntelos.net/~masneyb/dhcp-3.0.5-ldap-patch -Patch2: %{name}-ldap.patch -Patch3: %{name}-client-script-redhat.patch -Patch4: %{name}-3.0.3-x-option.patch -Patch5: %{name}-typo.patch -Patch6: %{name}-arg-concat.patch -Patch7: %{name}-split-VARDB.patch -Patch8: %{name}-options.patch -Patch9: %{name}-libdhcp4client.patch -Patch10: %{name}-prototypes.patch +Source2: %{name}6.init +Source3: %{name}-relay.init +Source4: %{name}.sysconfig +Source5: %{name}-relay.sysconfig +Source6: %{name}-libdhcp4client.pc +Source7: %{name}-dhcp4client.h +Source8: %{name}-libdhcp4client.make +Source9: %{name}-libdhcp_control.h +Source10: %{name}.schema +Source11: %{name}-README.ldap +Source12: draft-ietf-dhc-ldap-schema-01.txt +Source13: dhcpd-conf-to-ldap +Source14: dhcp-dhclient-script +Patch0: %{name}-release-by-ifup.patch +# from fedora 9-dev +Patch1: %{name}-ldap.patch +Patch2: %{name}-3.0.3-x-option.patch +Patch3: %{name}-paths.patch +Patch4: %{name}-arg-concat.patch +Patch5: %{name}-timeouts.patch +Patch6: %{name}-options.patch +Patch7: %{name}-libdhcp4client.patch +Patch8: %{name}-prototypes.patch +Patch9: %{name}-errwarn-message.patch +Patch10: %{name}-memory.patch +Patch11: %{name}-dhclient-decline-backoff.patch +Patch12: %{name}-unicast-bootp.patch +Patch13: %{name}-fast-timeout.patch +Patch14: %{name}-failover-ports.patch +Patch15: %{name}-dhclient-usage.patch +Patch16: %{name}-default-requested-options.patch +Patch17: %{name}-xen-checksum.patch +Patch18: %{name}-dhclient-anycast.patch +Patch19: %{name}-manpages.patch +Patch20: %{name}-NetworkManager-crash.patch +Patch21: %{name}-no-ipv6.patch URL: http://www.isc.org/sw/dhcp/ +BuildRequires: autoconf +BuildRequires: automake BuildRequires: groff -%{?with_ldap:BuildRequires: openldap-devel >= 2.4.6} +BuildRequires: libtool +%{?with_ldap:BuildRequires: openldap-devel} %{?with_ldap:BuildRequires: openssl-devel} BuildRequires: rpmbuild(macros) >= 1.304 Requires(post): coreutils @@ -45,6 +70,7 @@ Requires: rc-scripts >= 0.2.0 Provides: dhcpd BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) +%define _sbindir /sbin %define schemadir /usr/share/openldap/schema %description @@ -164,6 +190,7 @@ Ten pakiet zawiera klienta protokołu DHCP. %package -n libdhcp4client-devel Summary: Header files for development with the DHCP client library Summary(pl.UTF-8): Pliki nagłówkowe do programowania z użyciem biblioteki klienckiej DHCP +License: GPL v2+ Group: Development/Libraries Requires: libdhcp4client = %{epoch}:%{version}-%{release} @@ -171,7 +198,8 @@ Requires: libdhcp4client = %{epoch}:%{version}-%{release} Header files for development with the DHCP client library. %description -n libdhcp4client-devel -l pl.UTF-8 -Pliki nagłówkowe do programowania z użyciem biblioteki klienckiej DHCP. +Pliki nagłówkowe do programowania z użyciem biblioteki klienckiej +DHCP. %package -n libdhcp4client-static Summary: Static DHCP client library @@ -188,93 +216,171 @@ Statyczna biblioteka kliencka DHCP. %prep %setup -q %patch0 -p1 -%patch1 -p1 -%{?with_ldap:%patch2 -p1} -# These two patches are required for dhcdbd to function +%{?with_ldap:%patch1 -p1} +# This patch is required for dhcdbd to function +# CHECK ME: adds -x (formerly -y): +#The -x argument enables extended option information to be created in the +#-s dhclient-script environment, which would allow applications running +#in that environment to handle options they do not know about in advance - +#this is a Red Hat extension to support dhcdbd and NetworkManager. +# however, fedora doesn't have this patch anymore, so can drop? +#%%patch2 -p1 %patch3 -p1 %patch4 -p1 -# %patch5 -p1 %patch6 -p1 %patch7 -p1 %patch8 -p1 %patch9 -p1 %patch10 -p1 - -sed 's/@DHCP_VERSION@/'%{version}'/' < %{SOURCE5} > libdhcp4client.pc -mkdir -p libdhcp4client -cp %{SOURCE6} libdhcp4client/dhcp4client.h -cp %{SOURCE7} libdhcp4client/Makefile.dist -cp %{SOURCE8} includes/isc-dhcp/libdhcp_control.h +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 + +# Copy in documentation and example scripts for LDAP patch to dhcpd +cp -a %{SOURCE11} README.ldap +cp -a %{SOURCE12} doc +cp -a %{SOURCE13} contrib + +# Copy in the libdhcp4client headers and Makefile.dist +install -d libdhcp4client +cp %{SOURCE7} libdhcp4client/dhcp4client.h +cp %{SOURCE8} libdhcp4client/Makefile.dist + +# Copy in libdhcp_control.h to the isc-dhcp includes directory +cp %{SOURCE9} includes/isc-dhcp/libdhcp_control.h + +# Replace @PRODUCTNAME@ +%{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' common/dhcp-options.5 +%{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' configure.ac + +# Update paths in all man pages +for page in client/dhclient.conf.5 client/dhclient.leases.5 client/dhclient-script.8 client/dhclient.8; do + %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \ + -e 's|RUNDIR|%{_localstatedir}/run|g' \ + -e 's|DBDIR|%{_localstatedir}/db/dhclient|g' \ + -e 's|ETCDIR|%{_sysconfdir}|g' $page +done + +for page in server/dhcpd.conf.5 server/dhcpd.leases.5 server/dhcpd.8; do + %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \ + -e 's|RUNDIR|%{_localstatedir}/run|g' \ + -e 's|DBDIR|%{_localstatedir}/db/dhcpd|g' \ + -e 's|ETCDIR|%{_sysconfdir}|g' $page +done + +sed 's/@DHCP_VERSION@/'%{version}'/' < %{SOURCE6} > libdhcp4client.pc %build -# NOTE: this is not autoconf configure - do not change it to %%configure -./configure - -%{__make} \ - CC="%{__cc}" \ - CC_OPTIONS="%{rpmcflags} \ - -D_PATH_DHCPD_DB=\\\"/var/lib/%{name}/dhcpd.leases\\\" \ - -DEXTENDED_NEW_OPTION_INFO \ - -D_PATH_DHCLIENT_DB=\\\"/var/lib/dhclient/dhclient.leases\\\" \ - " - LFLAGS="%{rpmldflags}" \ - DEBUG="" \ - VARDBS="/var/lib/%{name}" - VARDBC="/var/lib/dhclient" +%{__libtoolize} +%{__aclocal} +%{__autoconf} +%{__autoheader} +%{__automake} +CFLAGS="%{rpmcflags} -fPIC -D_GNU_SOURCE=1" +%configure \ + %{!?with_static_libs:--disable-static} \ + --enable-dhcpv6 \ + --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \ + --with-cli-lease-file=/var/lib/dhclient/dhclient.leases \ + --with-srv-pid-file=/var/run/dhcpd.pid \ + --with-cli-pid-file=/var/run/dhclient.pid \ + --with-relay-pid-file=/var/run/dhcrelay.pid +%{__make} %install rm -rf $RPM_BUILD_ROOT -install -d $RPM_BUILD_ROOT{%{_sysconfdir}/{rc.d/init.d,sysconfig},%{schemadir},%{_pkgconfigdir}} +install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig},%{_pkgconfigdir},/var/lib/{dhcpd,dhclient}} %{__make} install \ - DESTDIR=$RPM_BUILD_ROOT \ - CLIENTBINDIR=/sbin \ - BINDIR=%{_sbindir} \ - LIBDIR=%{_libdir} \ - INCDIR=%{_includedir} \ - ADMMANDIR=%{_mandir}/man8 \ - ADMMANEXT=.8 \ - FFMANDIR=%{_mandir}/man5 \ - LIBMANDIR=%{_mandir}/man3 \ - LIBMANEXT=.3 \ - USRMANDIR=%{_mandir}/man1 \ - USRMANEXT=.1 \ - VARDBS=/var/lib/%{name} \ - VARDBC=/var/lib/dhclient \ - FFMANEXT=.5 - -rm $RPM_BUILD_ROOT%{_mandir}/man3/omshell.3* + DESTDIR=$RPM_BUILD_ROOT install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd -install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcp-relay -install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/dhcpd -install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/dhcp-relay +install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd6 +install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcp-relay +install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/dhcpd +install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/dhcp-relay +install %{SOURCE14} $RPM_BUILD_ROOT/sbin/dhclient-script install server/dhcpd.conf $RPM_BUILD_ROOT%{_sysconfdir} + %if %{with ldap} -install contrib/dhcp.schema $RPM_BUILD_ROOT%{schemadir} +install -d $RPM_BUILD_ROOT%{schemadir} +install %{SOURCE10} $RPM_BUILD_ROOT%{schemadir} %endif -touch $RPM_BUILD_ROOT%{_sysconfdir}/dhclient.conf +# Install headers for libdhcp4client-devel +install -d $RPM_BUILD_ROOT%{_includedir}/dhcp4client +install libdhcp4client/dhcp4client.h $RPM_BUILD_ROOT%{_includedir}/dhcp4client/dhcp4client.h +install -d $RPM_BUILD_ROOT%{_includedir}/dhcp4client/minires +for hdr in cdefs.h ctrace.h dhcp.h dhcp6.h dhcpd.h dhctoken.h failover.h \ + heap.h inet.h minires/minires.h minires/res_update.h \ + minires/resolv.h osdep.h site.h statement.h tree.h; do + install -p -m 0644 includes/${hdr} $RPM_BUILD_ROOT%{_includedir}/dhcp4client/${hdr} +done -touch $RPM_BUILD_ROOT/var/lib/%{name}/dhcpd.leases +:> $RPM_BUILD_ROOT%{_sysconfdir}/dhclient.conf + +touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd.leases touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient.leases +touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd6.leases +touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient6.leases + +# Install pkg-config file install libdhcp4client.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libdhcp4client.pc +cp -a includes/isc-dhcp/libdhcp_control.h $RPM_BUILD_ROOT%{_includedir}/isc-dhcp + +%if %{with static_libs} +# HACK: strip doesn't like .a inside .a +install -d stripworkdir +cd stripworkdir +for a in $RPM_BUILD_ROOT%{_libdir}/*.a; do + archives=$(ar t $a | grep '\.a$' || :) + [ "$archives" ] || continue + + # hope we don't have to recurse here + for ar in $archives; do + rm -f *.o *.a + ar x $a $ar + ar x $ar + ar d $a $ar + ar cr $a *.o + done +done +cd - +%endif %clean rm -rf $RPM_BUILD_ROOT %post +touch /var/lib/dhcpd/dhcpd.leases +touch /var/lib/dhcpd/dhcpd6.leases /sbin/chkconfig --add dhcpd -touch /var/lib/%{name}/dhcpd.leases %service dhcpd restart "dhcpd daemon" +/sbin/chkconfig --add dhcpd6 +%service dhcpd6 restart "dhcpd IPv6 daemon" %preun if [ "$1" = "0" ];then %service dhcpd stop /sbin/chkconfig --del dhcpd + %service dhcpd6 stop + /sbin/chkconfig --del dhcpd6 +fi + +%triggerpostun -- dhcp < 3.0 +if ! grep -q ddns-update-style /etc/dhcpd.conf; then + %{__sed} -i -e '1iddns-update-style none;' /etc/dhcpd.conf fi %post -n openldap-schema-dhcp @@ -287,11 +393,6 @@ if [ "$1" = "0" ]; then %service -q ldap restart fi -%post client -if [ -f /var/lib/dhcp/dhclient.leases.rpmsave ]; then - mv /var/lib/dhcp/dhclient.leases.rpmsave /var/lib/dhclient/dhclient.leases -fi - %post relay /sbin/chkconfig --add dhcp-relay if [ -f /var/lock/subsys/dhcrelay ]; then @@ -305,71 +406,79 @@ if [ "$1" = "0" ];then /sbin/chkconfig --del dhcp-relay fi -%triggerpostun -- dhcp < 3.0 -if [ "`grep ddns-update-style /etc/dhcpd.conf`" = "" ]; then - umask 027 - echo "ddns-update-style none;" > /etc/dhcpd.conf.tmp - echo "" >> /etc/dhcpd.conf.tmp - cat /etc/dhcpd.conf >>/etc/dhcpd.conf.tmp - mv -f /etc/dhcpd.conf.tmp /etc/dhcpd.conf -fi +%post -n libdhcp4client -p /sbin/ldconfig +%postun -n libdhcp4client -p /sbin/ldconfig %files %defattr(644,root,root,755) -%doc doc/* README RELNOTES server/dhcpd.conf LICENSE -%doc contrib/ms2isc -%{?with_ldap:%doc README.ldap Changelog-LDAP contrib/dhcpd-conf-to-ldap.pl} -%{_mandir}/man1/* -%{_mandir}/man5/dhcp* -%{_mandir}/man8/dhcp* +%doc doc/* README RELNOTES server/dhcpd.conf LICENSE contrib/ms2isc %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcpd %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd.conf %attr(755,root,root) %{_bindir}/omshell %attr(755,root,root) %{_sbindir}/dhcpd %attr(754,root,root) /etc/rc.d/init.d/dhcpd -%attr(750,root,root) %dir /var/lib/%{name} -%ghost /var/lib/%{name}/dhcpd.leases - -%if %{with ldap} -%files -n openldap-schema-dhcp -%defattr(644,root,root,755) -%doc contrib/dhcpd-conf-to-ldap.pl -%{schemadir}/*.schema -%endif +%attr(754,root,root) /etc/rc.d/init.d/dhcpd6 +%attr(750,root,root) %dir /var/lib/dhcpd +%ghost /var/lib/dhcpd/dhcpd.leases +%ghost /var/lib/dhcpd/dhcpd6.leases +%{_mandir}/man1/omshell.1* +%{_mandir}/man5/dhcp-eval.5* +%{_mandir}/man5/dhcp-options.5* +%{_mandir}/man5/dhcpd.conf.5* +%{_mandir}/man5/dhcpd.leases.5* +%{_mandir}/man8/dhcpd.8* %files client %defattr(644,root,root,755) -%doc contrib/sethostname.sh +%doc contrib/sethostname.sh client/dhclient.conf %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhclient.conf %attr(755,root,root) /sbin/dhclient %attr(755,root,root) /sbin/dhclient-script -%{_mandir}/man[58]/dhclient* -%attr(750,root,root) %dir /var/lib/dhclient +%{_mandir}/man5/dhclient.conf.5* +%{_mandir}/man5/dhclient.leases.5* +%{_mandir}/man8/dhclient.8* +%{_mandir}/man8/dhclient-script.8* +%dir %attr(750,root,root) /var/lib/dhclient %ghost /var/lib/dhclient/dhclient.leases +%ghost /var/lib/dhclient/dhclient6.leases %files relay %defattr(644,root,root,755) -%{_mandir}/man8/dhcrelay* %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcp-relay %attr(755,root,root) %{_sbindir}/dhcrelay %attr(754,root,root) /etc/rc.d/init.d/dhcp-relay +%{_mandir}/man8/dhcrelay.8* %files devel %defattr(644,root,root,755) -%{_mandir}/man3/* -%{_libdir}/*.a -%{_includedir}/* +%{_libdir}/libdhcpctl.a +%{_libdir}/libdst.a +%{_libdir}/libomapi.a +%{_includedir}/dhcpctl +%{_includedir}/isc-dhcp +%{_includedir}/omapip +%{_mandir}/man3/dhcpctl.3* +%{_mandir}/man3/omapi.3* %files -n libdhcp4client %defattr(644,root,root,755) -%attr(755,root,root) %{_libdir}/libdhcp4client-%{version}.so.* +%attr(755,root,root) %{_libdir}/libdhcp4client-*.so.* %files -n libdhcp4client-devel %defattr(644,root,root,755) %attr(755,root,root) %{_libdir}/libdhcp4client.so -%{_includedir}/* +%{_includedir}/dhcp4client %{_pkgconfigdir}/libdhcp4client.pc +%{_libdir}/libdhcp4client.la +%if %{with static_libs} %files -n libdhcp4client-static %defattr(644,root,root,755) %{_libdir}/libdhcp4client.a +%endif + +%if %{with ldap} +%files -n openldap-schema-dhcp +%defattr(644,root,root,755) +%{schemadir}/dhcp.schema +%endif