Skip to content

Commit

Permalink
ISC DHCP 3.0.5 for Irix 6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tgc committed Jan 19, 2007
1 parent fa8100b commit 2195e98
Show file tree
Hide file tree
Showing 6 changed files with 510 additions and 0 deletions.
106 changes: 106 additions & 0 deletions dhcp/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/usr/tgcware/bin/bash
#
# This is a generic build.sh script
# It can be used nearly unmodified with many packages
#
# build.sh helper functions
. ${BUILDPKG_BASE}/scripts/build.sh.functions
#
###########################################################
# Check the following 4 variables before running the script
topdir=dhcp
version=3.0.5
pkgver=1
source[0]=$topdir-$version.tar.gz
# If there are no patches, simply comment this
patch[0]=dhcp-3.0.5-irix.patch

# Source function library
. ${BUILDPKG_BASE}/scripts/buildpkg.functions

# Global settings
configure_args=""
check_ac=0
# No good way around this
PATH=$(echo $PATH | sed -e 's/gcc//g')
subsysconf=$metadir/subsys.conf

reg prep
prep()
{
generic_prep
}

reg build
build()
{
setdir source
cat <<EOF > site.conf
VARDB=${prefix}/${_sysconfdir}/dhcp
VARRUN=/var/run
USERBINDIR=${prefix}/${_bindir}
BINDIR=${prefix}/${_sbindir}
CLIENTBINDIR=${prefix}/${_sbindir}
ADMMANDIR=${prefix}/${_mandir}/man8
FFMANDIR=${prefix}/${_mandir}/man5
LIBMANDIR=${prefix}/${_mandir}/man3
USRMANDIR=${prefix}/${_mandir}/man1
LIBDIR=${prefix}/${_libdir}
INCDIR=${prefix}/${_includedir}
ETC=${prefix}/${_sysconfdir}
EOF
cat <<EOF >>includes/site.h
#define _PATH_DHCPD_DB "${prefix}/${_sysconfdir}/dhcp/dhcpd.leases"
#define _PATH_DHCLIENT_DB "${prefix}/${_sysconfdir}/dhcp/dhclient.leases"
#define _PATH_DHCPD_CONF "${prefix}/${_sysconfdir}/dhcpd.conf"
#define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
EOF
$CP includes/site.h .
generic_build
}

reg install
install()
{
generic_install DESTDIR

$MKDIR -p ${stagedir}/${_sysconfdir}/{init.d,rc0.d,rc2.d,config}

# Install initscript
$CP $metadir/dhcpd.init.irix ${stagedir}/${_sysconfdir}/init.d/tgc_dhcpd
chmod 755 ${stagedir}/${_sysconfdir}/init.d/tgc_dhcpd
(setdir ${stagedir}/${_sysconfdir}/rc0.d; $LN -sf ../init.d/tgc_dhcpd K02tgc_dhcpd)
(setdir ${stagedir}/${_sysconfdir}/rc2.d; $LN -sf ../init.d/tgc_dhcpd S99tgc_dhcpd)
# Don't run by default
echo "off" > ${stagedir}/${_sysconfdir}/config/tgc_dhcpd
# Preserve existing on/off setting
echo "${_sysconfdir}/config/tgc_dhcpd config(noupdate)" > $metadir/ops

: > ${stagedir}${prefix}/${_sysconfdir}/dhcpd.conf
echo "${prefix#/*}/${_sysconfdir}/dhcpd.conf config(noupdate)" >> $metadir/ops;

custom_install=1
generic_install
doc LICENSE README RELNOTES site.h site.conf
}

