aboutsummaryrefslogtreecommitdiffstats
path: root/main/dhcp
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-07-31 06:14:49 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-07-31 06:23:23 +0000
commitde25f1da2b2c5f49e7917971b2e324cb0773fa30 (patch)
treeb54e128a26a4c6b8c7e08838fefffbdfdef15d87 /main/dhcp
parent37907999d18ebba37db13bfa7415401922eb6141 (diff)
downloadaports-de25f1da2b2c5f49e7917971b2e324cb0773fa30.tar.bz2
aports-de25f1da2b2c5f49e7917971b2e324cb0773fa30.tar.xz
main/dhcp: fix paths to lease files and configs
also * enable paranoia for -user/-group options * fix install scripts * import new init.d script * add missing dirs * move dhclient to a separate subpackage Fixes #110
Diffstat (limited to 'main/dhcp')
-rw-r--r--main/dhcp/APKBUILD32
-rw-r--r--main/dhcp/dhcp.post-install5
-rw-r--r--main/dhcp/dhcp.post-upgrade3
-rw-r--r--main/dhcp/dhcp.pre-install5
-rw-r--r--main/dhcp/dhcpd.initd28
5 files changed, 63 insertions, 10 deletions
diff --git a/main/dhcp/APKBUILD b/main/dhcp/APKBUILD
index 01bb25e91d..284e15eeea 100644
--- a/main/dhcp/APKBUILD
+++ b/main/dhcp/APKBUILD
@@ -2,14 +2,14 @@
pkgname=dhcp
pkgver=4.1.0_p1
_realver=4.1.0p1
-pkgrel=0
+pkgrel=1
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"
+install="dhcp.pre-install dhcp.pre-upgrade dhcp.post-upgrade"
+subpackages="$pkgname-doc $pkgname-dev dhclient"
source="http://ftp.isc.org/isc/dhcp/$pkgname-$_realver.tar.gz
$install
dhcpd.confd
@@ -19,7 +19,14 @@ build() {
cd "$srcdir/$pkgname-$_realver"
./configure --prefix=/usr \
- --sysconfdir=/etc \
+ --sysconfdir=/etc/dhcp \
+ --with-cli-pid-file=/var/run/dhcp/dhclient.pid \
+ --with-cli-lease-file=/var/lib/dhcp/dhclient.leases \
+ --with-srv-pid-file=/var/run/dhcp/dhcpd.pid \
+ --with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
+ --with-relay-pid-file=/var/run/dhcp/dhcrelay.pid \
+ --enable-dhcpv6 \
+ --enable-paranoia \
--mandir=/usr/share/man \
--infodir=/usr/share/info
make || return 1
@@ -27,10 +34,23 @@ build() {
install -m755 -D "$srcdir"/dhcpd.initd "$pkgdir"/etc/init.d/dhcpd
install -m644 -D "$srcdir"/dhcpd.confd "$pkgdir"/etc/conf.d/dhcpd
+ install -d "$pkgdir"/var/lib/dhcp
+ install -d "$pkgdir"/var/run/dhcp
+}
+
+dhclient() {
+ pkgdesc="ISC dhcp client"
+ install -d "$subpkgdir"/var/lib/dhcp
+ install -d "$subpkgdir"/var/run/dhcp
+ install -d "$subpkgdir"/usr/sbin
+ install -d "$subpkgdir"/etc/dhcp
+ mv "$pkgdir"/usr/sbin/dhclient "$subpkgdir"/usr/sbin/
+ mv "$pkgdir"/etc/dhcp/dhclient.conf "$subpkgdir"/etc/dhcp/
}
md5sums="325ff8338c5a21f89d5304ac13ffebdf dhcp-4.1.0p1.tar.gz
+19b28380eaae7d26027c29b623aeee07 dhcp.pre-install
6cc49497f3c30ccd37fc7c032f7810c6 dhcp.pre-upgrade
-a7b81948ceab73dd10de275ebc00e7eb dhcp.post-upgrade
+36d562e5b0e55a36e4224fd7cb843f6a dhcp.post-upgrade
df32707f5bbe5363306420b5dc6e6b40 dhcpd.confd
-5df9a87539bedc98a1cbc7e38b290928 dhcpd.initd"
+6ed5ddba2b445ef60d27a8b7f5a0ee0b dhcpd.initd"
diff --git a/main/dhcp/dhcp.post-install b/main/dhcp/dhcp.post-install
new file mode 100644
index 0000000000..01195dbd34
--- /dev/null
+++ b/main/dhcp/dhcp.post-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+chown dhcp:dhcp var/run/dhcp var/lib/dhcp
+exit 0
+
diff --git a/main/dhcp/dhcp.post-upgrade b/main/dhcp/dhcp.post-upgrade
index b16fea6b4a..19df74a47b 100644
--- a/main/dhcp/dhcp.post-upgrade
+++ b/main/dhcp/dhcp.post-upgrade
@@ -5,7 +5,8 @@
moved=
for i in /etc/runlevel/*/dhcp; do
if [ -L "$i" ]; then
- mv ${i} ${i}d
+ rm $i
+ ln -s /etc/init.d/clamsmtpd ${i}d
moved=1
fi
done
diff --git a/main/dhcp/dhcp.pre-install b/main/dhcp/dhcp.pre-install
new file mode 100644
index 0000000000..9c623bfb9e
--- /dev/null
+++ b/main/dhcp/dhcp.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+adduser -h /var/lib/dhcp -s /bin/false -D dhcp 2>/dev/null
+exit 0
+
diff --git a/main/dhcp/dhcpd.initd b/main/dhcp/dhcpd.initd
index cc9727fc7c..82cb26e779 100644
--- a/main/dhcp/dhcpd.initd
+++ b/main/dhcp/dhcpd.initd
@@ -1,7 +1,9 @@
#!/sbin/runscript
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2009 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 $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcpd.init2,v 1.1 2009/07/09 14:45:22 chainsaw Exp $
+
+opts="configtest"
DHCPD_CONF=${DHCPD_CONF:-/etc/dhcp/dhcpd.conf}
@@ -15,6 +17,23 @@ get_var() {
"${DHCPD_CHROOT}/${DHCPD_CONF}"
}
+checkconfig() {
+ /usr/sbin/dhcpd -cf ${DHCPD_CHROOT}/${DHCPD_CONF} -t 1>/dev/null 2>&1
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ eerror "${SVCNAME} has detected a syntax error in your configuration files:"
+ /usr/sbin/dhcpd -cf ${DHCPD_CHROOT}/${DHCPD_CONF} -t
+ fi
+
+ return $ret
+}
+
+configtest() {
+ ebegin "Checking ${SVCNAME} configuration"
+ checkconfig
+ eend $?
+}
+
start() {
# Work out our cffile if it's on our DHCPD_OPTS
case " ${DHCPD_OPTS} " in
@@ -32,6 +51,8 @@ start() {
return 1
fi
+ checkconfig || return 1
+
local leasefile="$(get_var lease-file-name)"
leasefile="${DHCPD_CHROOT}/${leasefile:-/var/lib/dhcp/dhcpd.leases}"
if [ ! -f "${leasefile}" ] ; then
@@ -63,10 +84,11 @@ start() {
stop() {
local chroot="$(get_options chroot)"
+
+ checkconfig || return 1
ebegin "Stopping ${chroot:+chrooted }${SVCNAME}"
start-stop-daemon --stop --exec /usr/sbin/dhcpd \
--pidfile "${chroot}/$(get_options pidfile)"
eend $?
}
-