X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=conf_files%2Fpl_netinit;h=1aced1ba56d70d33037e0c0b3fb2971b7185be7b;hb=refs%2Fheads%2Fplanetlab-3_3-branch;hp=b3934f67721c6976c0bd4922368fc7a1a73c1a95;hpb=96949585001ec30528617d507fa2cfa081adaac6;p=bootcd.git diff --git a/conf_files/pl_netinit b/conf_files/pl_netinit index b3934f6..1aced1b 100644 --- a/conf_files/pl_netinit +++ b/conf_files/pl_netinit @@ -54,12 +54,13 @@ IFCONFIG_OUTPUT=/tmp/ifconfig # (no other configuration file found) DEFAULT_NET_CONF=0 + net_init_failed() { echo echo "pl_netinit: network initialization failed," echo "pl_netinit: shutting down machine in two hours" - /bin/sleep 7200 + /bin/sleep 2h /sbin/shutdown -h now exit 1 } @@ -124,12 +125,6 @@ find_node_config() echo "pl_netinit: looking for node configuration file on flash based devices" - echo "pl_netinit: waiting for flash devices if any to come online" - # some usb flash based devices take a couple of seconds to initialize - # also, try to read the partition table off the device to make sure - # it shows up in /sys/block - /bin/sleep 10s - # make the sd* expansion fail to an empty string if there are no sd # devices shopt -s nullglob @@ -140,26 +135,29 @@ find_node_config() continue fi - check_dev=/dev/`basename $device`1 - - echo "pl_netinit: looking for node configuration file on device $check_dev" - /bin/mount -o ro -t $NODE_CONF_DEVICE_FS_TYPES $check_dev \ - $CONF_DEVICE_MOUNT_POINT 2>&1 > /dev/null - if [[ $? -eq 0 ]]; then - if [ -r "$CONF_DEVICE_MOUNT_POINT/$NEW_NODE_CONF_NAME" ]; then - echo "pl_netinit: found node configuration file plnode.txt, using" + partitions=$(/bin/awk "\$4 ~ /`basename $device`[0-9]*/ { print \$4 }" /proc/partitions) + for partition in $partitions ; do + check_dev=/dev/$partition + + echo "pl_netinit: looking for node configuration file on device $check_dev" + /bin/mount -o ro -t $NODE_CONF_DEVICE_FS_TYPES $check_dev \ + $CONF_DEVICE_MOUNT_POINT 2>&1 > /dev/null + if [[ $? -eq 0 ]]; then + if [ -r "$CONF_DEVICE_MOUNT_POINT/$NEW_NODE_CONF_NAME" ]; then + echo "pl_netinit: found node configuration file plnode.txt, using" + + conf_file="$CONF_DEVICE_MOUNT_POINT/$NEW_NODE_CONF_NAME" + /etc/init.d/pl_validateconf < $conf_file > $USED_NET_CONF + echo "pl_netinit: found configuration" + /bin/umount $CONF_DEVICE_MOUNT_POINT + return 1 + fi + + echo "pl_netinit: not found" - conf_file="$CONF_DEVICE_MOUNT_POINT/$NEW_NODE_CONF_NAME" - /etc/init.d/pl_validateconf < $conf_file > $USED_NET_CONF - echo "pl_netinit: found configuration" /bin/umount $CONF_DEVICE_MOUNT_POINT - return 1 fi - - echo "pl_netinit: not found" - - /bin/umount $CONF_DEVICE_MOUNT_POINT - fi + done done # normal filename expansion setting @@ -247,8 +245,7 @@ if [[ -n "$NET_DEVICE" ]]; then # device for it. echo "pl_netinit: looking for a device with mac address $NET_DEVICE" - pushd . - cd /sys/class/net + pushd /sys/class/net for device in *; do dev_address=`cat $device/address` if [[ "$dev_address" == "$NET_DEVICE" ]]; then @@ -258,12 +255,6 @@ if [[ -n "$NET_DEVICE" ]]; then fi done popd - -elif [[ -n "$PRIMARY_DEV" ]]; then - # the user specified a virtual ethernet device to use. - ETH_DEVICE=$PRIMARY_DEV - echo "pl_netinit: using user specified device $ETH_DEVICE" - else ETH_DEVICE=$DEFAULT_NET_DEV echo "pl_netinit: using default device $ETH_DEVICE" @@ -286,9 +277,15 @@ fi # actually check to make sure ifconfig succeeds /sbin/ifconfig $ETH_DEVICE up 2>&1 > /dev/null if [[ $? -ne 0 ]]; then - echo "pl_netinit: device $ETH_DEVICE does not exist," - echo "pl_netinit: this is due to either the device not existing," - echo "pl_netinit: or its device drivers not being loaded" + echo "pl_netinit: device $ETH_DEVICE does not exist, most likely" + echo "pl_netinit: this cd does not have hardware support for your" + echo "pl_netinit: network adapter. please send the following lines" + echo "pl_netinit: to PlanetLab Support: support@planet-lab.org" + echo "pl_netinit: for further assistance" + echo + /sbin/lspci -n | /bin/grep "Class 0200" + echo + net_init_failed fi