diff options
Diffstat (limited to 'main/dhcp')
-rw-r--r-- | main/dhcp/APKBUILD | 36 | ||||
-rw-r--r-- | main/dhcp/dhcp.post-upgrade | 18 | ||||
-rw-r--r-- | main/dhcp/dhcp.pre-upgrade | 8 | ||||
-rw-r--r-- | main/dhcp/dhcpd.confd | 30 | ||||
-rw-r--r-- | main/dhcp/dhcpd.initd | 72 |
5 files changed, 164 insertions, 0 deletions
diff --git a/main/dhcp/APKBUILD b/main/dhcp/APKBUILD new file mode 100644 index 000000000..01bb25e91 --- /dev/null +++ b/main/dhcp/APKBUILD @@ -0,0 +1,36 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=dhcp +pkgver=4.1.0_p1 +_realver=4.1.0p1 +pkgrel=0 +pkgdesc="ISC Dynamic Host Configuration Protocol (DHCP)" +url="https://www.isc.org/" +license="GPL" +depends= +makedepends= +install="dhcp.pre-upgrade dhcp.post-upgrade" +subpackages="$pkgname-doc $pkgname-dev" +source="http://ftp.isc.org/isc/dhcp/$pkgname-$_realver.tar.gz + $install + dhcpd.confd + dhcpd.initd" + +build() { + cd "$srcdir/$pkgname-$_realver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 + make DESTDIR="$pkgdir" install + + install -m755 -D "$srcdir"/dhcpd.initd "$pkgdir"/etc/init.d/dhcpd + install -m644 -D "$srcdir"/dhcpd.confd "$pkgdir"/etc/conf.d/dhcpd +} + +md5sums="325ff8338c5a21f89d5304ac13ffebdf dhcp-4.1.0p1.tar.gz +6cc49497f3c30ccd37fc7c032f7810c6 dhcp.pre-upgrade +a7b81948ceab73dd10de275ebc00e7eb dhcp.post-upgrade +df32707f5bbe5363306420b5dc6e6b40 dhcpd.confd +5df9a87539bedc98a1cbc7e38b290928 dhcpd.initd" diff --git a/main/dhcp/dhcp.post-upgrade b/main/dhcp/dhcp.post-upgrade new file mode 100644 index 000000000..b16fea6b4 --- /dev/null +++ b/main/dhcp/dhcp.post-upgrade @@ -0,0 +1,18 @@ +#!/bin/sh + +# we have renamed dhcp to dhcpd. Try cleanup for users + +moved= +for i in /etc/runlevel/*/dhcp; do + if [ -L "$i" ]; then + mv ${i} ${i}d + moved=1 + fi +done + +if [ -n "$moved" ]; then + echo " *" + echo " * NOTICE: the /etc/init.d/dhcp script have been renamed to /etc/init.d/dhcpd" + echo " *" +fi + diff --git a/main/dhcp/dhcp.pre-upgrade b/main/dhcp/dhcp.pre-upgrade new file mode 100644 index 000000000..090f654b9 --- /dev/null +++ b/main/dhcp/dhcp.pre-upgrade @@ -0,0 +1,8 @@ +#!/bin/sh + +# script renamed. Try save users settings if needed + +if [ -f /etc/conf.d/dhcp ] && [ ! -f /etc/conf.d/dhcpd ]; then + mv /etc/conf.d/dhcp /etc/conf.d/dhcpd +fi + diff --git a/main/dhcp/dhcpd.confd b/main/dhcp/dhcpd.confd new file mode 100644 index 000000000..df09ec708 --- /dev/null +++ b/main/dhcp/dhcpd.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/main/dhcp/dhcpd.initd b/main/dhcp/dhcpd.initd new file mode 100644 index 000000000..cc9727fc7 --- /dev/null +++ b/main/dhcp/dhcpd.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 $? +} + |