Erste Teile der neuen Netzwerkscripte.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sun, 25 Mar 2007 19:58:37 +0000 (19:58 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sun, 25 Mar 2007 19:58:37 +0000 (19:58 +0000)
Installer-Fix.
SCSI+SATA-Module zum Kernel hinzugefuegt

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@462 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

12 files changed:
config/kernel/kernel.config.i586
config/kernel/kernel.config.i586.smp
config/rootfiles/common/initscripts
lfs/initscripts
lfs/usb-stick
src/initscripts/init.d/net/common/ipv4-static [new file with mode: 0644]
src/initscripts/init.d/net/ifdown [new file with mode: 0644]
src/initscripts/init.d/net/ifup [new file with mode: 0644]
src/initscripts/init.d/net/red/dhcpcd [new file with mode: 0644]
src/initscripts/init.d/network
src/install+setup/install/config.c
src/install+setup/install/main.c

index b588bad..0e52911 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.16.42-ipfire
-# Sat Mar 24 12:58:07 2007
+# Sun Mar 25 17:52:03 2007
 #
 CONFIG_X86_32=y
 CONFIG_SEMAPHORE_SLEEPERS=y
@@ -778,7 +778,7 @@ CONFIG_IDEDMA_AUTO=y
 #
 CONFIG_RAID_ATTRS=y
 CONFIG_SCSI=m
-# CONFIG_SCSI_PROC_FS is not set
+CONFIG_SCSI_PROC_FS=y
 
 #
 # SCSI support type (disk, tape, CD-ROM)
@@ -836,16 +836,32 @@ CONFIG_AIC79XX_RESET_DELAY_MS=15000
 CONFIG_AIC79XX_DEBUG_MASK=0
 # CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
 CONFIG_SCSI_DPT_I2O=m
-# CONFIG_SCSI_ADVANSYS is not set
+CONFIG_SCSI_ADVANSYS=m
 CONFIG_SCSI_IN2000=m
-# CONFIG_SCSI_ARCMSR is not set
+CONFIG_SCSI_ARCMSR=m
 CONFIG_MEGARAID_NEWGEN=y
 CONFIG_MEGARAID_MM=m
 CONFIG_MEGARAID_MAILBOX=m
-# CONFIG_MEGARAID_LEGACY is not set
+CONFIG_MEGARAID_LEGACY=m
 CONFIG_MEGARAID_SAS=m
-# CONFIG_SCSI_SATA is not set
-# CONFIG_SCSI_HPTIOP is not set
+CONFIG_SCSI_SATA=m
+CONFIG_SCSI_SATA_AHCI=m
+CONFIG_SCSI_SATA_SVW=m
+CONFIG_SCSI_ATA_PIIX=m
+# CONFIG_SCSI_SATA_MV is not set
+CONFIG_SCSI_SATA_NV=m
+CONFIG_SCSI_PDC_ADMA=m
+CONFIG_SCSI_HPTIOP=m
+CONFIG_SCSI_SATA_QSTOR=m
+CONFIG_SCSI_SATA_PROMISE=m
+CONFIG_SCSI_SATA_SX4=m
+CONFIG_SCSI_SATA_SIL=m
+CONFIG_SCSI_SATA_SIL24=m
+CONFIG_SCSI_SATA_SIS=m
+CONFIG_SCSI_SATA_ULI=m
+CONFIG_SCSI_SATA_VIA=m
+CONFIG_SCSI_SATA_VITESSE=m
+CONFIG_SCSI_SATA_INTEL_COMBINED=y
 CONFIG_SCSI_BUSLOGIC=m
 # CONFIG_SCSI_OMIT_FLASHPOINT is not set
 CONFIG_SCSI_DMX3191D=m
@@ -881,11 +897,12 @@ CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=8
 CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32
 CONFIG_SCSI_NCR53C8XX_SYNC=20
 # CONFIG_SCSI_NCR53C8XX_PROFILE is not set
-# CONFIG_SCSI_MCA_53C9X is not set
+CONFIG_SCSI_MCA_53C9X=m
 CONFIG_SCSI_PAS16=m
 CONFIG_SCSI_PSI240I=m
 CONFIG_SCSI_QLOGIC_FAS=m
-# CONFIG_SCSI_QLOGIC_FC is not set
+CONFIG_SCSI_QLOGIC_FC=m
+# CONFIG_SCSI_QLOGIC_FC_FIRMWARE is not set
 CONFIG_SCSI_QLOGIC_1280=m
 # CONFIG_SCSI_QLA_FC is not set
 CONFIG_SCSI_LPFC=m
@@ -926,10 +943,12 @@ CONFIG_MD_MULTIPATH=m
 #
 # Fusion MPT device support
 #
-# CONFIG_FUSION is not set
-# CONFIG_FUSION_SPI is not set
-# CONFIG_FUSION_FC is not set
-# CONFIG_FUSION_SAS is not set
+CONFIG_FUSION=y
+CONFIG_FUSION_SPI=m
+CONFIG_FUSION_FC=m
+CONFIG_FUSION_SAS=m
+CONFIG_FUSION_MAX_SGE=128
+CONFIG_FUSION_CTL=m
 
 #
 # IEEE 1394 (FireWire) support
index d6dbceb..cbd64b0 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.16.42-ipfire
-# Sat Mar 24 12:58:22 2007
+# Sun Mar 25 17:52:32 2007
 #
 CONFIG_X86_32=y
 CONFIG_SEMAPHORE_SLEEPERS=y
@@ -784,7 +784,7 @@ CONFIG_IDEDMA_AUTO=y
 #
 CONFIG_RAID_ATTRS=y
 CONFIG_SCSI=m
-# CONFIG_SCSI_PROC_FS is not set
+CONFIG_SCSI_PROC_FS=y
 
 #
 # SCSI support type (disk, tape, CD-ROM)
@@ -842,16 +842,32 @@ CONFIG_AIC79XX_RESET_DELAY_MS=15000
 CONFIG_AIC79XX_DEBUG_MASK=0
 # CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
 CONFIG_SCSI_DPT_I2O=m
-# CONFIG_SCSI_ADVANSYS is not set
+CONFIG_SCSI_ADVANSYS=m
 CONFIG_SCSI_IN2000=m
-# CONFIG_SCSI_ARCMSR is not set
+CONFIG_SCSI_ARCMSR=m
 CONFIG_MEGARAID_NEWGEN=y
 CONFIG_MEGARAID_MM=m
 CONFIG_MEGARAID_MAILBOX=m
-# CONFIG_MEGARAID_LEGACY is not set
+CONFIG_MEGARAID_LEGACY=m
 CONFIG_MEGARAID_SAS=m
-# CONFIG_SCSI_SATA is not set
-# CONFIG_SCSI_HPTIOP is not set
+CONFIG_SCSI_SATA=m
+CONFIG_SCSI_SATA_AHCI=m
+CONFIG_SCSI_SATA_SVW=m
+CONFIG_SCSI_ATA_PIIX=m
+# CONFIG_SCSI_SATA_MV is not set
+CONFIG_SCSI_SATA_NV=m
+CONFIG_SCSI_PDC_ADMA=m
+CONFIG_SCSI_HPTIOP=m
+CONFIG_SCSI_SATA_QSTOR=m
+CONFIG_SCSI_SATA_PROMISE=m
+CONFIG_SCSI_SATA_SX4=m
+CONFIG_SCSI_SATA_SIL=m
+CONFIG_SCSI_SATA_SIL24=m
+CONFIG_SCSI_SATA_SIS=m
+CONFIG_SCSI_SATA_ULI=m
+CONFIG_SCSI_SATA_VIA=m
+CONFIG_SCSI_SATA_VITESSE=m
+CONFIG_SCSI_SATA_INTEL_COMBINED=y
 CONFIG_SCSI_BUSLOGIC=m
 # CONFIG_SCSI_OMIT_FLASHPOINT is not set
 CONFIG_SCSI_DMX3191D=m
@@ -890,7 +906,8 @@ CONFIG_SCSI_NCR53C8XX_SYNC=20
 CONFIG_SCSI_PAS16=m
 CONFIG_SCSI_PSI240I=m
 CONFIG_SCSI_QLOGIC_FAS=m
-# CONFIG_SCSI_QLOGIC_FC is not set
+CONFIG_SCSI_QLOGIC_FC=m
+# CONFIG_SCSI_QLOGIC_FC_FIRMWARE is not set
 CONFIG_SCSI_QLOGIC_1280=m
 # CONFIG_SCSI_QLA_FC is not set
 CONFIG_SCSI_LPFC=m
@@ -931,10 +948,12 @@ CONFIG_MD_MULTIPATH=m
 #
 # Fusion MPT device support
 #
-# CONFIG_FUSION is not set
-# CONFIG_FUSION_SPI is not set
-# CONFIG_FUSION_FC is not set
-# CONFIG_FUSION_SAS is not set
+CONFIG_FUSION=y
+CONFIG_FUSION_SPI=m
+CONFIG_FUSION_FC=m
+CONFIG_FUSION_SAS=m
+CONFIG_FUSION_MAX_SGE=128
+CONFIG_FUSION_CTL=m
 
 #
 # IEEE 1394 (FireWire) support
index 52b00b4..fca5379 100644 (file)
@@ -17,7 +17,9 @@ etc/rc.d/init.d/localnet
 etc/rc.d/init.d/modules
 etc/rc.d/init.d/mountfs
 etc/rc.d/init.d/mountkernfs
+etc/rc.d/init.d/net
 etc/rc.d/init.d/network
+etc/rc.d/init.d/ntp
 etc/rc.d/init.d/random
 etc/rc.d/init.d/rc
 etc/rc.d/init.d/reboot
index 570a181..23d0e7d 100644 (file)
@@ -55,6 +55,9 @@ $(TARGET) :
        install -d -m 755 /etc/rc.d/rc6.d
        install -d -m 755 /etc/rc.d/rcsysinit.d
        install -d -m 755 /etc/rc.d/init.d
+       install -d -m 755 /etc/rc.d/init.d/net
+       install -d -m 755 /etc/rc.d/init.d/net/common
+       install -d -m 755 /etc/rc.d/init.d/net/red
        install -d -m 755 /etc/rc.d/helper
        install -d -m 755 /etc/sysconfig
        ln -svf rc.d/init.d /etc/init.d
@@ -64,6 +67,18 @@ $(TARGET) :
        done
        chmod 644 /etc/rc.d/init.d/functions
 
+       for i in $(DIR_SRC)/src/initscripts/init.d/net/*; do \
+               install -v -m 754 $$i /etc/rc.d/init.d/net/; \
+       done
+
+       for i in $(DIR_SRC)/src/initscripts/init.d/net/common/*; do \
+               install -v -m 754 $$i /etc/rc.d/init.d/net/common/; \
+       done
+
+       for i in $(DIR_SRC)/src/initscripts/init.d/net/red/*; do \
+               install -v -m 754 $$i /etc/rc.d/init.d/net/red/; \
+       done
+
        for i in $(DIR_SRC)/src/initscripts/sysconfig/*; do \
                install -v -m 644 $$i /etc/sysconfig/; \
        done
index a15cde0..0f3e3b9 100644 (file)
@@ -26,6 +26,8 @@
 
 include Config
 
+VER = ipfire
+
 THISAPP    = usb-stick
 TARGET     = $(DIR_INFO)/$(THISAPP)
 
diff --git a/src/initscripts/init.d/net/common/ipv4-static b/src/initscripts/init.d/net/common/ipv4-static
new file mode 100644 (file)
index 0000000..f459555
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/sh
+########################################################################
+# Begin $network_devices/services/ipv4-static
+#
+# Description : IPV4 Static Boot Script
+#
+# Authors     : Nathan Coulson - nathan@linuxfromscratch.org
+#               Kevin P. Fleming - kpfleming@linuxfromscratch.org
+#               Michael Tremer - mitch@ipfire.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
+
+if [ -z "${BROADCAST}" ]; then
+       boot_mesg "BROADCAST variable missing from input, cannot continue." ${FAILURE}
+       echo_failure
+       exit 1
+fi
+
+if [ -n "${ADDRESS}" -a -n "${NETMASK}" ]; then
+       PREFIX=`whatmask ${NETMASK} | grep -e ^CIDR | awk -F': ' '{ print $2 }' | cut -c 2-`
+       args="${args} ${ADDRESS}/${PREFIX} broadcast ${BROADCAST}"
+else
+       boot_mesg "ADDRESS and/or NETMASK variable missing from input, cannot continue." ${FAILURE}
+       echo_failure
+       exit 1
+fi
+
+case "${2}" in
+       up)
+               boot_mesg "Adding IPv4 address ${ADDRESS} to the ${1} interface..."
+               ip addr add ${args} dev ${1}
+               evaluate_retval
+       
+               if [ -n "${GATEWAY}" ]; then
+                       if ip route | grep -q default; then
+                               boot_mesg "Gateway already setup; skipping." ${WARNING}
+                               echo_warning
+                       else
+                               boot_mesg "Setting up default gateway..."
+                               ip route add default via ${GATEWAY} dev ${1}
+                               evaluate_retval
+                        fi
+               fi
+       ;;
+
+       down)
+               if [ -n "${GATEWAY}" ]; then
+                       boot_mesg "Removing default gateway..."
+                       ip route del default
+                       evaluate_retval
+               fi
+       
+               boot_mesg "Removing IPv4 address ${ADDRESS} from the ${1} interface..."
+               ip addr del ${args} dev ${1}
+               evaluate_retval
+       ;;
+       
+       *)
+               echo "Usage: ${0} [interface] {up|down}"
+               exit 1
+       ;;
+esac
+
+# End $network_devices/services/ipv4-static
diff --git a/src/initscripts/init.d/net/ifdown b/src/initscripts/init.d/net/ifdown
new file mode 100644 (file)
index 0000000..3b80d7d
--- /dev/null
@@ -0,0 +1,78 @@
+#!/bin/sh
+########################################################################
+# Begin $network_devices/ifdown
+#
+# Description : Interface Down
+#
+# Authors     : Nathan Coulson - nathan@linuxfromscratch.org
+#               Kevin P. Fleming - kpfleming@linuxfromscratch.org
+#               Michael Tremer - mitch@ipfire.org
+#
+# Version     : 00.01
+#
+# Notes       : 
+#
+########################################################################
+
+. /etc/sysconfig/rc 
+. ${rc_functions}
+eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
+
+if [ "$name" == "green" ]; then
+       DEVICE="${GREEN_DEV}"
+elif [ "$name" == "blue" ]; then
+       DEVICE="${BLUE_DEV}"
+elif [ "$name" == "orange" ]; then
+       DEVICE="${ORANGE_DEV}"
+elif [ "$name" == "red" ]; then
+       DEVICE="${RED_DEV}"
+fi
+
+if ip link show ${DEVICE} > /dev/null 2>&1
+then
+       if [ "$name" == "green" ]; then
+               NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK}\
+               NETADDRESS=${GREEN_NETADDRESS} BROADCAST=${GREEN_BROADCAST} \
+               /etc/rc.d/init.d/net/common/ipv4-static ${GREEN_DEV} down
+               
+       elif [ "$name" == "blue" ]; then
+               NAME=${name} ADDRESS=${BLUE_ADDRESS} NETMASK=${BLUE_NETMASK}\
+               NETADDRESS=${BLUE_NETADDRESS} BROADCAST=${BLUE_BROADCAST} \
+               /etc/rc.d/init.d/net/common/ipv4-static ${BLUE_DEV} down
+               
+       elif [ "$name" == "orange" ]; then
+               NAME=${name} ADDRESS=${ORANGE_ADDRESS} NETMASK=${ORANGE_NETMASK}\
+               NETADDRESS=${ORANGE_NETADDRESS} BROADCAST=${ORANGE_BROADCAST} \
+               /etc/rc.d/init.d/net/common/ipv4-static ${ORANGE_DEV} down
+
+       elif [ "$name" == "red" ]; then
+               if [ "${RED_TYPE}" == "PPPOE" ]; then
+                       echo
+               elif [ "${RED_TYPE}" == "PPTP" ]; then
+                       echo
+               elif [ "${RED_TYPE}" == "DHCP" ]; then
+                       NAME=${name} DHCP_HOSTNAME=${RED_DHCP_HOSTNAME} \
+                       PRINTIP=yes PRINTALL=yes \
+                       /etc/rc.d/init.d/net/red/dhcpcd ${RED_DEV} down
+               elif [ "${RED_TYPE}" == "STATIC" ]; then
+                       NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK}\
+                       NETADDRESS=${RED_NETADDRESS} BROADCAST=${RED_BROADCAST} \
+                       DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY}
+                       /etc/rc.d/init.d/net/red/ipv4-static ${RED_DEV} down
+               fi
+       fi
+else
+       boot_mesg "Interface ${DEVICE} doesn't exist." ${WARNING}
+       echo_warning
+fi
+
+link_status=`ip link show $DEVICE 2> /dev/null`
+if [ -n "${link_status}" ]; then
+       if echo "${link_status}" | grep -q UP; then
+               boot_mesg "Bringing down the ${DEVICE} interface..."
+               ip link set ${DEVICE} down
+               evaluate_retval
+       fi
+fi
+
+# End $network_devices/ifdown
diff --git a/src/initscripts/init.d/net/ifup b/src/initscripts/init.d/net/ifup
new file mode 100644 (file)
index 0000000..561a1e4
--- /dev/null
@@ -0,0 +1,90 @@
+#!/bin/sh
+########################################################################
+# Begin $network_devices/ifup
+#
+# Description : Interface Up
+#
+# Authors     : Nathan Coulson - nathan@linuxfromscratch.org
+#               Kevin P. Fleming - kpfleming@linuxfromscratch.org
+#               Michael Tremer - mitch@ipfire.org
+#
+# Version     : 01.00
+#
+# Notes       : the variables are passed to the scripts found
+#               in the services directory
+#
+########################################################################
+
+. /etc/sysconfig/rc 
+. ${rc_functions} 
+
+boot_mesg "Bringing up the $name interface..."
+boot_mesg_flush
+
+(
+       eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
+
+       # Loading the module if not already done...
+       if [ "$name" == "green" ]; then
+               modprobe ${GREEN_DRIVER} ${GREEN_DRIVER_OPTIONS} > /dev/null 2>&1
+               DEVICE="${GREEN_DEV}"
+       elif [ "$name" == "blue" ]; then
+               modprobe ${BLUE_DRIVER} ${BLUE_DRIVER_OPTIONS} > /dev/null 2>&1
+               DEVICE="${BLUE_DEV}"
+       elif [ "$name" == "orange" ]; then
+               modprobe ${ORANGE_DRIVER} ${ORANGE_DRIVER_OPTIONS} > /dev/null 2>&1
+               DEVICE="${ORANGE_DEV}"
+       elif [ "$name" == "red" ]; then
+               DEVICE="${RED_DEV}"
+       fi
+
+       # Check if interface is there...
+       if ip link show ${DEVICE} > /dev/null 2>&1; then
+               link_status=`ip link show ${DEVICE} 2> /dev/null`
+               if [ -n "${link_status}" ]; then
+                       if ! echo "${link_status}" | grep -q UP; then
+                               ip link set ${DEVICE} up
+                       fi
+               fi
+
+       else
+               boot_mesg "Interface ${DEVICE} doesn't exist." ${FAILURE}
+               echo_failure
+               exit 1
+       fi
+
+       # Passing the variables to the script
+       if [ "$name" == "green" ]; then
+               NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK}\
+               NETADDRESS=${GREEN_NETADDRESS} BROADCAST=${GREEN_BROADCAST} \
+               /etc/rc.d/init.d/net/common/ipv4-static ${GREEN_DEV} up
+               
+       elif [ "$name" == "blue" ]; then
+               NAME=${name} ADDRESS=${BLUE_ADDRESS} NETMASK=${BLUE_NETMASK}\
+               NETADDRESS=${BLUE_NETADDRESS} BROADCAST=${BLUE_BROADCAST} \
+               /etc/rc.d/init.d/net/common/ipv4-static ${BLUE_DEV} up
+               
+       elif [ "$name" == "orange" ]; then
+               NAME=${name} ADDRESS=${ORANGE_ADDRESS} NETMASK=${ORANGE_NETMASK}\
+               NETADDRESS=${ORANGE_NETADDRESS} BROADCAST=${ORANGE_BROADCAST} \
+               /etc/rc.d/init.d/net/common/ipv4-static ${ORANGE_DEV} up
+               
+       elif [ "$name" == "red" ]; then
+               if [ "${RED_TYPE}" == "PPPOE" ]; then
+                       echo
+               elif [ "${RED_TYPE}" == "PPTP" ]; then
+                       echo
+               elif [ "${RED_TYPE}" == "DHCP" ]; then
+                       NAME=${name} DHCP_HOSTNAME=${RED_DHCP_HOSTNAME} \
+                       PRINTIP=yes PRINTALL=yes \
+                       /etc/rc.d/init.d/net/red/dhcpcd ${RED_DEV} up
+               elif [ "${RED_TYPE}" == "STATIC" ]; then
+                       NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK}\
+                       NETADDRESS=${RED_NETADDRESS} BROADCAST=${RED_BROADCAST} \
+                       DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY}
+                       /etc/rc.d/init.d/net/red/ipv4-static ${RED_DEV} up
+               fi
+       fi
+)
+
+# End $network_devices/ifup
diff --git a/src/initscripts/init.d/net/red/dhcpcd b/src/initscripts/init.d/net/red/dhcpcd
new file mode 100644 (file)
index 0000000..99f6b01
--- /dev/null
@@ -0,0 +1,120 @@
+#!/bin/sh
+# Begin $network-devices/services/dhcpcd
+
+# Based upon lfs-bootscripts-1.12 $network_devices/if{down,up}
+# Rewritten by Nathan Coulson <nathan@linuxfromscratch.org>
+# Adapted for dhcpcd by DJ Lucas <dj@lucasit.com>
+# Made compatible for ipfire by Michael Tremer mitch@ipfire.org
+
+. /etc/sysconfig/rc
+. $rc_functions
+
+PIDFILE="/var/run/dhcpcd-$1.pid"
+LEASEINFO="/var/ipfire/dhcpc/dhcpcd-$1.info"
+
+case "$2" in
+       up)
+               boot_mesg -n "Starting dhcpcd on the $1 interface..."
+               # Test to see if there is a stale pid file
+               if [ -f "$PIDFILE" ]
+               then
+                       ps `cat "$PIDFILE"` | grep dhcpcd > /dev/null
+                       if [ $? != 0 ]
+                       then
+                               rm -f /var/run/dhcpcd-$1.pid > /dev/null
+                       else
+                               boot_mesg "dhcpcd already running!" ${WARNING}
+                               echo_warning
+                               exit 2
+                       fi
+               fi
+               /sbin/iptables -A REDINPUT -p tcp --source-port 67 --destination-port 68 -i ${1} -j ACCEPT
+               /sbin/iptables -A REDINPUT -p udp --source-port 67 --destination-port 68 -i ${1} -j ACCEPT
+               DHCP_START="-N -R -L /var/ipfire/dhcpc "
+               if [ -n "${DHCP_HOSTNAME}" ]; then
+                       DHCP_START+="-h ${DHCP_HOSTNAME}"
+         fi
+               /sbin/dhcpcd $1 $DHCP_START
+               # Save the return value
+               RET="$?"
+               # Print the assigned settings if requested
+               if [ "$RET" = "0" -a "$PRINTIP" = "yes" ]; then
+                       . /var/ipfire/dhcpc/dhcpcd-$1.info
+                       if [ "$PRINTALL" = "yes" ]; then
+                               echo ""
+                               echo_ok
+                               boot_mesg "           DHCP Assigned Settings for $1:"
+                               boot_mesg_flush
+                               boot_mesg "           IP Address:      $IPADDR"
+                               boot_mesg_flush
+                               if [ -n "${DHCP_HOSTNAME}" ]; then
+                                       boot_mesg "           Hostname:        $DHCP_HOSTNAME"
+                                       boot_mesg_flush
+                               fi
+                               boot_mesg "           Subnet Mask:     $NETMASK"
+                               boot_mesg_flush
+                               boot_mesg "           Default Gateway: $GATEWAY"
+                               boot_mesg_flush
+                               boot_mesg "           DNS Server:      $DNS"
+                               boot_mesg_flush
+                       else
+                               boot_mesg " IP Addresss: ""$IPADDR"
+                               echo_ok
+                       fi
+               else
+                       echo ""
+                       $(exit "$RET")
+                       evaluate_retval
+               fi
+       ;;
+
+       down)
+               boot_mesg -n "Stopping dhcpcd on the $1 interface..."
+               # Do nothing with the client daemon if we have an infinate 
+               # lease time as the client exits when started in this case,
+               # just echo OK.
+               DHCP_STOP="-k"
+               if [ -e $LEASEINFO ]
+               then
+                       . $LEASEINFO
+
+                       if [ "$LEASETIME" = "4294967295" ]
+                       then
+                               # do nothing, just echo ok
+                               echo ""
+                               echo_ok
+                       else
+                       if [ -n "$DHCP_STOP" ]
+                       then
+                               /sbin/dhcpcd $1 $DHCP_STOP &> /dev/null
+                               RET="$?"
+                               if [ "$RET" -eq 0 ]; then
+                                       echo ""
+                                       echo_ok
+                               elif [ "$RET" -eq 1 ]; then
+                                       boot_mesg "dhcpcd not running!" ${WARNING}
+                                       echo_warning
+                               else
+                                       echo ""
+                                       echo_failure
+                               fi
+                       else
+                               echo ""
+                               killproc dhcpcd
+                       fi
+                   fi
+               else
+                       boot_mesg -n "LEASEINFO Test failed! - " ${WARNING}
+                       boot_mesg "dhcpcd is not running!" ${WARNING}
+                       echo_warning
+                       exit 1
+               fi
+       ;;
+
+       *)
+               echo "Usage: $0 [interface] {up|down}"
+               exit 1
+       ;;
+esac
+
+# End $network_devices/services/dhcpcd
index 6669b28..a6c1584 100644 (file)
@@ -6,7 +6,7 @@
 #
 # Authors     : Michael Tremer - m.s.tremer@googlemail.com
 #
-# Version     : 00.00
+# Version     : 01.00
 #
 # Notes       : Written for IPFire by its team
 #
@@ -19,90 +19,67 @@ eval $(/usr/local/bin/readhash /var/ipfire/dhcp/settings)
 eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings)
 eval $(/usr/local/bin/readhash /var/ipfire/vpn/settings)
 
-# This is a small wrapper for dhcpcd.exe
-if ( echo $0 | /bin/grep -q 'dhcpcd.exe' ); then
-       /etc/rc.d/init.d/network red update $1 $2
-fi
-
 case "${1}" in
        start)
-               boot_mesg "Loading MASQ helper modules"
-               modprobe iptable_nat
-               modprobe ip_conntrack
-               modprobe ip_conntrack_ftp
-               modprobe ip_nat_ftp
-               modprobe ip_conntrack_h323
-               modprobe ip_nat_h323
-               modprobe ip_conntrack_irc
-               modprobe ip_nat_irc
-               modprobe ip_conntrack_mms
-               modprobe ip_nat_mms
-               modprobe ip_conntrack_pptp
-               modprobe ip_nat_pptp
-               modprobe ip_conntrack_sip
-               modprobe ip_nat_sip
+               boot_mesg "Loading iptables helper modules"
+               modprobe iptable_nat || failed=1
+               modprobe ip_conntrack || failed=1
+               modprobe ip_conntrack_ftp || failed=1
+               modprobe ip_nat_ftp || failed=1
+               modprobe ip_conntrack_h323 || failed=1
+               modprobe ip_nat_h323 || failed=1
+               modprobe ip_conntrack_irc || failed=1
+               modprobe ip_nat_irc || failed=1
+               modprobe ip_conntrack_mms || failed=1
+               modprobe ip_nat_mms || failed=1
+               modprobe ip_conntrack_pptp || failed=1
+               modprobe ip_nat_pptp || failed=1
+               modprobe ip_conntrack_sip || failed=1
+               modprobe ip_nat_sip || failed=1
+               (exit ${failed})
+               evaluate_retval
 
                # Remove possible leftover files
-               rm -f CONFIG_ROOT/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
-
-               # The 'for' loop force driver loading order
-               for NIC in 0 1 2 3; do
-                   ETHX="eth${NIC}"
-                   if [ "$GREEN_DEV" == "$ETHX" ]; then
-                       if [ "$GREEN_DRIVER" != "" ]; then
-                           modprobe $GREEN_DRIVER $GREEN_DRIVER_OPTIONS
-                           evaluate_retval
-                      fi
-                   fi
-                   if [ "$ORANGE_DEV" == "$ETHX" ]; then
-                       if [ "$ORANGE_DRIVER" != "" ]; then
-                           modprobe $ORANGE_DRIVER $ORANGE_DRIVER_OPTIONS
-                           evaluate_retval
-                       fi
-                   fi
-                   if [ "$BLUE_DEV" == "$ETHX" ]; then
-                       if [ "$BLUE_DRIVER" != "" ]; then
-                           modprobe $BLUE_DRIVER $BLUE_DRIVER_OPTIONS
-                           evaluate_retval
-                       fi
-                   fi
-                   if [ "$RED_DEV" == "$ETHX" ]; then
-                       if [ "$RED_DRIVER" != "" ]; then
-                           modprobe $RED_DRIVER $RED_DRIVER_OPTIONS
-                           evaluate_retval
-                       fi
-                   fi
-               done
-
+               rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
+               
                boot_mesg "Setting up IPFire firewall rules"
                /etc/rc.d/init.d/firewall start; evaluate_retval
 
                boot_mesg "Setting up IP Accounting"
-               /etc/rc.d/helper/writeipac.pl
-               /usr/sbin/fetchipac -S; evaluate_retval
+               /etc/rc.d/helper/writeipac.pl || failed=1
+               /usr/sbin/fetchipac -S || failed=1 
+               (exit ${failed})
+               evaluate_retval
 
                boot_mesg "Setting IPFire DMZ pinholes"
                /usr/local/bin/setdmzholes; evaluate_retval
 
-               if [ "$BLUE_DEV" != "" ]; then
+               if [ "$CONFIG_TYPE" = "4" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
                        boot_mesg "Setting up wireless firewall rules"
                        /usr/local/bin/restartwireless; evaluate_retval
                fi
-
-               # Bringing interfaces up...
-               $0 green up
-               $0 orange up
-               $0 blue up
-               $0 red up
-
-               ;;
+               
+               # Starting interfaces...
+               # GREEN
+               name=green /etc/rc.d/init.d/net/ifup
+               
+               # BLUE
+               if [ "$CONFIG_TYPE" = "4" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
+                       name=blue /etc/rc.d/init.d/net/ifup
+               fi
+               
+               # ORANGE
+               if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "7" ]; then
+                       name=orange /etc/rc.d/init.d/net/ifup
+               fi
+               
+               # RED
+               if [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
+                       name=red /etc/rc.d/init.d/net/ifup
+               fi
 
        stop)
-               # Stopping all interfaces...
-               $0 red down
-               $0 blue down
-               $0 orange down
-               $0 green down
+
                ;;
 
        restart)
@@ -111,246 +88,8 @@ case "${1}" in
                ${0} start
                ;;
 
-       #
-       # Every interface has its own context to start/stop/restart.
-       #
-       green)
-               case "${2}" in
-                       up)
-                               boot_mesg "Bringing green network up..."
-                               if [ "$GREEN_DEV" != "" ]; then
-                                       ifconfig $GREEN_DEV $GREEN_ADDRESS netmask $GREEN_NETMASK broadcast $GREEN_BROADCAST up
-                                       evaluate_retval
-                               else
-                                       echo "WARNING: No driver set for GREEN"
-                               fi
-                               ;;
-                       down)
-                               boot_mesg "Bringing green network down..."
-                               ifconfig $GREEN_DEV down 2> /dev/null; evaluate_retval
-                               ;;
-               esac
-               ;;
-
-       orange)
-               case "${2}" in
-                       up)
-                               if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "7" ]; then
-                                       if [ "$ORANGE_DEV" != "" ]; then
-                                               boot_mesg "Bringing orange network up..."
-                                               ifconfig $ORANGE_DEV $ORANGE_ADDRESS netmask $ORANGE_NETMASK broadcast $ORANGE_BROADCAST up
-                                               evaluate_retval
-                                       fi
-                               fi
-                               ;;
-                       down)
-                               if [ "$ORANGE_DEV" != "" ]; then
-                                       boot_mesg "Bringing orange network down..."
-                                       ifconfig $ORANGE_DEV down 2> /dev/null; evaluate_retval
-                               fi
-                               ;;
-               esac
-               ;;
-
-       blue)
-               case "${2}" in
-                       up)
-                               if [ "$CONFIG_TYPE" = "4" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
-                                       if [ "$BLUE_DEV" != "" ]; then
-                                               boot_mesg "Bringing blue network up..."
-                                               ifconfig $BLUE_DEV $BLUE_ADDRESS netmask $BLUE_NETMASK broadcast $BLUE_BROADCAST up
-                                               evaluate_retval
-                                       fi
-                               fi
-                               ;;
-                       down)
-                               if [ "$BLUE_DEV" != "" ]; then
-                                       boot_mesg "Bringing blue network down..."
-                                       ifconfig $BLUE_DEV down 2> /dev/null; evaluate_retval
-                               fi
-                               ;;
-               esac
-               ;;
-
-       red)
-               case "${2}" in
-                       up)
-                               boot_mesg "Bringing red network up..."
-                               # If RED is ethernet then check furthur...
-                               if [ "$CONFIG_TYPE" == "2" -o "$CONFIG_TYPE" == "3" -o "$CONFIG_TYPE" == "6" -o "$CONFIG_TYPE" == "7" ]; then
-                                       # If we are DHCP or STATIC we have to start automatically
-                                       if [ "$RED_TYPE" == "DHCP" -o "$RED_TYPE" == "STATIC" ]; then
-                                               AUTOCONNECT="on"
-                                       fi
-                               fi
-
-                               # Start DNSMASQ with defaults
-                               if [ "$DOMAIN_NAME_GREEN" == "" ]; then
-                                       /usr/sbin/dnsmasq -l /var/state/dhcp/dhcpd.leases
-                               else 
-                                       /usr/sbin/dnsmasq -l /var/state/dhcp/dhcpd.leases -s "$DOMAIN_NAME_GREEN"
-                               fi
-
-                               # Only when AUTOCONNECT is on
-                               if [ "$AUTOCONNECT" == "on" ]; then
-                                       /etc/rc.d/init.d/red start; evaluate_retval
-                               fi
-                               ;;
-                       down)
-                               boot_mesg "Bringing red network down..."
-                               /etc/rc.d/init.d/red stop
-                               sleep 3
-                               /etc/rc.d/init.d/red clear; evaluate_retval
-                               ;;
-                       update)
-                               if [ ! -e /var/lock/rc.updatered.lock ]; then
-                                       /usr/bin/touch /var/lock/rc.updatered.lock
-                                       /usr/bin/logger -s -p local0.info -t rc.updatered "$0 locking for $$"
-                               else
-                                       count=0
-                                       while [ ! $count = 5 ]; do
-                                               sleep 3
-                                               if [ ! -e /var/lock/rc.updatered.lock ]; then
-                                                       break
-                                               else
-                                                       /usr/bin/logger -s -p local0.info -t rc.updatered "$0 $$ waiting unlock"
-                                               fi
-                                               ((++count))
-                                       done
-                               fi
-
-                               IFACE=`/bin/cat /var/ipfire/red/iface 2>/dev/null | /usr/bin/tr -d '\012'`
-                               REMOTE=`/bin/cat /var/ipfire/red/remote-ipaddress 2>/dev/null | /usr/bin/tr -d '\012'`
-
-                               ###
-                               ### Retrieve DHCP Settings
-                               ###
-                               if [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3"  -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
-                                       if [ "$RED_TYPE" = "DHCP" ]; then
-                                               unset DNS1 DNS2
-                                               eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
-                                               if [ "$DNS1" = "" ]; then
-                                                       echo -n `/etc/rc.d/helper/getdnsfromdhcpc.pl 1` > /var/ipfire/red/dns1
-                                                       echo -n `/etc/rc.d/helper/getdnsfromdhcpc.pl 2` > /var/ipfire/red/dns2
-                                               else
-                                                       echo "$DNS1" > /var/ipfire/red/dns1
-                                                       echo "$DNS2" > /var/ipfire/red/dns2
-                                               fi
-                                               . /var/ipfire/dhcpc/dhcpcd-${RED_DEV}.info
-                                               echo "$IPADDR"  > /var/ipfire/red/local-ipaddress
-                                               echo "$GATEWAY" > /var/ipfire/red/remote-ipaddress
-                                       fi
-                               else
-                                       if [ "$PROTOCOL" = "RFC1483" -a "$METHOD" = "DHCP" ]; then
-                                               unset DNS1 DNS2
-                                               eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings)
-                                               if [ "$DNS" = "Automatic" ]; then
-                                                       echo -n `/etc/rc.d/helper/getdnsfromdhcpc.pl 1` > /var/ipfire/red/dns1
-                                                       echo -n `/etc/rc.d/helper/getdnsfromdhcpc.pl 2` > /var/ipfire/red/dns2
-                                               else 
-                                                       echo "$DNS1" > /var/ipfire/red/dns1
-                                                       echo "$DNS2" > /var/ipfire/red/dns2
-                                               fi
-                                               . /var/ipfire/dhcpc/dhcpcd-${IFACE}.info
-                                               echo $IPADDR  > /var/ipfire/red/local-ipaddress
-                                               echo $GATEWAY > /var/ipfire/red/remote-ipaddress
-                                       fi
-                               fi
-
-                               ###
-                               ### Retrieve DNS settings
-                               ###
-                               DNS1=`/bin/cat /var/ipfire/red/dns1 2>/dev/null | /usr/bin/tr -d '\012'`
-                               DNS2=`/bin/cat /var/ipfire/red/dns2 2>/dev/null | /usr/bin/tr -d '\012'`
-                               echo > /var/ipfire/red/resolv.conf    #clear it
-                               [ "$DNS1" != "" ] && echo "nameserver $DNS1" >  /var/ipfire/red/resolv.conf
-                               [ "$DNS2" != "" ] && echo "nameserver $DNS2" >> /var/ipfire/red/resolv.conf
-
-
-                               ###
-                               ### Restart DNSMASQ
-                               ###
-                               /bin/killall -KILL dnsmasq 2> /dev/null
-                               sleep 1
-
-                               DOMopt=""
-                               [ "$DOMAIN_NAME_GREEN" ] && DOMopt="-s $DOMAIN_NAME_GREEN"
-                               if [ -e "/var/ipfire/red/dial-on-demand" -a "$DIALONDEMANDDNS" == "on" -a ! -e "/var/ipfire/red/active" ]; then
-                                   /usr/sbin/dnsmasq -l /var/state/dhcp/dhcpd.leases $DOMopt -r /var/ipfire/ppp/fake-resolv.conf
-                               else
-                                   /usr/sbin/dnsmasq -l /var/state/dhcp/dhcpd.leases $DOMopt -r /var/ipfire/red/resolv.conf
-                               fi
-                               unset DOMopt
-
-                               # Reset default route to ippp0 for dial on demand
-                               if [ -e "/var/ipfire/red/dial-on-demand" -a "$TYPE" == "isdn" -a ! -e "/var/ipfire/red/active" ]; then
-                                       /sbin/route del default 2> /dev/null
-                                       if [ ! -z "$REMOTE" ]; then
-                                               /sbin/route add default gw $REMOTE 2> /dev/null
-                                       else
-                                               /sbin/route add default dev ippp0  2> /dev/null
-                                       fi
-                               fi
-
-                               if [ "$3" ]; then
-                                       eval $(/usr/local/bin/readhash "$3")
-                                       case "$4" in
-                                               up)
-                                                       /usr/bin/logger -s -p local0.info -t dhcpcd.exe "${INTERFACE} has been configured with old IP=${IPADDR}"
-                                                       if [ "$RED_TYPE" != 'PPTP' ]; then
-                                                               /usr/bin/touch /var/ipfire/red/active
-                                                       fi
-                                                       ;;
-                                               new)
-                                                       /usr/bin/logger -s -p local0.info -t dhcpcd.exe "${INTERFACE} has been configured with new IP=${IPADDR}"
-                                                       if [ -e "/var/ipfire/red/active" ]; then
-                                                               /usr/local/bin/setfilters
-                                                               /usr/local/bin/setportfw
-                                                               /usr/local/bin/setxtaccess
-                                                               /usr/local/bin/setddns.pl -f
-                                                               /usr/local/bin/restartsnort red
-                                                               sleep $VPN_DELAYED_START && /usr/local/bin/ipsecctrl S &
-                                                               /bin/rm -f /var/lock/rc.updatered.lock
-                                                               /usr/bin/logger -s -p local0.info -t rc.updatered "unlocking from $$"
-                                                               exit 0
-                                                       else
-                                                               if [ "$RED_TYPE" != 'PPTP' ]; then
-                                                                       /usr/bin/touch /var/ipfire/red/active
-                                                               fi
-                                                       fi
-                                                       ;;
-                                               down)
-                                                       /usr/bin/logger -s -p local0.info -t dhcpcd.exe "${INTERFACE} has been brought down"
-                                                       rm -f /var/ipfire/red/active
-                                                       ;;
-                                       esac
-                               fi
-
-                               if [ -e "/var/ipfire/red/active" ]; then
-                                       [ "$IFACE" != "" ] && /sbin/ifconfig $IFACE -multicast
-                                       /etc/rc.d/init.d/firewall reload
-                                       /usr/local/bin/setfilters
-                                       /usr/local/bin/restartsnort red
-                                       /usr/local/bin/qosctrl restart
-                                       /usr/local/bin/setportfw
-                                       /usr/local/bin/setxtaccess
-                                       /usr/local/bin/setddns.pl -f
-                                       /etc/rc.d/helper/writeipac.pl
-                                       /usr/sbin/fetchipac -S
-                                       sleep $VPN_DELAYED_START && /usr/local/bin/ipsecctrl S &
-                               else
-                                       /usr/local/bin/ipsecctrl D
-                                       /etc/rc.d/init.d/firewall reload
-                               fi
-                               /bin/rm -f /var/lock/rc.updatered.lock
-                               /usr/bin/logger -s -p local0.info -t rc.updatered "unlocking from $$"
-                               ;;
-               esac
-               ;;
-
        *)
                echo "Usage: ${0} {start|stop|restart}"
-               echo "   or: ${0} {green|orange|blue|red} {up|down}"
                exit 1
                ;;
 esac
index d63daa9..ede0a70 100644 (file)
@@ -15,72 +15,6 @@ extern char *mylog;
 
 extern char **ctr;
 
-extern int raid_disk;
-
-/* called to write out all config files using the keyvalue interface. */
-int write_disk_configs(struct devparams *dp)
-{
-       char devnode[STRING_SIZE];
-       
-       /* dev node links. */
-       snprintf(devnode, STRING_SIZE, "%s", dp->devnode);
-       if (symlink(devnode, "/harddisk/dev/harddisk"))
-       {
-               errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK]);
-               return 0;
-       }
-       if (raid_disk)
-               snprintf(devnode, STRING_SIZE, "%sp1", dp->devnode);
-       else
-               snprintf(devnode, STRING_SIZE, "%s1", dp->devnode);
-       if (symlink(devnode, "/harddisk/dev/harddisk1"))
-       {
-               errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK1]);
-               return 0;
-       }
-       if (raid_disk)
-               snprintf(devnode, STRING_SIZE, "%sp2", dp->devnode);
-       else
-               snprintf(devnode, STRING_SIZE, "%s2", dp->devnode);
-       if (symlink(devnode, "/harddisk/dev/harddisk2"))
-       {
-               errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK2]);
-               return 0;
-       }
-       if (raid_disk)
-               snprintf(devnode, STRING_SIZE, "%sp3", dp->devnode);
-       else
-               snprintf(devnode, STRING_SIZE, "%s3", dp->devnode);
-       if (symlink(devnode, "/harddisk/dev/harddisk3"))
-       {
-               errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK3]);
-               return 0;
-       }
-       if (raid_disk)
-               snprintf(devnode, STRING_SIZE, "%sp4", dp->devnode);
-       else
-               snprintf(devnode, STRING_SIZE, "%s4", dp->devnode);
-       if (symlink(devnode, "/harddisk/dev/harddisk4"))
-       {
-               errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK4]);
-               return 0;
-       }
-
-       /* Add /dev/root symlink linking to the root filesystem to 
-        * keep updfstab happy */
-       if (raid_disk)
-               snprintf(devnode, STRING_SIZE, "%sp4", dp->devnode);
-       else
-               snprintf(devnode, STRING_SIZE, "%s4", dp->devnode);
-       if (symlink(devnode, "/harddisk/dev/root"))
-       {
-               errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_ROOT]);
-               return 0;
-       }
-
-       return 1;
-}
-
 int write_lang_configs( char *lang)
 {
        struct keyvalue *kv = initkeyvalues();
index 9bd629d..e28e05e 100644 (file)
@@ -513,12 +513,6 @@ int main(int argc, char *argv[])
        /* Rename uname */
        rename ("/harddisk/bin/uname.bak", "/harddisk/bin/uname");
 
-       /* *always* write disk configuration */
-       if (!(write_disk_configs(&hdparams))){
-         errorbox(ctr[TR_ERROR_WRITING_CONFIG]);
-         goto EXIT;
-       }
-
        /* mount proc filesystem */
        mysystem("mkdir /harddisk/proc");
        mysystem("/bin/mount -t proc none /harddisk/proc");