Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37560990
en ru br
ALT Linux repositórios
S:4.4.3.P1-alt1
5.0: 3.0.7-alt1
4.1: 3.0.6-alt2.M41.1
4.0: 3.0.6-alt1
3.0: 3.0.2-alt1

Group :: Sistema/Servidores
RPM: dhcp

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

# -*- mode: rpm-spec; mode: folding -*-
# vim: set ft=spec:
# vim600: set fdm=marker:

#%%define patchlevel rc14


Name: dhcp
Version: 3.0.7
Release: alt1
Serial: 1

Summary: Dynamic Host Configuration Protocol (DHCP) distribution
License: BSD-like
Group: System/Servers
Url: http://www.isc.org/sw/dhcp/
Packager: Dmitry V. Levin <ldv at altlinux.org>

%define srcname dhcp-%version%{?patchlevel:%patchlevel}
Source0: ftp://ftp.isc.org/isc/dhcp/%srcname.tar
Source1: dhcp-dynamic-dns-examples.tar
Source2: dhcpd.conf.sample
Source3: update_dhcp.pl
Source4: dhcpd.init
Source5: dhcrelay.init
Source6: dhclient-enter-hooks
Source7: dhclient-exit-hooks
Source8: dhcpd.sysconfig
Source9: dhcrelay.sysconfig
Source10: dhcpd.chroot.all
Source11: dhcpd.chroot.conf
Source12: dhcpd.chroot.lib
Source13: sethostname.sh

Patch: dhcp-%version-%release.patch

# due to copy_resolv_conf/copy_resolv_lib

BuildPreReq: chrooted >= 0.3

BuildPreReq: groff-base, libcap-devel

# Chrooted environments

%define ROOT %_localstatedir/%name

%package common
Summary: Dynamic Host Configuration Protocol (DHCP) distribution
Group: System/Servers
PreReq: shadow-utils

%package client
Summary: The ISC DHCP client daemon
Group: System/Servers
PreReq: %name-common = %serial:%version-%release, service

%package server
Summary: The ISC DHCP server daemon
Group: System/Servers
PreReq: %name-common = %serial:%version-%release, service
Requires: /var/empty
Provides: %name = %serial:%version-%release
Obsoletes: dhcp, dhcpd

%package relay
Summary: The ISC DHCP relay daemon
Group: System/Servers
PreReq: %name-common = %serial:%version-%release, service
Requires: /var/empty

%package omshell
Summary: The ISC DHCP OMAPI command shell tool
Group: System/Servers
PreReq: %name-common = %serial:%version-%release

%package devel
Summary: Development headers and static libraries for the dhcpctl API
Group: Development/Other
Requires: dhcp-common = %serial:%version-%release

# {{{ descriptions

%description
The ISC Dynamic Host Configuration Protocol distribution provides a
freely redistributable reference implementation of all aspects of the
DHCP protocol.

%description common
The ISC Dynamic Host Configuration Protocol distribution provides a
freely redistributable reference implementation of all aspects of the
DHCP protocol.

This package contains files and directories common for the ISC DHCP
client, server and relay subpackages.

%description client
The Internet Software Consortium DHCP Client, dhclient, provides a
means for configuring one or more network interfaces using the Dynamic
Host Configuration Protocol, BOOTP protocol, or if these protocols
fail, by statically assigning an address.

%description server
The Internet Software Consortium DHCP Server, dhcpd, implements the
Dynamic Host Configuration Protocol (DHCP) and the Internet Bootstrap
Protocol (BOOTP).  DHCP allows hosts on a TCP/IP network to request
and be assigned IP addresses, and also to discover information about
the network to which they are attached.  BOOTP provides similar
functionality, with certain restrictions.

%description relay
The Internet Software Consortium DHCP Relay Agent, dhcrelay, provides a
means for relaying DHCP and BOOTP requests from a subnet to which no
DHCP server is directly connected to one or more DHCP servers on other
subnets.

