Déplacé dhcp au stage2
authorgobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Mon, 28 Feb 2011 04:33:27 +0000 (04:33 +0000)
committergobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Mon, 28 Feb 2011 04:33:27 +0000 (04:33 +0000)
stage2/bootscripts/dhcp [new file with mode: 0755]
stage2/install-2
stage2/packages-update
stage2/pkg/dhcp [new file with mode: 0755]
stage3/bootscripts/dhcp [deleted file]
stage3/cis-dhcp [deleted file]
stage3/packages-update

diff --git a/stage2/bootscripts/dhcp b/stage2/bootscripts/dhcp
new file mode 100755 (executable)
index 0000000..fbbd241
--- /dev/null
@@ -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 $?
index ec1c196..dd21aae 100755 (executable)
@@ -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
index fd191a2..8e63ce5 100755 (executable)
@@ -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 (executable)
index 0000000..ce13b4b
--- /dev/null
@@ -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 (executable)
index fbbd241..0000000
+++ /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 (executable)
index bf572fa..0000000
+++ /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 $?
index 1f1f272..58f0bbd 100755 (executable)
@@ -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