Commit a1529d8e authored by Mike Hibler's avatar Mike Hibler
Browse files

Ports cleanup: add old dhcp31 port for clients, remove errant CVS dir.

parent 1098459c
#
# XXX hacked up Emulab version of isc-dhcp30-server/Makefile to be standalone
# for dhcp30-client. We have no local mods to this version of dhcp, we just
# need a dhclient program that works on multiple interfaces at once, hence we
# keep this version alive.
# From:
#
# ex:ts=8
# Ports collection makefile for: dhcp
# Date created: 7 Mar 1996
# Whom: se
#
# $FreeBSD: ports/net/isc-dhcp31-server/Makefile,v 1.133 2010/10/14 15:45:39 jpaetzel Exp $
#
PORTNAME= dhcp
PORTVERSION= 3.1.ESV
PORTEPOCH= 1
PORTREVISION= ${DHCP_PORTREVISION}
CATEGORIES= misc net
MASTER_SITES= ${MASTER_SITE_ISC}
MASTER_SITE_SUBDIR= dhcp dhcp/dhcp-3.1-history
PKGNAMEPREFIX= isc-
PKGNAMESUFFIX= 31-client
DISTNAME= ${PORTNAME}-3.1-ESV
MAINTAINER= jpaetzel@FreeBSD.org
COMMENT?= The ISC Dynamic Host Configuration Protocol server
PORTREVISION_SERVER= 0
PORTREVISION_CLIENT= 0
PORTREVISION_RELAY= 0
PORTREVISION_DEVEL= 0
UNIQUENAME= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
# PORTREVISION handling
DHCP_PORTREVISION= ${PORTREVISION_CLIENT}
.include <bsd.port.pre.mk>
# Global variables
#
HAS_CONFIGURE= yes
CONFIGURE_ARGS= --subsys client
ALL_TARGET= all.client
INSTALL_TARGET= install.client
SCRIPTS_ENV+= PKG_PREFIX=${PREFIX}
MAN5= dhclient.conf.5 dhclient.leases.5
MAN8= dhclient.8 dhclient-script.8
MAN5+= dhcp-eval.5 dhcp-options.5
MSG_FILE= ${.CURDIR}/pkg-message
DESCR= ${.CURDIR}/pkg-descr
PKGINSTALL= ${.CURDIR}/pkg-install
PKGDEINSTALL= ${PKGINSTALL}
PKGMESSAGE= ${WRKDIR}/pkg-message
PLIST= ${.CURDIR}/pkg-plist
PATCH_SUBDIRS= common minires dst omapip
PATCH_SUBDIRS+= client
.if !defined(NOPORTDOCS)
PORTDOCS= LICENSE README RELNOTES
.endif
BIN_FILES= dhclient
LOCAL_CONF_FILES= dhclient.conf
SAMP_FILES= client/dhclient.conf
DATA_FILES= dhclient.leases
SAMP_SUFX= .sample
CONF_DIR= ${PREFIX}/etc
SCHEMA_DIR= ${PREFIX}/share/${PKGBASE}
DOCSDIR= ${PREFIX}/share/doc/${PKGBASE}
DATADIR= /var/db
PLIST_SUB+= SCHEMA_DIR="${SCHEMA_DIR:S,^${PREFIX}/,,}"
PLIST_SUB+= LDAP="@comment "
REINPLACE_SUB= PREFIX=${PREFIX}
.if !defined(WITHOUT_DHCP_PARANOIA)
SUB_LIST+= PARANOIA=YES
.else
SUB_LIST+= PARANOIA=NO
.endif
.if !defined(WITHOUT_DHCP_JAIL)
SUB_LIST+= JAIL=YES
.else
SUB_LIST+= JAIL=NO
.endif
PKGMESSAGE_SUB= PREFIX="${PREFIX}" MAN1PREFIX="${MAN1PREFIX}" \
DOCSDIR="${DOCSDIR}" SCHEMA_DIR="${SCHEMA_DIR}"
# Post-extract
#
post-extract: extract-omshell extract-script
extract-omshell:
@${MKDIR} ${WRKSRC}/omshell
@${MV} ${WRKSRC}/dhcpctl/omshell.? ${WRKSRC}/omshell
@${CP} ${FILESDIR}/omshell::Makefile.dist \
${WRKSRC}/omshell/Makefile.dist
extract-script:
@${CP} ${FILESDIR}/client::scripts::freebsd ${WRKSRC}/client/scripts/freebsd
# Post-patch
#
post-patch: patch-scripts patch-makefile-conf \
patch-makefiles-dist patch-man-pages \
patch-pkgmessage patch-site-conf
patch-scripts:
@${REINPLACE_CMD} ${REINPLACE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${WRKSRC}/client/dhclient.conf \
${WRKSRC}/client/scripts/freebsd
patch-site-conf:
@${ECHO_CMD} CFLAGS += -DENABLE_POLLING_MODE >> ${WRKSRC}/site.conf
patch-makefile-conf:
@${REINPLACE_CMD} -e 's|^DEBUG[ ]*=|# DEBUG ?=|g' \
${WRKSRC}/Makefile.conf
patch-makefiles-dist:
.for subdir in ${PATCH_SUBDIRS}
@${REINPLACE_CMD} -e 's|^CFLAGS[ ]*=|CFLAGS +=|g' \
${WRKSRC}/${subdir}/Makefile.dist
.endfor
# temporary hack - no patch file needed for this typo.
patch-man-pages:
@${REINPLACE_CMD} -e '/^\.Fd$$/d' ${WRKSRC}/dhcpctl/dhcpctl.3
patch-pkgmessage:
@${SED} ${PKGMESSAGE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${MSG_FILE} > ${PKGMESSAGE}
@${REINPLACE_CMD} -e '/^%%LDAP%%/d' ${PKGMESSAGE}
# Post-install
#
POST-INSTALL= parallel-post-install install-rc-script configure-package \
display-message
.ORDER: ${POST-INSTALL}
post-install: ${POST-INSTALL}
parallel-post-install: \
strip-binary-files \
install-doc-files install-sample-files \
create-conf-files create-data-files
strip-binary-files:
.for f in ${BIN_FILES}
.if exists(${PREFIX}/bin/${f})
@${STRIP_CMD} ${PREFIX}/bin/${f}
.endif
.if exists(${PREFIX}/sbin/${f})
@${STRIP_CMD} ${PREFIX}/sbin/${f}
.endif
.endfor
install-doc-files:
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for f in ${PORTDOCS}
@${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
.endfor
.endif
install-sample-files:
.for f in ${SAMP_FILES}
@${INSTALL_DATA} ${WRKSRC}/${f} ${CONF_DIR}/${f:T}${SAMP_SUFX}
.endfor
create-conf-files:
.for f in ${LOCAL_CONF_FILES}
.if !exists(${CONF_DIR}/${f})
@${TOUCH} ${CONF_DIR}/${f}
.endif
.endfor
create-data-files:
.for f in ${DATA_FILES}
.if !exists(${DATADIR}/${f})
@${TOUCH} ${DATADIR}/${f}
.endif
.endfor
configure-package:
display-message:
@${ECHO_MSG}
@${CAT} ${PKGMESSAGE}
@${ECHO_MSG}
.include <bsd.port.post.mk>
MD5 (dhcp-3.1-ESV.tar.gz) = 13cb8884e16f26adf39d9210b25c79cd
SHA256 (dhcp-3.1-ESV.tar.gz) = e316b7dc34f05e38724273a473f823719281f229a71a80bc358f8e74687fd7d7
SIZE (dhcp-3.1-ESV.tar.gz) = 797454
#!/bin/sh
#############################################################################
#
# Copyright (c) 1999, MindStep Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
#############################################################################
#
# This script was written by Patrick Bihan-Faou, patrick@mindstep.com,
# Please contact us for bug reports, etc.
#
#############################################################################
# $MindStep_Id: dhclient-script.sh,v 1.8 1999/12/07 22:11:08 patrick Exp $
# $MindStep_Tag: CONTRIB_19991207 $
# from FreeBSD: src/sbin/dhclient/dhclient-script.sh,v 1.2 2002/02/01 18:46:58 alfred Exp
# $FreeBSD: ports/net/isc-dhcp31-server/files/client::scripts::freebsd,v 1.2 2004/06/26 14:32:41 eik Exp $
#############################################################################
#############################################################################
# hook functions prototypes
#
# The "pre_state_XXX_hook" functions are called before the main
# work is done for the state XXX
#
# The "post_state_XXX_hook" functions are called after the main
# work is done for the state XXX
#
# These functions are meant to be overridden by the user's
# dhclient-enter-hooks file
#############################################################################
pre_state_MEDIUM_hook () { }
pre_state_PREINIT_hook () { }
pre_state_ARPCHECK_hook () { }
pre_state_ARPSEND_hook () { }
pre_state_RENEW_hook () { }
pre_state_REBIND_hook () { }
pre_state_BOUND_hook () { }
pre_state_REBOOT_hook () { }
pre_state_EXPIRE_hook () { }
pre_state_FAIL_hook () { }
pre_state_TIMEOUT_hook () { }
post_state_MEDIUM_hook () { }
post_state_PREINIT_hook () { }
post_state_ARPCHECK_hook () { }
post_state_ARPSEND_hook () { }
post_state_RENEW_hook () { }
post_state_REBIND_hook () { }
post_state_BOUND_hook () { }
post_state_REBOOT_hook () { }
post_state_EXPIRE_hook () { }
post_state_FAIL_hook () { }
post_state_TIMEOUT_hook () { }
#############################################################################
# make_resolv_conf
#
# This function is called to update the information related to the
# DNS configuration (the resolver part)
#############################################################################
make_resolv_conf ()
{
if [ "x$new_domain_name" != x ] && [ "x$new_domain_name_servers" != x ]; then
echo search $new_domain_name >/etc/resolv.conf
for nameserver in $new_domain_name_servers; do
echo nameserver $nameserver >>/etc/resolv.conf
done
fi
}
#############################################################################
# set_XXX
# unset_XXX
#
# These function each deal with one particular setting.
# They are OS dependent and may be overridden in the
# dhclient-enter-hooks file if needed.
#
# These functions are called with either "new" or "old" to indicate which
# set of variables to use (new_ip_address or old_ip_address...)
#
#############################################################################
update_hostname ()
{
local current_hostname=`/bin/hostname`
if [ "$current_hostname" = "" ] || \
[ "$current_hostname" = "$old_host_name" ]
then
if [ "$new_host_name" != "$old_host_name" ]
then
$LOGGER "New Hostname: $new_host_name"
hostname $new_host_name
fi
fi
}
set_ip_address ()
{
local ip
local mask
local bcast
if [ $# -lt 1 ]
then
return 1
fi
eval ip="\$${1}_ip_address"
eval mask="\$${1}_subnet_mask"
eval bcast="\$${1}_broadcast_address"
if [ "$ip" != "" ]
then
ifconfig $interface inet $ip netmask $mask broadcast $bcast $medium
# route add $ip 127.0.0.1 > /dev/null 2>&1
fi
}
unset_ip_address ()
{
local ip
if [ $# -lt 1 ]
then
return 1
fi
eval ip="\$${1}_ip_address"
if [ "$ip" != "" ]
then
ifconfig $interface inet -alias $ip $medium
# route delete $ip 127.0.0.1 > /dev/null 2>&1
fi
}
set_ip_alias ()
{
if [ "$alias_ip_address" != "" ]
then
ifconfig $interface inet alias $alias_ip_address netmask $alias_subnet_mask
# route add $alias_ip_address 127.0.0.1
fi
}
unset_ip_alias ()
{
if [ "$alias_ip_address" != "" ]
then
ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
# route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
fi
}
set_routers ()
{
local router_list
if [ $# -lt 1 ]
then
return 1
fi
eval router_list="\$${1}_routers"
for router in $router_list
do
route add default $router >/dev/null 2>&1
done
}
unset_routers ()
{
local router_list
if [ $# -lt 1 ]
then
return 1
fi
eval router_list="\$${1}_routers"
for router in $router_list
do
route delete default $router >/dev/null 2>&1
done
}
set_static_routes ()
{
local static_routes
if [ $# -lt 1 ]
then
return 1
fi
eval static_routes="\$${1}_static_routes"
set static_routes
while [ $# -ge 2 ]
do
$LOGGER "New Static Route: $1 -> $2"
route add $1 $2
shift; shift
done
}
unset_static_routes ()
{
local static_routes
if [ $# -lt 1 ]
then
return 1
fi
eval static_routes="\$${1}_static_routes"
set static_routes
while [ $# -ge 2 ]
do
route delete $1 $2
shift; shift
done
}
#############################################################################
#
# utility functions grouping what needs to be done in logical units.
#
#############################################################################
set_all ()
{
set_ip_address new
set_routers new
set_static_routes new
if [ "$new_ip_address" != "$alias_ip_address" ]
then
set_ip_alias
fi
}
set_others ()
{
update_hostname
make_resolv_conf
}
clear_arp_table ()
{
arp -d -a
}
unset_all ()
{
if [ "$alias_ip_address" != "$old_ip_address" ]
then
unset_ip_alias
fi
if [ "$old_ip_address" != "" ]
then
unset_ip_address old
unset_routers old
unset_static_routes old
clear_arp_table
fi
}
test_new_lease ()
{
local rc
set $new_routers
if [ $# -ge 1 ]
then
set_ip_address new
if ping -q -c 1 $1
then
rc=0
else
rc=1
fi
unset_ip_address new
else
rc=1
fi
return $rc
}
#############################################################################
# Main State functions.
#
# There is a state function for each state of the DHCP client
# These functions are OS specific and should be be tampered with.
#############################################################################
in_state_MEDIUM ()
{
ifconfig $interface $medium
ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1
sleep 1
exit_status=0
}
in_state_PREINIT ()
{
unset_ip_alias
ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
broadcast 255.255.255.255 up
exit_status=0
}
in_state_ARPCHECK ()
{
exit_status=0
}
in_state_ARPSEND ()
{
exit_status=0
}
in_state_RENEW ()
{
if [ "$old_ip_address" != "$new_ip_address" ]
then
unset_all
set_all
fi
set_others
}
in_state_REBIND () {
in_state_RENEW
}
in_state_BOUND () {
unset_all
set_all
set_others
}
in_state_REBOOT () {
in_state_BOUND
}
in_state_EXPIRE ()
{
unset_all
set_ip_alias
exit_status=0
}
in_state_FAIL () {
in_state_EXPIRE
}
in_state_TIMEOUT ()
{
unset_all
if test_new_lease
then
set_all
set_others
else
$LOGGER "No good lease information in TIMEOUT state"
set_ip_alias
exit_status=1