diff options
author | Dirk von Suchodoletz | 2007-02-04 18:42:44 +0100 |
---|---|---|
committer | Dirk von Suchodoletz | 2007-02-04 18:42:44 +0100 |
commit | 5d0890ca42edecd5f7356bc6dac856eb56bd8ec2 (patch) | |
tree | 5980c55b7a07a3798a864d15967faf9a94a63f4a /initramfs | |
parent | Renaming of variables (in slx init/functions) to be compatible with (diff) | |
download | core-5d0890ca42edecd5f7356bc6dac856eb56bd8ec2.tar.gz core-5d0890ca42edecd5f7356bc6dac856eb56bd8ec2.tar.xz core-5d0890ca42edecd5f7356bc6dac856eb56bd8ec2.zip |
Fix for subnet_mask in machine-setup (via slx init from kernel cmdline).
Some improvement for stage3 error exit ...
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@678 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs')
-rw-r--r-- | initramfs/initrd-stuff/etc/functions | 28 | ||||
-rw-r--r-- | initramfs/initrd-stuff/etc/messages | 4 | ||||
-rwxr-xr-x | initramfs/initrd-stuff/init | 12 |
3 files changed, 26 insertions, 18 deletions
diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions index 41a231a3..dff1d74a 100644 --- a/initramfs/initrd-stuff/etc/functions +++ b/initramfs/initrd-stuff/etc/functions @@ -100,12 +100,14 @@ else modprobe -a usbcore uhci-hcd ohci-hcd usbhid >/dev/null 2>&1 /bin/sh echo -n "Reboot now? [y]" + exec < /dev/console > /dev/console + input="y" read input -# [ -z "$input" -o "$input" = "y" -o "$input" = "Y" ] && { -# usleep 5000 -# [ -f /proc/sysrq-trigger ] || mount -t proc none /proc -# echo "b" > /proc/sysrq-trigger -# } + [ -z "$input" -o "$input" = "y" -o "$input" = "Y" ] && { + sleep 4 + [ -f /proc/sysrq-trigger ] || mount -t proc none /proc + echo "b" > /proc/sysrq-trigger + } fi } ############################################################################# @@ -277,13 +279,14 @@ local nm=$2 local gw=$3 local bc=$4 local if=$5 +local ret=0 for ipcfg in ip ifconfig none; do test -x /bin/$ipcfg && break; done case $ipcfg in # the standard linux ip configuration tool ip) - ip link set dev $if up 2>/dev/null + ip link set dev $if up 2>/dev/null || ret=1 ip addr add $ip/`nm2pref $nm` broadcast $bc dev $if 2>/dev/null if [ "$gw" != "0.0.0.0" ] ; then ip route add default via $gw 2>/dev/null @@ -297,21 +300,23 @@ case $ipcfg in # traditional ifconfig/route - if a distro does not provide ip ifconfig) if [ "$ip" = "0.0.0.0" ]; then - ifconfig $if up + ifconfig $if up || ret=1 else - ifconfig $if $ip netmask $nm broadcast $bc + ifconfig $if $ip netmask $nm broadcast $bc || ret=1 fi [ "$gw" != "0.0.0.0" ] && route add default gw $gw MAC=$(ifconfig $if|sed -n "/HWaddr [0-9A-F]\{2\}:.*/p" \ | sed -e "s/.*HWaddr //;y/ABCDEF/abcdef/") # if multicast is required for dnbd - [ -n "$nbdhost" ] && [ `echo $nbdhost|sed "s,\..*,,"` -ge 224 ] && \ + [ -n "$nbdhost" ] && [ $(echo $nbdhost|sed "s,\..*,,") -ge 224 ] && \ route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 ;; none) error "$error_iptool" + ret=1 ;; esac +return $ret } ############################################################################# # replace @@@serverip@@@ with real serverip. Allows the usage of a variable @@ -372,7 +377,7 @@ fi } ############################################################################# -# dhcp client function (support dhclient, dhcpcd, pump, udhcpc) +# dhcp client function (supporting dhclient, dhcpcd, pump, udhcpc) rundhcp () { local vci="$1" @@ -385,7 +390,8 @@ else # ensure the interface is up - might produce conflicts - nbd could # fail!! [ -n "$noipyet" ] && \ - ipsetup 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 eth0 + ipsetup 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 eth0 \ + 2>/dev/null || error "$init_noeth" [ -f /lib/modules/@@@KERNVER@@@/kernel/net/packet/af_packet.ko ] && \ loadmod /lib/modules/@@@KERNVER@@@/kernel/net/packet/af_packet.ko \ "needed for dhcp"; diff --git a/initramfs/initrd-stuff/etc/messages b/initramfs/initrd-stuff/etc/messages index a8f203d1..1658aa4d 100644 --- a/initramfs/initrd-stuff/etc/messages +++ b/initramfs/initrd-stuff/etc/messages @@ -7,7 +7,7 @@ # If you have any feedback please consult http://openslx.org/feedback and # send your feedback to feedback@openslx.org # -# General information about OpenSLX can be found under http://openslx.org +# General information about OpenSLX can be found at http://openslx.org # # messages file for all error and info messages generated during client # bootup (within initialramfs) for OpenSLX linux diskless clients version 4 @@ -21,6 +21,8 @@ init_dff="The distro $init_errmsg" init_dscf="The distribution specific configuration file could not be found." init_sscf="The slx configuration variables could not be found. Please provide the slxconfig file." +init_noeth=" Unable to configure the ethernet device (eth0). Please check \ +for an\n appropriate kernel module." init_errip=" Unable to setup at \ least basic functionality, because no IP configuration\n available. You \ might pass that information via kernel command line\n through setting of \ diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init index c2bdb5af..be761abe 100755 --- a/initramfs/initrd-stuff/init +++ b/initramfs/initrd-stuff/init @@ -212,13 +212,13 @@ nfsroot=\"${nfsroot}\"\n" >> /etc/machine-setup vci=*) vci=${opts#vci=};; xenbr) - XENBR=1;; + xenbr=1;; esac done # at this point a timer should be started to ensure an automated reboot # or halt of the machine if SLX init does not succeed (e.g. missing kernel # module for the network adaptor) -if [ "${DEBUGLEVEL}" -lt 3 ] ; then +if [ ${DEBUGLEVEL} -lt 3 -o ${DEBUGLEVEL} = 8 ] ; then [ -x /bin/busybox ] && shtype=a cat<<EOF > /bin/watchdog #!/bin/${shtype}sh @@ -290,13 +290,13 @@ done ipsetup 127.0.0.1 255.0.0.0 0.0.0.0 127.255.255.255 lo # Xen bridge config -[ -n "$XENBR" ] && xenbr_config +[ -n "$xenbr" ] && xenbr_config # analyze ip information from the kernel command line and put parts # of it into several variables if [ -n "$ipinfo" ] ; then getip () { - val="$ipinfo:"; i=$(expr $1 - 1); + local val="$ipinfo:"; i=$(expr $1 - 1); while [ $i -gt 0 ] ; do val=${val#*:} ; i=$(expr $i - 1); done; @@ -306,7 +306,7 @@ if [ -n "$ipinfo" ] ; then gateway=$(getip 3) subnet_mask=$(getip 4) echo -e "# ip configuration written by $0 script\nclientip=$clientip\n\ -subnet_mask=$sub_netmask\ngateway=$gateway\nserverip=$serverip" \ +subnet_mask=$subnet_mask\ngateway=$gateway\nserverip=$serverip" \ >>/etc/machine-setup # set static ip address via function ipsetup ipsetup $clientip $subnet_mask $gateway 255.255.255.255 eth0 @@ -314,7 +314,7 @@ else noipyet="yes" fi # get configuration data via dhcp (with vendor code identifier if present -# in ${vci} (from kernel command line) ... +# in ${vci} from kernel command line or machine-setup) ... [ -n "$dhcp" ] && rundhcp ${vci} & if [ -n "$noipyet" ] ; then waitfor /tmp/dhcp-done 20000 |