From: gobo72 Date: Mon, 28 Feb 2011 04:33:27 +0000 (+0000) Subject: Déplacé dhcp au stage2 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=9fb2369ff4d602b40909d4dc8f25ab7a4a5bda0f;p=hvlinux.git Déplacé dhcp au stage2 --- diff --git a/stage2/bootscripts/dhcp b/stage2/bootscripts/dhcp new file mode 100755 index 0000000..fbbd241 --- /dev/null +++ b/stage2/bootscripts/dhcp @@ -0,0 +1,50 @@ +#!/bin/sh + +# dhcp + +# Source functions library +source /etc/rc.d/init.d/functions + +log_script_name "$0 $*" + +# Load global network parameters +source /etc/sysconfig/network/network-parameters + +if [ -z "${DHCP_SERVER_IF}" ]; then + # DHCP server is not enabled + msg_log "DHCP server disabled in '/etc/sysconfig/network/network-parameters'" + exit ${EXIT_CODE_WARNING} +fi + +# The lease file must exist on startup +if [ ! -f /var/state/dhcp/dhcpd.leases ]; then + touch /var/state/dhcp/dhcpd.leases || exit ${EXIT_CODE_FAILURE} +fi + +# See how we were called +case "$1" in + start) + cmd_run_log_box_warn "DHCP server start" loadproc /usr/sbin/dhcpd -q ${DHCP_SERVER_IF} + ;; + + stop) + cmd_run_log_box_warn "DHCP server stop" killproc /usr/sbin/dhcpd + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + status) + statusproc /usr/sbin/dhcpd + ;; + + *) + echo "Usage: $0 {restart|start|status|stop}" + exit ${EXIT_CODE_FAILURE} + ;; +esac + +exit $? 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/bootscripts/dhcp b/stage3/bootscripts/dhcp deleted file mode 100755 index fbbd241..0000000 --- a/stage3/bootscripts/dhcp +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -# dhcp - -# Source functions library -source /etc/rc.d/init.d/functions - -log_script_name "$0 $*" - -# Load global network parameters -source /etc/sysconfig/network/network-parameters - -if [ -z "${DHCP_SERVER_IF}" ]; then - # DHCP server is not enabled - msg_log "DHCP server disabled in '/etc/sysconfig/network/network-parameters'" - exit ${EXIT_CODE_WARNING} -fi - -# The lease file must exist on startup -if [ ! -f /var/state/dhcp/dhcpd.leases ]; then - touch /var/state/dhcp/dhcpd.leases || exit ${EXIT_CODE_FAILURE} -fi - -# See how we were called -case "$1" in - start) - cmd_run_log_box_warn "DHCP server start" loadproc /usr/sbin/dhcpd -q ${DHCP_SERVER_IF} - ;; - - stop) - cmd_run_log_box_warn "DHCP server stop" killproc /usr/sbin/dhcpd - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - status) - statusproc /usr/sbin/dhcpd - ;; - - *) - echo "Usage: $0 {restart|start|status|stop}" - exit ${EXIT_CODE_FAILURE} - ;; -esac - -exit $? 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