You will have to define the environment variable SERVERS and optionally
OPTIONS in /etc/sysconfig/dhcrelay before starting the server.

%description omshell
The OMAPI Command Shell, omshell, provides an interactive way to connect
to, query, and possibly change, the ISC DHCP Server's state via OMAPI,
the Object Management API.  By using OMAPI and omshell, you do not have
to stop, make changes, and then restart the DHCP server, but can make
the changes while the server is running.  Omshell provides a way of
accessing OMAPI.

%description devel
DHCP devel contains header files and static libraries for developing
with the Internet Software Consortium (ISC) dhcpctl API.

# }}}


%prep
%setup -q -n %srcname -a1
%patch -p1

install -pm644 %_sourcedir/update_dhcp.pl .
find -type f -print0 |
xargs -r0 grep -EZl '(/etc|ETCDIR)/(dhclient|dhcpd|dhcrelay)' -- |
xargs -r0 sed -i 's,\(/etc\|ETCDIR\)/\(dhclient\|dhcpd\|dhcrelay\),\1/%name/\2,g' --
find client -type f -not -name Makefile\* -print0 |
xargs -r0 grep -FZl DBDIR -- |
xargs -r0 sed -i 's,DBDIR,%ROOT/dhclient/state,g' --
find server -type f -not -name Makefile\* -print0 |
xargs -r0 grep -FZl DBDIR -- |
xargs -r0 sed -i 's,DBDIR,%ROOT/dhcpd/state,g' --

%build
%add_optflags -fpie -fno-strict-aliasing -Wno-unused -Werror -Dlint
./configure --copts "%optflags"
%make_build CC=%__cc DEBUG=

# {{{ install


%install
rln()
{
local target=$1 && shift
local source=$1 && shift
target=`relative "$target" "$source"`
ln -snf "$target" "%buildroot$source"
}

mkdir -p %buildroot{%ROOT,/etc/{sysconfig,%name/dhclient.d}}
%make_install install \
INSTALL='install -pm644' \
MANINSTALL='$(INSTALL)' \
DESTDIR=%buildroot \
LIBDIR=%_libdir \
INCDIR=%_includedir \
ADMMANDIR=%_mandir/man8 \
FFMANDIR=%_mandir/man5 \
LIBMANDIR=%_mandir/man3 \
USRMANDIR=%_mandir/man1 \
#

# dhcpd

install -pD -m755 %_sourcedir/dhcpd.init \
%buildroot%_initdir/dhcpd
install -pD -m644 %_sourcedir/dhcpd.sysconfig \
%buildroot/etc/sysconfig/dhcpd
install -pD -m600 %_sourcedir/dhcpd.conf.sample \
%buildroot/etc/%name/dhcpd.conf.sample
mkdir -p %buildroot%ROOT/dhcpd/state
touch %buildroot%ROOT/dhcpd/state/dhcpd.leases
# Make use of syslogd-1.4.1-alt11 /etc/syslog.d/ feature.
mkdir -p %buildroot%ROOT/dhcpd/dev
mksock %buildroot%ROOT/dhcpd/dev/log
mkdir -p %buildroot/etc/syslog.d
ln -s %ROOT/dhcpd/dev/log %buildroot/etc/syslog.d/dhcpd
# Resolver infrastructure
for n in all conf lib; do
install -pD -m750 "%_sourcedir/dhcpd.chroot.$n" \
"%buildroot/etc/chroot.d/dhcpd.$n"
done
%__subst -p 's,%%ROOT,%ROOT/dhcpd,g' "%buildroot/etc/chroot.d/"*
mkdir -p %buildroot%ROOT/dhcpd{/etc,/%_lib,/var/{nis,yp/binding}}
touch %buildroot%ROOT/dhcpd{/etc/{localtime,hosts,services,{host,nsswitch,resolv}.conf},/var/nis/NIS_COLD_START}

