From 5cd6f8910de61c39af2c6821909bcab36bb983e6 Mon Sep 17 00:00:00 2001 From: Greg Frost Date: Sat, 20 Jun 2009 10:19:54 +0930 Subject: dhcp: added package for use with diskless FEs --- abs/core-testing/dhcp/PKGBUILD | 46 +++++++++++++++++++++++++++++ abs/core-testing/dhcp/dhcp-3.0.3-tr.c.patch | 10 +++++++ abs/core-testing/dhcp/dhcp.install | 15 ++++++++++ abs/core-testing/dhcp/dhcpd | 39 ++++++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 abs/core-testing/dhcp/PKGBUILD create mode 100644 abs/core-testing/dhcp/dhcp-3.0.3-tr.c.patch create mode 100644 abs/core-testing/dhcp/dhcp.install create mode 100755 abs/core-testing/dhcp/dhcpd diff --git a/abs/core-testing/dhcp/PKGBUILD b/abs/core-testing/dhcp/PKGBUILD new file mode 100644 index 0000000..f426778 --- /dev/null +++ b/abs/core-testing/dhcp/PKGBUILD @@ -0,0 +1,46 @@ +# $Id: PKGBUILD 23123 2009-01-03 02:43:02Z kevin $ +# Maintainer: judd +pkgname=dhcp +pkgver=4.1.0 +pkgrel=1 +pkgdesc="A DHCP server, client, and relay agent" +arch=(i686 x86_64) +license=('custom:isc-dhcp') +url="http://www.isc.org/sw/dhcp/" +depends=('openssl>=0.9.8a') +backup=('etc/dhcpd.conf' 'etc/dhclient.conf') +install=dhcp.install +source=(http://ftp.isc.org/isc/dhcp/dhcp-${pkgver}.tar.gz dhcp-3.0.3-tr.c.patch +dhcpd) +md5sums=('1fffed2e8c3d67b111316d6a9b33db7a' '39866416303b674df08b66b2d094e523' + '025b8fe98b6c0814428b671b1819a810') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + patch -p1 -i ../dhcp-3.0.3-tr.c.patch || return 1 + # Define _GNU_SOURCE to fix IPV6. + sed '/^CFLAGS="$CFLAGS/ s/INGS"/INGS -D_GNU_SOURCE"/' -i configure + ./configure --prefix=/usr --sysconfdir=/etc \ + --with-srv-lease-file=/var/state/dhcp/dhcpd.leases \ + --with-srv6-lease-file=/var/state/dhcp/dhcpd6.leases + make || return 1 + make DESTDIR=${pkgdir} install + + #install -D -m644 server/dhcpd.conf ${pkgdir}/etc/dhcpd.conf + #install -D -m644 client/dhclient.conf ${pkgdir}/etc/dhclient.conf + install -D -m755 ${srcdir}/dhcpd ${pkgdir}/etc/rc.d/dhcpd + mkdir -p ${pkgdir}/var/state/dhcp + #touch ${pkgdir}/var/state/dhcp/dhcpd.leases + #chmod -R 644 ${pkgdir}/usr/share/man/* + #chmod 755 ${pkgdir}/usr/share/man/man{1,3,5,8} + #sed -i 's|etc/dhclient-script|sbin/dhclient-script|g' \ + #${pkgdir}/etc/dhclient.conf + #rm -f ${pkgdir}/var/state/dhcp/dhcpd.leases + #rm -f ${pkgdir}/sbin/{dhclient,dhclient-script} + rm -f ${pkgdir}/etc/dhclient.conf + rm -f ${pkgdir}/usr/sbin/dhclient + rm -f ${pkgdir}/usr/share/man/man{5,8}/dhclient* + # install licenses + install -m644 -D ${srcdir}/${pkgname}-${pkgver}/LICENSE \ + ${pkgdir}/usr/share/licenses/dhcp/LICENSE +} diff --git a/abs/core-testing/dhcp/dhcp-3.0.3-tr.c.patch b/abs/core-testing/dhcp/dhcp-3.0.3-tr.c.patch new file mode 100644 index 0000000..e262c5e --- /dev/null +++ b/abs/core-testing/dhcp/dhcp-3.0.3-tr.c.patch @@ -0,0 +1,10 @@ +--- work.linux-2.2/common/tr.c 2005/08/14 11:34:24 1.1 ++++ work.linux-2.2/common/tr.c 2005/08/14 11:35:16 +@@ -40,6 +40,7 @@ static char copyright[] = + #include "includes/netinet/if_ether.h" + #include "netinet/if_tr.h" + #include ++#include + + /* + * token ring device handling subroutines. These are required as token-ring diff --git a/abs/core-testing/dhcp/dhcp.install b/abs/core-testing/dhcp/dhcp.install new file mode 100644 index 0000000..edb84b1 --- /dev/null +++ b/abs/core-testing/dhcp/dhcp.install @@ -0,0 +1,15 @@ +# arg 1: the new package version +post_install() { + [ -f var/state/dhcp/dhcpd.leases ] || : >var/state/dhcp/dhcpd.leases + echo "If dhcpd doesn' start ensure the ipv6 kernel module is loaded." +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + post_install $1 +} + +op=$1 +shift +$op $* diff --git a/abs/core-testing/dhcp/dhcpd b/abs/core-testing/dhcp/dhcpd new file mode 100755 index 0000000..0aebcc8 --- /dev/null +++ b/abs/core-testing/dhcp/dhcpd @@ -0,0 +1,39 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +PIDFILE="/var/run/dhcpd.pid" +PID=`cat $PIDFILE 2>/dev/null` +case "$1" in + start) + stat_busy "Starting DHCP Server" + if [ "$PID" = "" ]; then + /usr/sbin/dhcpd -q + fi + if [ "$PID" != "" -o $? -gt 0 ]; then + stat_fail + else + add_daemon dhcpd + stat_done + fi + ;; + stop) + stat_busy "Stopping DHCP Server" + [ ! -z "$PID" ] && kill $PID &> /dev/null + rm -f $PIDFILE + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon dhcpd + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac -- cgit v0.12 From 87ee63ae6cc83c1d660a3fafe10d94ae06318e8e Mon Sep 17 00:00:00 2001 From: Greg Frost Date: Sat, 20 Jun 2009 12:47:20 +0930 Subject: tftp-hpa: added. runit-scripts: added run scripts for dhcpd and tftpd --- abs/core-testing/runit-scripts/PKGBUILD | 2 +- .../runit-scripts/runitscripts/services/dhcpd/run | 8 +++++ .../runit-scripts/runitscripts/services/tftpd/run | 8 +++++ abs/core-testing/tftp-hpa/LICENSE | 32 ++++++++++++++++++ abs/core-testing/tftp-hpa/PKGBUILD | 29 +++++++++++++++++ abs/core-testing/tftp-hpa/tftpd.conf | 4 +++ abs/core-testing/tftp-hpa/tftpd.rc | 38 ++++++++++++++++++++++ 7 files changed, 120 insertions(+), 1 deletion(-) create mode 100755 abs/core-testing/runit-scripts/runitscripts/services/dhcpd/run create mode 100755 abs/core-testing/runit-scripts/runitscripts/services/tftpd/run create mode 100644 abs/core-testing/tftp-hpa/LICENSE create mode 100644 abs/core-testing/tftp-hpa/PKGBUILD create mode 100644 abs/core-testing/tftp-hpa/tftpd.conf create mode 100755 abs/core-testing/tftp-hpa/tftpd.rc diff --git a/abs/core-testing/runit-scripts/PKGBUILD b/abs/core-testing/runit-scripts/PKGBUILD index efe7947..852c658 100755 --- a/abs/core-testing/runit-scripts/PKGBUILD +++ b/abs/core-testing/runit-scripts/PKGBUILD @@ -1,6 +1,6 @@ pkgname=runit-scripts pkgver=1.8.0 -pkgrel=87 +pkgrel=88 pkgdesc="collection of startup scripts for runit" url="http://smarden.org/runit/" license="BSD" diff --git a/abs/core-testing/runit-scripts/runitscripts/services/dhcpd/run b/abs/core-testing/runit-scripts/runitscripts/services/dhcpd/run new file mode 100755 index 0000000..38ae40a --- /dev/null +++ b/abs/core-testing/runit-scripts/runitscripts/services/dhcpd/run @@ -0,0 +1,8 @@ +#!/bin/sh +export TERM=linux +. /etc/rc.conf +. /etc/rc.d/functions +stat_runit "Starting dhcpd" + + +exec /usr/sbin/dhcpd -f &> /var/log/dhcpd.log diff --git a/abs/core-testing/runit-scripts/runitscripts/services/tftpd/run b/abs/core-testing/runit-scripts/runitscripts/services/tftpd/run new file mode 100755 index 0000000..8f742ca --- /dev/null +++ b/abs/core-testing/runit-scripts/runitscripts/services/tftpd/run @@ -0,0 +1,8 @@ +#!/bin/sh +export TERM=linux +. /etc/rc.conf +. /etc/rc.d/functions +stat_runit "Starting tftpd" + + +exec /usr/sbin/in.tftpd --foreground -s /tftpboot diff --git a/abs/core-testing/tftp-hpa/LICENSE b/abs/core-testing/tftp-hpa/LICENSE new file mode 100644 index 0000000..6dade69 --- /dev/null +++ b/abs/core-testing/tftp-hpa/LICENSE @@ -0,0 +1,32 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff --git a/abs/core-testing/tftp-hpa/PKGBUILD b/abs/core-testing/tftp-hpa/PKGBUILD new file mode 100644 index 0000000..cf1c9e0 --- /dev/null +++ b/abs/core-testing/tftp-hpa/PKGBUILD @@ -0,0 +1,29 @@ +# $Id: PKGBUILD 37555 2009-05-02 22:51:20Z eric $ +# Maintainer: dorphell +# Contributor: Jose Javier +pkgname=tftp-hpa +pkgver=5.0 +pkgrel=2 +pkgdesc="Official tftp server" +arch=('i686' 'x86_64') +url="http://www.kernel.org/pub/software/network/tftp/" +license=('BSD') +depends=('tcp_wrappers') +conflicts=('netkit-tftp') +backup=('etc/conf.d/tftpd') +source=(http://www.kernel.org/pub/software/network/tftp/$pkgname-$pkgver.tar.gz tftpd.rc tftpd.conf LICENSE) +md5sums=('1ae813a94670f0d8c294aafa9f5ecf65' 'a974d02526f19222146c8e3d3b598871'\ + '414a79dc891bced056d99a9bb790fc9e' '6ce21e27b6fdc1a1adf85c81e42aeecf') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + ./configure --prefix=/usr --mandir=/usr/share/man || return 1 + make || return 1 + make INSTALLROOT="${pkgdir}" install || return 1 + install -d "${pkgdir}/etc/rc.d" + install -d "${pkgdir}/var/tftpboot" + install -m755 "${srcdir}/tftpd.rc" "${pkgdir}/etc/rc.d/tftpd" || return 1 + install -D -m644 "${srcdir}/tftpd.conf" "${pkgdir}/etc/conf.d/tftpd" || return 1 + rm "${pkgdir}/usr/share/man/man8/tftpd.8" + install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" +} diff --git a/abs/core-testing/tftp-hpa/tftpd.conf b/abs/core-testing/tftp-hpa/tftpd.conf new file mode 100644 index 0000000..4705cc3 --- /dev/null +++ b/abs/core-testing/tftp-hpa/tftpd.conf @@ -0,0 +1,4 @@ +# +# Parameters to be passed to TFTPD +# +TFTPD_ARGS="-l -s /var/tftpboot" diff --git a/abs/core-testing/tftp-hpa/tftpd.rc b/abs/core-testing/tftp-hpa/tftpd.rc new file mode 100755 index 0000000..b21f87f --- /dev/null +++ b/abs/core-testing/tftp-hpa/tftpd.rc @@ -0,0 +1,38 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +TFTPD_ARGS= +[ -f /etc/conf.d/tftpd ] && . /etc/conf.d/tftpd + +PID=$(pidof -o %PPID /usr/sbin/in.tftpd) +case "$1" in + start) + stat_busy "Starting TFTPD" + [ -z "$PID" ] && /usr/sbin/in.tftpd ${TFTPD_ARGS} + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon in.tftpd + stat_done + fi + ;; + stop) + stat_busy "Stopping TFTPD" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon in.tftpd + stat_done + fi + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 -- cgit v0.12