From 85cb243d94fb54052626a6d00573db7f0f4b76d7 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Thu, 17 Dec 2009 11:59:04 +0100 Subject: [PATCH] Do not modify network when root is not on iSCSI We only should modify the network parameter if root really is found to be on iSCSI; otherwise we might get unexpected results. References: bnc#562030 Signed-off-by: Hannes Reinecke diff --git a/etc/mkinitrd/mkinitrd-setup.sh b/etc/mkinitrd/mkinitrd-setup.sh index 5db0853..7630ac1 100644 --- a/etc/mkinitrd/mkinitrd-setup.sh +++ b/etc/mkinitrd/mkinitrd-setup.sh @@ -54,43 +54,42 @@ save_var iscsi_sessions if [ "${root_iscsi}" ]; then for session in $iscsi_sessions; do - eval TargetName${session}=$(cat /sys/class/iscsi_session/session${session}/targetname) + eval TargetName${session}=$(cat /sys/class/iscsi_session/session${session}/targetname) eval TargetAddress${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/address) eval TargetPort${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/port) - + save_var TargetName${session} save_var TargetAddress${session} save_var TargetPort${session} done # copy the iscsi configuration cp -rp /etc/iscsi etc/ -fi -if [ -d /sys/firmware/ibft ] ; then - # copy iBFT interface - for ibft_if in /sys/firmware/ibft/ethernet* ; do - read ibft_flags < $ibft_if/flags - # Bit1 is 'Firmware boot selected' - if (( $ibft_flags & 2 )) ; then - for if in $ibft_if/device/net/* ; do - if [ -d $if ] ; then - interface="${if##*/}" - fi - done - fi - # Bit 3 of 'origin' is DHCP - read ibft_origin < $ibft_if/origin - if (( $ibft_origin & 8 )) ; then - nettype="dhcp" - else - nettype="static" - fi - done -fi - -if [ -z "$interface" ] ; then - interface="default" -fi + if [ -d /sys/firmware/ibft ] ; then + # copy iBFT interface + for ibft_if in /sys/firmware/ibft/ethernet* ; do + read ibft_flags < $ibft_if/flags + # Bit1 is 'Firmware boot selected' + if (( $ibft_flags & 2 )) ; then + for if in $ibft_if/device/net/* ; do + if [ -d $if ] ; then + interface="${if##*/}" + fi + done + fi + # Bit 3 of 'origin' is DHCP + read ibft_origin < $ibft_if/origin + if (( $ibft_origin & 8 )) ; then + nettype="dhcp" + else + nettype="static" + fi + done + fi -save_var TargetPort 3260 # in case the port was not defined via command line we assign a default port + if [ -z "$interface" ] ; then + interface="default" + fi + save_var TargetPort 3260 # in case the port was not defined via command line we assign a default port +fi