mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-05-05 20:36:40 +02:00
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
This commit is contained in:
parent
37907999d1
commit
de25f1da2b
@ -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"
|
||||
|
||||
5
main/dhcp/dhcp.post-install
Normal file
5
main/dhcp/dhcp.post-install
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
chown dhcp:dhcp var/run/dhcp var/lib/dhcp
|
||||
exit 0
|
||||
|
||||
@ -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
|
||||
|
||||
5
main/dhcp/dhcp.pre-install
Normal file
5
main/dhcp/dhcp.pre-install
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
adduser -h /var/lib/dhcp -s /bin/false -D dhcp 2>/dev/null
|
||||
exit 0
|
||||
|
||||
@ -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 $?
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user