From 7044886c8c029202054492c65a1a83b485a40223 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 17 Jul 2009 08:26:50 +0000 Subject: extra/dhcp: upgrade to 4.1.0_p1. rename init.d script to dhcpd partly fixes #64 --- extra/dhcp/APKBUILD | 33 +++++++++++--------- extra/dhcp/dhcp.confd | 30 ------------------ extra/dhcp/dhcp.initd | 72 -------------------------------------------- extra/dhcp/dhcp.post-upgrade | 18 +++++++++++ extra/dhcp/dhcp.pre-upgrade | 8 +++++ extra/dhcp/dhcpd.confd | 30 ++++++++++++++++++ extra/dhcp/dhcpd.initd | 72 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 146 insertions(+), 117 deletions(-) delete mode 100644 extra/dhcp/dhcp.confd delete mode 100644 extra/dhcp/dhcp.initd create mode 100644 extra/dhcp/dhcp.post-upgrade create mode 100644 extra/dhcp/dhcp.pre-upgrade create mode 100644 extra/dhcp/dhcpd.confd create mode 100644 extra/dhcp/dhcpd.initd diff --git a/extra/dhcp/APKBUILD b/extra/dhcp/APKBUILD index f3d4ec271c5..01bb25e91d1 100644 --- a/extra/dhcp/APKBUILD +++ b/extra/dhcp/APKBUILD @@ -1,21 +1,22 @@ -# Contributor: -# Maintainer: +# Maintainer: Natanael Copa pkgname=dhcp -pkgver=4.1.0 +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="uclibc" -makedepends="" -install= +depends= +makedepends= +install="dhcp.pre-upgrade dhcp.post-upgrade" subpackages="$pkgname-doc $pkgname-dev" -source="http://ftp.isc.org/isc/dhcp/$pkgname-$pkgver.tar.gz - dhcp.confd - dhcp.initd" +source="http://ftp.isc.org/isc/dhcp/$pkgname-$_realver.tar.gz + $install + dhcpd.confd + dhcpd.initd" build() { - cd "$srcdir/$pkgname-$pkgver" + cd "$srcdir/$pkgname-$_realver" ./configure --prefix=/usr \ --sysconfdir=/etc \ @@ -24,10 +25,12 @@ build() { 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 + install -m755 -D "$srcdir"/dhcpd.initd "$pkgdir"/etc/init.d/dhcpd + install -m644 -D "$srcdir"/dhcpd.confd "$pkgdir"/etc/conf.d/dhcpd } -md5sums="1fffed2e8c3d67b111316d6a9b33db7a dhcp-4.1.0.tar.gz -df32707f5bbe5363306420b5dc6e6b40 dhcp.confd -5df9a87539bedc98a1cbc7e38b290928 dhcp.initd" +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/extra/dhcp/dhcp.confd b/extra/dhcp/dhcp.confd deleted file mode 100644 index df09ec7082f..00000000000 --- a/extra/dhcp/dhcp.confd +++ /dev/null @@ -1,30 +0,0 @@ -# /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 deleted file mode 100644 index cc9727fc7c8..00000000000 --- a/extra/dhcp/dhcp.initd +++ /dev/null @@ -1,72 +0,0 @@ -#!/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 $? -} - diff --git a/extra/dhcp/dhcp.post-upgrade b/extra/dhcp/dhcp.post-upgrade new file mode 100644 index 00000000000..b16fea6b4af --- /dev/null +++ b/extra/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/extra/dhcp/dhcp.pre-upgrade b/extra/dhcp/dhcp.pre-upgrade new file mode 100644 index 00000000000..090f654b9a4 --- /dev/null +++ b/extra/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/extra/dhcp/dhcpd.confd b/extra/dhcp/dhcpd.confd new file mode 100644 index 00000000000..df09ec7082f --- /dev/null +++ b/extra/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/extra/dhcp/dhcpd.initd b/extra/dhcp/dhcpd.initd new file mode 100644 index 00000000000..cc9727fc7c8 --- /dev/null +++ b/extra/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 $? +} + -- cgit v1.2.3