From 9fb2369ff4d602b40909d4dc8f25ab7a4a5bda0f Mon Sep 17 00:00:00 2001 From: gobo72 Date: Mon, 28 Feb 2011 04:33:27 +0000 Subject: [PATCH] =?utf8?q?D=C3=A9plac=C3=A9=20dhcp=20au=20stage2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- {stage3 => stage2}/bootscripts/dhcp | 0 stage2/install-2 | 1 + stage2/packages-update | 1 + stage2/pkg/dhcp | 64 ++++++++++++++++++++++ stage3/cis-dhcp | 82 ----------------------------- stage3/packages-update | 1 - 6 files changed, 66 insertions(+), 83 deletions(-) rename {stage3 => stage2}/bootscripts/dhcp (100%) create mode 100755 stage2/pkg/dhcp delete mode 100755 stage3/cis-dhcp diff --git a/stage3/bootscripts/dhcp b/stage2/bootscripts/dhcp similarity index 100% rename from stage3/bootscripts/dhcp rename to stage2/bootscripts/dhcp diff --git a/stage2/install-2 b/stage2/install-2 index ec1c196..dd21aae 100755 --- a/stage2/install-2 +++ b/stage2/install-2 @@ -38,6 +38,7 @@ ipkg ${TEXINFO} ipkg ${UDEV} ipkg -m noac ${UDEV_CONFIG} ipkg ${GRUB} +ipkg -m acnb ${DHCP} rscr once "Installing HV-utilities" install-hv-utilities rscr mult "Compressing man pages" compressdoc diff --git a/stage2/packages-update b/stage2/packages-update index fd191a2..8e63ce5 100755 --- a/stage2/packages-update +++ b/stage2/packages-update @@ -78,5 +78,6 @@ fpkg_hv ${SHADOW} fpkg ${SYSKLOGD} http://www.infodrom.org/projects/sysklogd/download fpkg ${UDEV_CONFIG} http://www.linuxfromscratch.org/lfs/downloads/development fpkg ${GRUB} ftp://alpha.gnu.org/gnu/grub +fpkg ${DHCP} ftp://ftp.isc.org/isc/dhcp/dhcp-3.0-history exit $? diff --git a/stage2/pkg/dhcp b/stage2/pkg/dhcp new file mode 100755 index 0000000..ce13b4b --- /dev/null +++ b/stage2/pkg/dhcp @@ -0,0 +1,64 @@ +#!/bin/bash + +hvconfig_pre() +{ + CONFIGURE_OPTS="" +} + +hvbuild() +{ + ${HVMAKE} + ${HVMAKE} LIBDIR=/usr/lib INCDIR=/usr/include install +} + +hvbuild_post() +{ + # This is for the DHCP client + cat > /etc/dhclient.conf << "EOF" +# dhclient.conf + +timeout 15; + +interface "eth0"{ + supersede domain-name "_DOMAIN_"; + prepend domain-name-servers 127.0.0.1; + request subnet-mask, broadcast-address, time-offset, routers, + domain-name, domain-name-servers, host-name; + require subnet-mask, domain-name-servers; +} +EOF + + sed -i -e "s!_DOMAIN_!${DOMAIN}!g" /etc/dhclient.conf + + cat > /etc/sysconfig/network/dhcp-client << "EOF" +# dhcp-client +# DHCP client program informations +# +DHCP_PROG="/sbin/dhclient" +DHCP_START="-q -1" +DHCP_STOP="-q -r" +EOF + + # Create a base configuration file for a DHCP server. + cat > /etc/dhcpd.conf << EOF +# Configuration file for DHCP server. + +default-lease-time 72000; +max-lease-time 144000; +ddns-update-style ad-hoc; + +subnet 192.168.0.0 netmask 255.255.255.0 { + range 192.168.0.2 192.168.0.240; + option broadcast-address 192.168.0.255; + option routers 192.168.0.1; + option domain-name-servers 192.168.0.1; +} +EOF + + # The lease file must exist on startup. The following command will satisfy + # that requirement: + #####touch /var/state/dhcp/dhcpd.leases + + install -v -m740 ${SCRDIR}/bootscripts/dhcp /etc/rc.d/init.d + bootscript_add_rc3 dhcp 20 73 +} diff --git a/stage3/cis-dhcp b/stage3/cis-dhcp deleted file mode 100755 index bf572fa..0000000 --- a/stage3/cis-dhcp +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/sh -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1} -./configure -make -j ${MAKEJOBS} -make LIBDIR=/usr/lib INCDIR=/usr/include install - -# This is for the DHCP client -cat > /etc/dhclient.conf << "EOF" -# dhclient.conf - -timeout 15; - -interface "eth0"{ - supersede domain-name "_DOMAIN_"; - prepend domain-name-servers 127.0.0.1; - request subnet-mask, broadcast-address, time-offset, routers, - domain-name, domain-name-servers, host-name; - require subnet-mask, domain-name-servers; -} -EOF - -sed -i -e "s!_DOMAIN_!${DOMAIN}!g" /etc/dhclient.conf - -cat > /etc/sysconfig/network/dhcp-client << "EOF" -# dhcp-client -# DHCP client program informations -# -DHCP_PROG="/sbin/dhclient" -DHCP_START="-q -1" -DHCP_STOP="-q -r" -EOF - -# Is it really necessary? If necessary, uncomment entries. -cat > /etc/dhclient-exit-hooks << "EOF" -#!/bin/sh - -# Load global network parameters -. /etc/sysconfig/network/network-parameters - -# Update /etc/hosts only if we have an ip address. -if [ -n "${new_ip_address}" ]; then - #echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts - #echo "${new_ip_address} ${DEFAULT_HOSTNAME}" >> /etc/hosts - exit_status=0 -else - exit_status=1 -fi -EOF -chmod 740 /etc/dhclient-exit-hooks - -# The following commands will create a base configuration file for a DHCP server. -cat > /etc/dhcpd.conf << EOF -# Configuration file for DHCP server. - -default-lease-time 72000; -max-lease-time 144000; -ddns-update-style ad-hoc; - -subnet 192.168.0.0 netmask 255.255.255.0 { - range 192.168.0.2 192.168.0.240; - option broadcast-address 192.168.0.255; - option routers 192.168.0.1; - option domain-name-servers 192.168.0.1; -} -EOF - -install -v -m740 ${SCRDIR}/bootscripts/dhcp /etc/rc.d/init.d -bootscript_add_rc3 dhcp 20 73 - -exit $? diff --git a/stage3/packages-update b/stage3/packages-update index 1f1f272..58f0bbd 100755 --- a/stage3/packages-update +++ b/stage3/packages-update @@ -30,7 +30,6 @@ fpkg_sf ${LIBUSB_COMPAT} libusb fpkg ${USBUTILS} ${SOURCEFORGE_URL}/project/linux-usb/usbutils fpkg ${REISERFSPROGS} http://www.kernel.org/pub/linux/utils/fs/reiserfs fpkg ${NET_TOOLS} http://www.tazenda.demon.co.uk/phil/net-tools -fpkg ${DHCP} ftp://ftp.isc.org/isc/dhcp/dhcp-3.0-history fpkg ${POPT} http://rpm5.org/files/popt fpkg ${PAM} http://www.kernel.org/pub/linux/libs/pam/library fpkg ${OPENSSL} ftp://ftp.openssl.org/source -- 2.20.1