# dhcrelay

install -pD -m755 %_sourcedir/dhcrelay.init \
%buildroot%_initdir/dhcrelay
install -pD -m644 %_sourcedir/dhcrelay.sysconfig \
%buildroot/etc/sysconfig/dhcrelay

# dhclient

rln /sbin/dhclient-script /etc/%name/
install -m755 %_sourcedir/dhclient-enter-hooks \
%buildroot/etc/%name/
install -m755 %_sourcedir/dhclient-exit-hooks \
%buildroot/etc/%name/
mkdir -p %buildroot%ROOT/dhclient/state
touch %buildroot%ROOT/dhclient/state/dhclient.leases
echo '# DHCP client config file' > %buildroot/etc/%name/dhclient.conf
chmod 644 %buildroot/etc/%name/dhclient.conf
mkdir -p %buildroot/etc/%name/dhclient.d
echo '#!/bin/sh' > %buildroot/etc/%name/dhclient.d/enter001.null-hook
echo '#!/bin/sh' > %buildroot/etc/%name/dhclient.d/exit001.null-hook
install -pm644 %_sourcedir/sethostname.sh \
%buildroot/etc/%name/dhclient.d/enter010.sethostname
chmod 644 %buildroot/etc/%name/dhclient.d/*

# docs

%define docdir %_docdir/%srcname
rm -rf %buildroot%docdir
mkdir -p %buildroot%docdir
cp -a LICENSE README RELNOTES update_dhcp.pl doc \
%buildroot%docdir/

# }}}


# {{{ scripts


%pre common
/usr/sbin/groupadd -r -f %name

%pre client
%__rm -f /var/run/dhclient.restart
if [ $1 -ge 2 ] && /sbin/start-stop-daemon --stop --test --exec /sbin/dhclient --pidfile /var/run/dhclient.pid --user root >/dev/null 2>&1; then
touch /var/run/dhclient.restart
fi

# relocate dhcp.d

if [ ! -d /etc/%name/dhclient.d -a -d /etc/%name/dhcp.d ]; then
%__mv -v /etc/%name/dhcp.d /etc/%name/dhclient.d
fi

# relocate dhclient.leases

if [ ! -f %ROOT/dhclient/state/dhclient.leases -a -f %ROOT/dhclient.leases ]; then
%__mkdir_p %ROOT/dhclient/state
%__cp -pv %ROOT/dhclient.leases %ROOT/dhclient/state/
fi

%post client
if [ -f /var/run/dhclient.restart ]; then
%__rm -f /var/run/dhclient.restart
echo 'Please restart the ISC DHCP client daemon manually.'
fi

%pre server
/usr/sbin/useradd -r -n -g %name -d %ROOT/dhcpd -s /dev/null -c 'The ISC DHCP server daemon' dhcpd >/dev/null 2>&1 ||:
%__rm -f /var/run/dhcpd.restart
# stop _old_ dhcpd if running
if [ $1 -eq 1 ] && [ -x %_initdir/dhcpd ] && %_initdir/dhcpd status >/dev/null 2>&1; then
%_initdir/dhcpd condstop && touch /var/run/dhcpd.restart ||:
fi

# relocate dhcpd.conf

if [ ! -f /etc/%name/dhcpd.conf -a -f /etc/dhcpd.conf ]; then
%__mkdir_p /etc/%name
%__mv -v /etc/dhcpd.conf /etc/%name/
fi

# relocate dhcpd.leases

if [ ! -f %ROOT/dhcpd/state/dhcpd.leases -a -f %ROOT/dhcpd.leases ]; then
%__mkdir_p %ROOT/dhcpd/state
%__mv -v %ROOT/dhcpd.leases %ROOT/dhcpd/state/
fi

if [ $1 = 0 ]; then
%__rm -f %ROOT/dhcpd/%_lib/* %ROOT/dhcpd/var/yp/binding/*
fi

%post server
/etc/chroot.d/dhcpd.all
%post_service dhcpd
if [ -f /var/run/dhcpd.restart ]; then
%__rm -f /var/run/dhcpd.restart
%_initdir/dhcpd start ||:
fi

%preun server
%preun_service dhcpd

%triggerpostun -- %name
[ $1 = 0 ] || exit 0
/sbin/chkconfig --add dhcpd

%pre relay
/usr/sbin/useradd -r -n -g %name -d /var/empty -s /dev/null -c 'The ISC DHCP relay daemon' dhcrelay >/dev/null 2>&1 ||:
%__rm -f /var/run/dhcrelay.restart
if [ $1 -ge 2 ] && [ -x %_initdir/dhcrelay ] && %_initdir/dhcrelay status >/dev/null 2>&1; then
%_initdir/dhcrelay condstop && touch /var/run/dhcrelay.restart ||:
fi

%post relay
if [ -f /var/run/dhcrelay.restart ]; then
%__rm -f /var/run/dhcrelay.restart
%_initdir/dhcrelay start ||:
else
%post_service dhcrelay
fi

%preun relay
%preun_service dhcrelay

# }}}


# {{{ files


%files common
%dir %ROOT
%dir /etc/%name
%dir %docdir
%docdir/[A-Z]*
%docdir/doc

%files client
%config /etc/%name/dhclient-*-hooks
%config(noreplace) /etc/%name/dhclient.d
%config(noreplace) /etc/%name/dhclient.conf
/etc/%name/dhclient-script
/sbin/dhclient*
%_man5dir/dhclient.*
%_man8dir/dhclient*
%attr(700,root,dhcp) %dir %ROOT/dhclient
%attr(700,root,dhcp) %dir %ROOT/dhclient/state
%attr(644,root,dhcp) %config(noreplace) %verify(not md5 mtime size) %ROOT/dhclient/state/dhclient.leases

%files server
/etc/syslog.d/*
%config /etc/chroot.d/dhcpd.*
%config %_initdir/dhcpd
%config(noreplace) /etc/sysconfig/dhcpd
%_sbindir/dhcpd
%_man5dir/dhcpd.*
%_man5dir/dhcp-options.*
%_man5dir/dhcp-eval.*
%_man8dir/dhcpd.*
%attr(0750,root,dhcp) %dir %ROOT/dhcpd
%attr(1770,root,dhcp) %dir %ROOT/dhcpd/state
%attr(0644,dhcpd,dhcp) %config(noreplace) %verify(not md5 mtime size) %ROOT/dhcpd/state/dhcpd.leases
%dir %attr(0710,root,dhcp) %ROOT/dhcpd/dev
%ghost %attr(666,root,root) %ROOT/dhcpd/dev/*
# Resolver infrastructure
%dir %ROOT/dhcpd/%_lib
%dir %ROOT/dhcpd/etc
%ghost %verify(not md5 mtime size) %ROOT/dhcpd/etc/*
%dir %ROOT/dhcpd/var
%dir %ROOT/dhcpd/var/nis
%ghost %config(missingok) %verify(not md5 mtime size) %ROOT/dhcpd/var/nis/NIS_COLD_START
%dir %ROOT/dhcpd/var/yp
%dir %ROOT/dhcpd/var/yp/binding
%dir /etc/%name
%doc /etc/%name/dhcpd.conf.sample
%dir %docdir
%docdir/update_dhcp.pl

%files relay
%config %_initdir/dhcrelay
%config(noreplace) /etc/sysconfig/dhcrelay
%_sbindir/dhcrelay
%_man8dir/dhcrelay.*

%files omshell
%_bindir/omshell
%_man1dir/omshell.*
 
%files devel
%_includedir/*
%_libdir/*
%_man3dir/*

# }}}


%changelog

Todas as alterações você pod ver aqui

 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009