diff options
author | Michael Mason <ms13sp@gmail.com> | 2009-03-18 17:05:04 +0000 |
---|---|---|
committer | Michael Mason <ms13sp@gmail.com> | 2009-03-18 17:05:04 +0000 |
commit | c746a58e0fee8f3cccc01f97f53ab20e5b733c16 (patch) | |
tree | 71bfccb5fdedf36cdfea060a5ea21dec5f109ed2 | |
parent | f59fc0dd7bbc2469ada752fe6edc96dea3da8c04 (diff) | |
download | aports-c746a58e0fee8f3cccc01f97f53ab20e5b733c16.tar.bz2 aports-c746a58e0fee8f3cccc01f97f53ab20e5b733c16.tar.xz |
testing/dhcp Initial commit. Need to test
-rw-r--r-- | testing/dhcp/APKBUILD | 33 | ||||
-rw-r--r-- | testing/dhcp/dhcp.confd | 30 | ||||
-rw-r--r-- | testing/dhcp/dhcp.initd | 72 |
3 files changed, 135 insertions, 0 deletions
diff --git a/testing/dhcp/APKBUILD b/testing/dhcp/APKBUILD new file mode 100644 index 000000000..f3d4ec271 --- /dev/null +++ b/testing/dhcp/APKBUILD @@ -0,0 +1,33 @@ +# Contributor: +# Maintainer: +pkgname=dhcp +pkgver=4.1.0 +pkgrel=0 +pkgdesc="ISC Dynamic Host Configuration Protocol (DHCP)" +url="https://www.isc.org/" +license="GPL" +depends="uclibc" +makedepends="" +install= +subpackages="$pkgname-doc $pkgname-dev" +source="http://ftp.isc.org/isc/dhcp/$pkgname-$pkgver.tar.gz + dhcp.confd + dhcp.initd" + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 + make DESTDIR="$pkgdir" install + + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname +} + +md5sums="1fffed2e8c3d67b111316d6a9b33db7a dhcp-4.1.0.tar.gz +df32707f5bbe5363306420b5dc6e6b40 dhcp.confd +5df9a87539bedc98a1cbc7e38b290928 dhcp.initd" diff --git a/testing/dhcp/dhcp.confd b/testing/dhcp/dhcp.confd new file mode 100644 index 000000000..df09ec708 --- /dev/null +++ b/testing/dhcp/dhcp.confd @@ -0,0 +1,30 @@ +# /etc/conf.d/dhcpd: config file for /etc/init.d/dhcpd + +# If you require more than one instance of dhcpd you can create symbolic +# links to dhcpd service like so +# cd /etc/init.d +# ln -s dhcpd dhcpd.foo +# cd ../conf.d +# cp dhcpd dhcpd.foo +# Now you can edit dhcpd.foo and specify a different configuration file. +# You'll also need to specify a pidfile in that dhcpd.conf file. +# See the pid-file-name option in the dhcpd.conf man page for details. + +# If you wish to run dhcpd in a chroot, uncomment the following line +# DHCPD_CHROOT="/chroot/dhcp" + +# Then run emerge dhcp --config +# All file paths below are relative to the chroot. +# You can specify a different chroot directory but MAKE SURE it's empty. + +# Specify a configuration file - the default is /etc/dhcp/dhcpd.conf +# DHCPD_CONF="/etc/dhcp/dhcpd.conf" + +# Configure which interface or interfaces to for dhcpd to listen on. +# List all interfaces space separated. If this is not specified then +# we listen on all interfaces. +# DHCPD_IFACE="" + +# Insert any other dhcpd options - see the man page for a full list. +# DHCPD_OPTS="" + diff --git a/testing/dhcp/dhcp.initd b/testing/dhcp/dhcp.initd new file mode 100644 index 000000000..cc9727fc7 --- /dev/null +++ b/testing/dhcp/dhcp.initd @@ -0,0 +1,72 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/net-misc/dhcp/files/dhcpd.init,v 1.5 2007/04/02 12:34:01 uberlord Exp $ + +DHCPD_CONF=${DHCPD_CONF:-/etc/dhcp/dhcpd.conf} + +depend() { + need net + use logger dns +} + +get_var() { + sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' \ + "${DHCPD_CHROOT}/${DHCPD_CONF}" +} + +start() { + # Work out our cffile if it's on our DHCPD_OPTS + case " ${DHCPD_OPTS} " in + *" -cf "*) + DHCPD_CONF=" ${DHCPD_OPTS} " + DHCPD_CONF="${DHCPD_CONF##* -cf }" + DHCPD_CONF="${DHCPD_CONF%% *}" + ;; + *) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}" + ;; + esac + + if [ ! -f "${DHCPD_CHROOT}/${DHCPD_CONF}" ] ; then + eerror "${DHCPD_CHROOT}/${DHCPD_CONF} does not exist" + return 1 + fi + + local leasefile="$(get_var lease-file-name)" + leasefile="${DHCPD_CHROOT}/${leasefile:-/var/lib/dhcp/dhcpd.leases}" + if [ ! -f "${leasefile}" ] ; then + ebegin "Creating ${leasefile}" + touch "${leasefile}" + chown dhcp:dhcp "${leasefile}" + eend $? || return 1 + fi + + # Setup LD_PRELOAD so name resolution works in our chroot. + if [ -n "${DHCPD_CHROOT}" ] ; then + LD_PRELOAD="${LD_PRELOAD} /usr/lib/libresolv.so" + export LD_PRELOAD="${LD_PRELOAD} /usr/lib/libnss_dns.so" + fi + + local pidfile="$(get_var pid-file-name)" + pidfile="${pidfile:-/var/run/dhcp/dhcpd.pid}" + + ebegin "Starting ${DHCPD_CHROOT:+chrooted }${SVCNAME}" + start-stop-daemon --start --exec /usr/sbin/dhcpd \ + --pidfile "${DHCPD_CHROOT}/${pidfile}" \ + -- ${DHCPD_OPTS} -q -pf "${pidfile}" \ + -user dhcp -group dhcp \ + ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} ${DHCPD_IFACE} + eend $? \ + && save_options chroot "${DHCPD_CHROOT}" \ + && save_options pidfile "${pidfile}" +} + +stop() { + local chroot="$(get_options chroot)" + + ebegin "Stopping ${chroot:+chrooted }${SVCNAME}" + start-stop-daemon --stop --exec /usr/sbin/dhcpd \ + --pidfile "${chroot}/$(get_options pidfile)" + eend $? +} + |