summaryrefslogtreecommitdiffstats
path: root/extra/dhcp
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-03-20 08:13:31 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-03-20 08:13:31 +0000
commit6277138938cfe1935fb6d189e19860874d9fb903 (patch)
tree39ad3d95d9278dbbde34a1b695abb93353550362 /extra/dhcp
parent399d63b082b5275f4b1ddca2670b5525de31110e (diff)
parent7598c40207fc8061cf25872b7624cec261cad6c4 (diff)
downloadaports-6277138938cfe1935fb6d189e19860874d9fb903.tar.bz2
aports-6277138938cfe1935fb6d189e19860874d9fb903.tar.xz
Merge remote branch 'ms13sp/master'
Diffstat (limited to 'extra/dhcp')
-rw-r--r--extra/dhcp/APKBUILD33
-rw-r--r--extra/dhcp/dhcp.confd30
-rw-r--r--extra/dhcp/dhcp.initd72
3 files changed, 135 insertions, 0 deletions
diff --git a/extra/dhcp/APKBUILD b/extra/dhcp/APKBUILD
new file mode 100644
index 00000000..f3d4ec27
--- /dev/null
+++ b/extra/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/extra/dhcp/dhcp.confd b/extra/dhcp/dhcp.confd
new file mode 100644
index 00000000..df09ec70
--- /dev/null
+++ b/extra/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/extra/dhcp/dhcp.initd b/extra/dhcp/dhcp.initd
new file mode 100644
index 00000000..cc9727fc
--- /dev/null
+++ b/extra/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 $?
+}
+