mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
copied from ArchLinux
http://repos.archlinux.org/wsvn/packages/dhcp/trunk/
This commit is contained in:
parent
75baf13aae
commit
39766dd6de
6 changed files with 291 additions and 0 deletions
77
extra/dhcp/PKGBUILD
Normal file
77
extra/dhcp/PKGBUILD
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
# $Id: PKGBUILD 85736 2010-07-19 02:41:06Z kevin $
|
||||||
|
# Maintainer: judd <jvinet@zeroflux.org>
|
||||||
|
pkgbase=dhcp
|
||||||
|
pkgname=('dhcp'
|
||||||
|
'dhclient')
|
||||||
|
# separate patch levels with a period to maintain proper versioning.
|
||||||
|
pkgver=4.2.0
|
||||||
|
_pkgver=4.2.0
|
||||||
|
pkgrel=1
|
||||||
|
arch=('i686' 'x86_64' 'arm')
|
||||||
|
license=('custom:isc-dhcp')
|
||||||
|
url="https://www.isc.org/software/dhcp"
|
||||||
|
source=(http://ftp.isc.org/isc/${pkgname}/${pkgname}-${_pkgver}.tar.gz
|
||||||
|
dhcpd dhcp.conf.d dhcp-4.1.1-missing-ipv6-not-fatal.patch dhclient-script-pathFixes.patch)
|
||||||
|
md5sums=('83abd7c4f9c24d8dd024ca5a71380c0a'
|
||||||
|
'df22cffa7d7415ece7bb025b7bf774dd'
|
||||||
|
'49da3192e5c885e3c7d02f447c2dea5e'
|
||||||
|
'fd64aeb4f399dcc41ea43089a3811094'
|
||||||
|
'ddcc5cd576ec631ade6c4da21952b50b')
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd ${srcdir}/${pkgname}-${_pkgver}
|
||||||
|
# Define _GNU_SOURCE to fix IPV6.
|
||||||
|
sed '/^CFLAGS="$CFLAGS/ s/INGS"/INGS -D_GNU_SOURCE"/' -i configure
|
||||||
|
# Make not having ipv6 non-fatal.
|
||||||
|
patch -Np0 -i ${srcdir}/dhcp-4.1.1-missing-ipv6-not-fatal.patch
|
||||||
|
./configure --prefix=/usr --sysconfdir=/etc \
|
||||||
|
--with-srv-lease-file=/var/state/dhcp/dhcpd.leases \
|
||||||
|
--with-srv6-lease-file=/var/state/dhcp/dhcpd6.leases
|
||||||
|
make || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
package_dhcp(){
|
||||||
|
pkgdesc="A DHCP server, client, and relay agent"
|
||||||
|
depends=('openssl>=0.9.8a')
|
||||||
|
backup=('etc/dhcpd.conf' 'etc/conf.d/dhcp')
|
||||||
|
install=dhcp.install
|
||||||
|
|
||||||
|
cd ${srcdir}/${pkgname}-${_pkgver}
|
||||||
|
make DESTDIR=${pkgdir} install
|
||||||
|
install -D -m755 ${srcdir}/dhcpd ${pkgdir}/etc/rc.d/dhcpd
|
||||||
|
install -D -m644 ${srcdir}/dhcp.conf.d ${pkgdir}/etc/conf.d/${pkgbase}
|
||||||
|
mkdir -p ${pkgdir}/var/state/dhcp
|
||||||
|
rm -f ${pkgdir}/etc/dhclient.conf
|
||||||
|
rm -f ${pkgdir}/usr/sbin/dhclient
|
||||||
|
rm -f ${pkgdir}/usr/share/man/man{5,8}/dhclient*
|
||||||
|
|
||||||
|
# install licenses
|
||||||
|
install -m644 -D ${srcdir}/${pkgbase}-${_pkgver}/LICENSE \
|
||||||
|
${pkgdir}/usr/share/licenses/dhcp/LICENSE
|
||||||
|
}
|
||||||
|
|
||||||
|
package_dhclient(){
|
||||||
|
|
||||||
|
pkgdesc="dhclient is standalone client from the dhcp package"
|
||||||
|
depends=('bash')
|
||||||
|
|
||||||
|
cd ${srcdir}/${pkgname}-${_pkgver}/client/scripts
|
||||||
|
patch -Np1 -i ${srcdir}/dhclient-script-pathFixes.patch linux || return 1
|
||||||
|
cd ${srcdir}/${pkgname}-${_pkgver}/client
|
||||||
|
make DESTDIR=${pkgdir} install
|
||||||
|
install -m755 -d ${startdir}/pkg/var/lib/dhclient
|
||||||
|
|
||||||
|
#not needed after fresh install
|
||||||
|
rm -f ${pkgdir}/var/lib/dhclient/dhcpd.leases
|
||||||
|
|
||||||
|
#move dhclient.conf to dhclient.conf.example
|
||||||
|
mv ${pkgdir}/etc/dhclient.conf ${pkgdir}/etc/dhclient.conf.example
|
||||||
|
|
||||||
|
# install dhclient linux script
|
||||||
|
mkdir ${pkgdir}/sbin
|
||||||
|
install -m755 -D ${srcdir}/${pkgname}-${_pkgver}/client/scripts/linux \
|
||||||
|
${pkgdir}/sbin/dhclient-script
|
||||||
|
# install licenses
|
||||||
|
install -m644 -D ${srcdir}/${pkgname}-${_pkgver}/LICENSE \
|
||||||
|
${pkgdir}/usr/share/licenses/dhclient/LICENSE
|
||||||
|
}
|
118
extra/dhcp/dhclient-script-pathFixes.patch
Normal file
118
extra/dhcp/dhclient-script-pathFixes.patch
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
--- linux 2009-04-21 16:21:09.000000000 +0200
|
||||||
|
+++ linux_new 2010-06-30 19:06:20.000000000 +0200
|
||||||
|
@@ -23,7 +23,7 @@
|
||||||
|
# of the $1 in its args.
|
||||||
|
|
||||||
|
# 'ip' just looks too weird. /sbin/ip looks less weird.
|
||||||
|
-ip=/sbin/ip
|
||||||
|
+ip=/usr/sbin/ip
|
||||||
|
|
||||||
|
make_resolv_conf() {
|
||||||
|
if [ x"$new_domain_name_servers" != x ]; then
|
||||||
|
@@ -112,9 +112,9 @@
|
||||||
|
if [ x$reason = xPREINIT ]; then
|
||||||
|
if [ x$alias_ip_address != x ]; then
|
||||||
|
# Bring down alias interface. Its routes will disappear too.
|
||||||
|
- ifconfig $interface:0- inet 0
|
||||||
|
+ /sbin/ifconfig $interface:0- inet 0
|
||||||
|
fi
|
||||||
|
- ifconfig $interface 0 up
|
||||||
|
+ /sbin/ifconfig $interface 0 up
|
||||||
|
|
||||||
|
# We need to give the kernel some time to get the interface up.
|
||||||
|
sleep 1
|
||||||
|
@@ -141,32 +141,32 @@
|
||||||
|
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
|
||||||
|
[ x$alias_ip_address != x$old_ip_address ]; then
|
||||||
|
# Possible new alias. Remove old alias.
|
||||||
|
- ifconfig $interface:0- inet 0
|
||||||
|
+ /sbin/ifconfig $interface:0- inet 0
|
||||||
|
fi
|
||||||
|
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
|
||||||
|
# IP address changed. Bringing down the interface will delete all routes,
|
||||||
|
# and clear the ARP cache.
|
||||||
|
- ifconfig $interface inet 0 down
|
||||||
|
+ /sbin/ifconfig $interface inet 0 down
|
||||||
|
|
||||||
|
fi
|
||||||
|
if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
|
||||||
|
[ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
|
||||||
|
|
||||||
|
- ifconfig $interface inet $new_ip_address $new_subnet_arg \
|
||||||
|
+ /sbin/ifconfig $interface inet $new_ip_address $new_subnet_arg \
|
||||||
|
$new_broadcast_arg $mtu_arg
|
||||||
|
# Add a network route to the computed network address.
|
||||||
|
for router in $new_routers; do
|
||||||
|
if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
|
||||||
|
- route add -host $router dev $interface
|
||||||
|
+ /sbin/route add -host $router dev $interface
|
||||||
|
fi
|
||||||
|
- route add default gw $router $metric_arg dev $interface
|
||||||
|
+ /sbin/route add default gw $router $metric_arg dev $interface
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
|
||||||
|
then
|
||||||
|
- ifconfig $interface:0- inet 0
|
||||||
|
- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
|
||||||
|
- route add -host $alias_ip_address $interface:0
|
||||||
|
+ /sbin/ifconfig $interface:0- inet 0
|
||||||
|
+ /sbin/ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
|
||||||
|
+ /sbin/route add -host $alias_ip_address $interface:0
|
||||||
|
fi
|
||||||
|
make_resolv_conf
|
||||||
|
exit_with_hooks 0
|
||||||
|
@@ -176,42 +176,42 @@
|
||||||
|
|| [ x$reason = xSTOP ]; then
|
||||||
|
if [ x$alias_ip_address != x ]; then
|
||||||
|
# Turn off alias interface.
|
||||||
|
- ifconfig $interface:0- inet 0
|
||||||
|
+ /sbin/ifconfig $interface:0- inet 0
|
||||||
|
fi
|
||||||
|
if [ x$old_ip_address != x ]; then
|
||||||
|
# Shut down interface, which will delete routes and clear arp cache.
|
||||||
|
- ifconfig $interface inet 0 down
|
||||||
|
+ /sbin/ifconfig $interface inet 0 down
|
||||||
|
fi
|
||||||
|
if [ x$alias_ip_address != x ]; then
|
||||||
|
- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
|
||||||
|
- route add -host $alias_ip_address $interface:0
|
||||||
|
+ /sbin/ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
|
||||||
|
+ /sbin/route add -host $alias_ip_address $interface:0
|
||||||
|
fi
|
||||||
|
exit_with_hooks 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x$reason = xTIMEOUT ]; then
|
||||||
|
if [ x$alias_ip_address != x ]; then
|
||||||
|
- ifconfig $interface:0- inet 0
|
||||||
|
+ /sbin/ifconfig $interface:0- inet 0
|
||||||
|
fi
|
||||||
|
- ifconfig $interface inet $new_ip_address $new_subnet_arg \
|
||||||
|
+ /sbin/ifconfig $interface inet $new_ip_address $new_subnet_arg \
|
||||||
|
$new_broadcast_arg $mtu_arg
|
||||||
|
set $new_routers
|
||||||
|
if ping -q -c 1 $1; then
|
||||||
|
if [ x$new_ip_address != x$alias_ip_address ] && \
|
||||||
|
[ x$alias_ip_address != x ]; then
|
||||||
|
- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
|
||||||
|
- route add -host $alias_ip_address dev $interface:0
|
||||||
|
+ /sbin/ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
|
||||||
|
+ /sbin/route add -host $alias_ip_address dev $interface:0
|
||||||
|
fi
|
||||||
|
for router in $new_routers; do
|
||||||
|
if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
|
||||||
|
- route add -host $router dev $interface
|
||||||
|
+ /sbin/route add -host $router dev $interface
|
||||||
|
fi
|
||||||
|
- route add default gw $router $metric_arg dev $interface
|
||||||
|
+ /sbin/route add default gw $router $metric_arg dev $interface
|
||||||
|
done
|
||||||
|
make_resolv_conf
|
||||||
|
exit_with_hooks 0
|
||||||
|
fi
|
||||||
|
- ifconfig $interface inet 0 down
|
||||||
|
+ /sbin/ifconfig $interface inet 0 down
|
||||||
|
exit_with_hooks 1
|
||||||
|
fi
|
||||||
|
|
39
extra/dhcp/dhcp-4.1.1-missing-ipv6-not-fatal.patch
Normal file
39
extra/dhcp/dhcp-4.1.1-missing-ipv6-not-fatal.patch
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
--- common/discover.c 2009-09-29 21:44:49.000000000 +0200
|
||||||
|
+++ common/discover.c_new 2010-06-30 19:40:02.000000000 +0200
|
||||||
|
@@ -443,7 +443,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DHCPv6
|
||||||
|
- if (local_family == AF_INET6) {
|
||||||
|
+ if ((local_family == AF_INET6) && !access("/proc/net/if_inet6", R_OK)) {
|
||||||
|
ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
|
||||||
|
if (ifaces->fp6 == NULL) {
|
||||||
|
log_error("Error opening '/proc/net/if_inet6' to "
|
||||||
|
@@ -454,6 +454,8 @@
|
||||||
|
ifaces->fp = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
+ } else {
|
||||||
|
+ ifaces->fp6 = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@@ -721,7 +723,7 @@
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#ifdef DHCPv6
|
||||||
|
- if (!(*err)) {
|
||||||
|
+ if (!(*err) && ifaces->fp6) {
|
||||||
|
if (local_family == AF_INET6)
|
||||||
|
return next_iface6(info, err, ifaces);
|
||||||
|
}
|
||||||
|
@@ -740,7 +742,8 @@
|
||||||
|
ifaces->sock = -1;
|
||||||
|
#ifdef DHCPv6
|
||||||
|
if (local_family == AF_INET6) {
|
||||||
|
- fclose(ifaces->fp6);
|
||||||
|
+ if(ifaces->fp6)
|
||||||
|
+ fclose(ifaces->fp6);
|
||||||
|
ifaces->fp6 = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
6
extra/dhcp/dhcp.conf.d
Normal file
6
extra/dhcp/dhcp.conf.d
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#
|
||||||
|
# Arguments to be passed to the DHCP server daemon
|
||||||
|
#
|
||||||
|
|
||||||
|
DHCP_ARGS="-q"
|
||||||
|
|
11
extra/dhcp/dhcp.install
Normal file
11
extra/dhcp/dhcp.install
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# arg 1: the new package version
|
||||||
|
post_install() {
|
||||||
|
[ -f var/state/dhcp/dhcpd.leases ] || : >var/state/dhcp/dhcpd.leases
|
||||||
|
#echo "If dhcpd doesn't start, ensure the ipv6 kernel module is loaded."
|
||||||
|
}
|
||||||
|
|
||||||
|
# arg 1: the new package version
|
||||||
|
# arg 2: the old package version
|
||||||
|
post_upgrade() {
|
||||||
|
post_install $1
|
||||||
|
}
|
40
extra/dhcp/dhcpd
Normal file
40
extra/dhcp/dhcpd
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /etc/rc.conf
|
||||||
|
. /etc/rc.d/functions
|
||||||
|
. /etc/conf.d/dhcp
|
||||||
|
|
||||||
|
PIDFILE="/var/run/dhcpd.pid"
|
||||||
|
PID=`cat $PIDFILE 2>/dev/null`
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
stat_busy "Starting DHCP Server"
|
||||||
|
if [ "$PID" = "" ]; then
|
||||||
|
/usr/sbin/dhcpd $DHCP_ARGS
|
||||||
|
fi
|
||||||
|
if [ "$PID" != "" -o $? -gt 0 ]; then
|
||||||
|
stat_fail
|
||||||
|
else
|
||||||
|
add_daemon dhcpd
|
||||||
|
stat_done
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stat_busy "Stopping DHCP Server"
|
||||||
|
[ ! -z "$PID" ] && kill $PID &> /dev/null
|
||||||
|
rm -f $PIDFILE
|
||||||
|
if [ $? -gt 0 ]; then
|
||||||
|
stat_fail
|
||||||
|
else
|
||||||
|
rm_daemon dhcpd
|
||||||
|
stat_done
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
$0 stop
|
||||||
|
sleep 1
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "usage: $0 {start|stop|restart}"
|
||||||
|
esac
|
Loading…
Reference in a new issue