reg pack
pack()
{
lprefix=${prefix#/*}
metainstalldir=$prefix
topinstalldir=/
generic_pack
}

reg distclean
distclean()
{
META_CLEAN="$META_CLEAN ops"
clean distclean
}

###################################################
# No need to look below here
###################################################
build_sh $*
81 changes: 81 additions & 0 deletions dhcp/meta/dhcpd.init.irix
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/sh
## Contributed by Marcus Herbert for 3.0.1rc10 in 2002.
## Updated for 3.0.5 and tgcware by Tom G. Christensen in 2007.
##
## Start og stop the ISC dhcp daemon
##
## Set custom options in /etc/config/tgc_dhcpd.options to override
## default configuration

IS_ON=/sbin/chkconfig
DHCPD=/usr/tgcware/sbin/dhcpd
LF=/usr/tgcware/etc/dhcp/dhcpd.leases
CF=/usr/tgcware/etc/dhcpd.conf
CONFIG=/etc/config/tgc_dhcpd.options

pidfile=/var/run/dhcpd.pid

if $IS_ON verbose; then
ECHO=echo
else # For a quiet startup and shutdown
ECHO=:
fi

# With no config file we cannot continue
[ -f $CF ] || exit 0

check_pid_dir()
{
if [ ! -d /var/run ]; then
mkdir -p /var/run
chown root.sys /var/run
chmod 755 /var/run
fi
}

kill_dhcpd()
{
if [ -r $pidfile ]; then
dhcpd=`cat $pidfile`
ps -p $dhcpd_pid | grep dhcpd > /dev/null
if [ $? -eq 0 ]; then
/usr/bin/kill -15 -$dhcpd_pid
fi
fi
}

case "$1" in
start)
kill_dhcpd
if $IS_ON tgc_dhcpd && test -x $DHCPD; then
$ECHO "Starting dhcpd:\c"
check_pid_dir
if [ ! -f $LF ]; then
touch $LF
fi
if [ -r $CONFIG ]; then
$DHCPD `cat $CONFIG`
else
$DHCPD
fi
$ECHO "."
fi
;;

stop)
$ECHO "Stopping dhcpd:\c"
kill_dhcpd
$ECHO "."
exit 0
;;
configtest)
if [ -r $CONFIG ]; then
$DHCPD -t `cat $CONFIG`
else
$DHCPD -t
fi
;;
*)
echo "usage: $0 {start|stop|configtest}"
;;
esac
47 changes: 47 additions & 0 deletions dhcp/meta/pkgdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[common]
pkgname="$pkgprefix""$topdir"
name="$topdir"
pkgver="$pkgver"
pkgvendor="http://isc.org/products/DHCP/"
shortdesc="ISC dhcp"

[base]
subsys=sw.base
files(-,root,sys)
$lprefix/$_bindir/*
$lprefix/$_sharedir

[server]
subsys=sw.server
files(-,root,sys)
${_sysconfdir}
$lprefix/$_sbindir/dhcpd
$lprefix/$_sbindir/dhcrelay
$lprefix/$_sysconfdir/dhcpd.conf
$lprefix/$_mandir/?a?5/dhcp*
$lprefix/$_mandir/?a?8/dhcp*
$lprefix/$_mandir/?a?8/dhcrelay*

[clients]
subsys=sw.clients
files(-,root,sys)
$lprefix/$_sbindir/dhclient*
$lprefix/$_mandir/?a?5/dhclient*
$lprefix/$_mandir/?a?8/dhclient*

[mandev]
subsys=man.dev
files(-,root,sys)
$lprefix/$_mandir/?a?3

[man]
subsys=man.man
files(-,root,sys)
$lprefix/$_mandir/?a?1

[devel]
subsys=sw.dev
files(-,root,sys)
$lprefix/$_includedir/*
$lprefix/$_libdir/*.a

36 changes: 36 additions & 0 deletions dhcp/meta/relnotes
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
PACKAGE DETAILS
---------------
Name: %%PKGNAME%%
Version: %%SOURCE_AND_VER%%
Vendor: %%VENDOR%%
Packager: %%PKGEDBY%%

Source (sha1sum):
%%SOURCE_SHA1SUM%%

BUILD DETAILS
-------------
Compiler:
%%COMPILER%%

Environment:
%%ENVIRONMENT%%

Configure:
%%CONFIGURE%%

KNOWN DEPENDENCIES
------------------
%%DEPENDENCIES%%

ERRORS/MISCELLANEOUS
--------------------
The patch for Irix support is based on Marcus Herberts changes made
to 3.0.1rc10 in 2002.
The client script is untouched from Marcus Herberts version while the init
script has been updated to better match the style of other tgcware packages.
I've not provided an init script for dhcrelay but a copy of the dhcpd init
script could easily be adapted.

I used site.conf and site.h to customize paths. They're included with the
docs for reference.
11 changes: 11 additions & 0 deletions dhcp/meta/subsys.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sw.base default base software
sw.server default server software
sw.clients nodefault client software
sw.dev nodefault development files
man.doc default other documentation
man.dev nodefault development man pages
man.man default man pages
man.info default info pages
opt.relnotes default release notes
opt.src nodefault source, patches etc.
opt.dist nodefault distribution files
Loading

0 comments on commit 2195e98

Please sign in to comment.