From 14c4b7c9d4960d3ff7567e751a1d58886b8a3e52 Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Tue, 21 Jun 2005 18:50:18 +0000 Subject: [PATCH] - when checking removable flash devices, check all partitions on it (including the case when there are no partitions on it (e.g. just /dev/sda instead of /dev/sda1), i.e. the way I'm about to recommend that the flash devices be formatted in the documentation: dd if=PlanetLab-BootCD-3.0.usb of=/dev/sda) --- conf_files/pl_netinit | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/conf_files/pl_netinit b/conf_files/pl_netinit index a627bd2..1aced1b 100644 --- a/conf_files/pl_netinit +++ b/conf_files/pl_netinit @@ -135,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" - - 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" + 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" + /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 -- 2.43.0