source: npl/internetserver/dhcp/dhcp.SlackBuild @ 0105685

gcc484ntopperl-5.22
Last change on this file since 0105685 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 4.3 KB
Line 
1#!/bin/sh
2
3# Set initial variables:
4CWD=`pwd`
5if [ "$TMP" = "" ]; then
6  TMP=$CWD
7fi
8PKG=$TMP/package-dhcp
9
10VERSION=4.2.5
11ARCH=i386
12BUILD=1
13
14if [ ! -d $TMP ]; then
15  mkdir -p $TMP # location to build the source
16fi
17if [ ! -d $PKG ]; then
18  mkdir -p $PKG # place for the package to be built
19fi
20
21# Explode the package framework:
22cd $PKG
23explodepkg $CWD/_dhcp.tar.gz
24
25echo "+=============+"
26echo "| dhcp-$VERSION |"
27echo "+=============+"
28cd $TMP
29tar xzvf $CWD/dhcp-$VERSION.tar.gz
30cd dhcp-$VERSION
31
32# Borrowed from https://github.com/ipfire/ipfire-3.x/tree/master/dhcp/patches
33# Apply patches in a special order.
34PATCHES="dhcp-4.2.5-remove-bind.patch \
35        dhcp-4.2.4-P1-remove-dst.patch \
36        dhcp-4.2.0-errwarn-message.patch \
37        dhcp-4.2.0-release-by-ifup.patch \
38        dhcp-4.2.4-unicast-bootp.patch \
39        dhcp-4.2.0-default-requested-options.patch \
40        dhcp-4.2.2-xen-checksum.patch \
41        dhcp-4.2.5-manpages.patch \
42        dhcp-4.2.0-garbage-chars.patch \
43        dhcp-4.2.0-add_timeout_when_NULL.patch \
44        dhcp-4.2.4-64_bit_lease_parse.patch \
45        dhcp-4.2.0-logpid.patch \
46        dhcp-4.2.4-UseMulticast.patch \
47        dhcp-4.2.4-improved-xid.patch \
48        dhcp-4.2.5-systemtap.patch \
49        dhcp-4.2.3-P2-log_perror.patch \
50        dhcp-4.2.4-getifaddrs.patch \
51        dhcp-4.2.4-send_release.patch \
52        dhcp-4.2.5-rfc5970-dhcpv6-options-for-network-boot.patch \
53        dhcp-4.2.4-failOverPeer.patch \
54        dhcp-4.2.5b1-atf-pkgconfig.patch \
55        dhcp-4.2.4-P1-interval.patch \
56        dhcp-4.2.4-P2-conflex-do-forward-updates.patch \
57        dhcp-4.2.4-P2-dupl-key.patch \
58        dhcp-4.2.5-next-server.patch"
59
60for P in $PATCHES ; do
61        echo "Applying patch $P"
62        patch -p1 < $CWD/ipfire-3.x/dhcp/patches/$P || exit
63done
64
65#patch -p1 < $CWD/dhcp-4.2.5-remove-bind.patch || exit 1
66#patch -p1 < $CWD/dhcp-4.2.4-getifaddrs.patch || exit 1
67
68export MAKEFLAGS="-j10"
69 ./configure  --enable-ipv4-pktinfo \
70        --disable-static \
71        --with-srv-lease-file=/var/state/dhcp/dhcpd.leases \
72        --with-srv6-lease-file=/var/state/dhcp/dhcpd6.leases \
73        --with-cli-lease-file=/var/state/dhcp/dhclient.leases \
74        --with-cli6-lease-file=/var/state/dhcp/dhclient6.leases  || exit 1
75
76make  DEBUG="-O2 -march=i386 -mcpu=i686" || exit 1
77mkdir -p $PKG/usr/doc/dhcp-$VERSION
78cp -a ANONCVS CHANGES COPYRIGHT README RELNOTES $PKG/usr/doc/dhcp-$VERSION
79mkdir -p $PKG/usr/doc/dhcp-$VERSION/examples
80cp -a client/dhclient.conf server/dhcpd.conf \
81  $PKG/usr/doc/dhcp-$VERSION/examples
82chown -R root.root $PKG/usr/doc/dhcp-$VERSION
83cat << EOF > $PKG/etc/dhcpd.conf.new
84# dhcpd.conf
85#
86# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
87#
88allow unknown-clients;
89ddns-updates off;
90
91subnet 192.168.0.0 netmask 255.255.255.0 {
92  range 192.168.0.100 192.168.0.254;
93  option domain-name-servers 192.168.0.1,192.168.0.1;
94  option routers 192.168.0.1;
95  option domain-name "";
96}
97EOF
98
99cat << EOF > $PKG/etc/dhclient.conf.new
100# dhclient.conf
101#
102# Configuration file for ISC dhclient (see 'man dhclient.conf')
103#
104EOF
105
106mkdir -p $PKG/service/dhcpd
107cat << EOF > $PKG/service/dhcpd/run
108#!/bin/bash
109exec /usr/sbin/dhcpd -f
110EOF
111
112mkdir -p $PKG/etc/postinst.d
113cp $CWD/post.dhcp $PKG/etc/postinst.d || exit 1
114chmod +x $PKG/etc/postinst.d/post.dhcp || exit 1
115
116chmod +x $PKG/service/dhcpd/run
117cat client/scripts/linux > $PKG/sbin/dhclient-script
118chmod 700 $PKG/sbin/dhclient-script
119( cd work.linux-2.2
120  strip server/dhcpd client/dhclient relay/dhcrelay
121  cat server/dhcpd > $PKG/usr/sbin/dhcpd
122  cat relay/dhcrelay > $PKG/usr/sbin/dhcrelay
123  cat client/dhclient > $PKG/sbin/dhclient )
124mkdir -p $PKG/usr/man/man5
125mkdir -p $PKG/usr/man/man8
126for dir in client server ; do
127  cd $dir
128  for file in *.5 ; do
129    cat $file | sed -e "s#ETCDIR#/etc#g" -e "s#DBDIR#/var/db#g" \
130      -e "s#RUNDIR#/var/run#g" | gzip -9c > $PKG/usr/man/man5/$file.gz
131  done
132  for file in *.8 ; do
133    cat $file | sed -e "s#ETCDIR#/etc#g" -e "s#DBDIR#/var/db#g" \
134      -e "s#RUNDIR#/var/run#g" | gzip -9c > $PKG/usr/man/man8/$file.gz
135  done
136  cd ..
137done
138cat relay/dhcrelay.8 | sed -e "s#ETCDIR#/etc#g" -e "s#DBDIR#/var/db#g" \
139  -e "s#RUNDIR#/var/run#g" | gzip -9c > $PKG/usr/man/man8/dhcrelay.8.gz
140mkdir -p $PKG/install
141cat $CWD/slack-desc > $PKG/install/slack-desc
142
143# Build the package:
144cd $PKG
145NAME=`echo $0|cut -f2 -d'.'`
146makepkg -l y -c n $CWD/$NAME.pkg > /dev/null &&
147echo $VERSION > $CWD/$NAME.version &&
148arch > $CWD/$NAME.arch &&
149
150# Clean up the extra stuff:
151if [ ! "$1" = "--nocleanup" ]; then
152 rm -rf $TMP/dhcp-$VERSION
153 rm -rf $PKG
154fi
Note: See TracBrowser for help on using the repository browser.