Author: ug Date: Fri Jun 10 15:22:36 2011 New Revision: 64315 URL: http://svn.opensuse.org/viewcvs/yast?rev=64315&view=rev Log: last patch reverted Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/include/io.ycp Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes?rev=64315&r1=64314&r2=64315&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes Fri Jun 10 15:22:36 2011 @@ -1,10 +1,4 @@ ------------------------------------------------------------------- -Fri Jun 10 15:06:40 CEST 2011 - ug@suse.de - -- merged the code for autoyast=device and autoyast=usb to reduce - redundancy and fix the "already mounted" bug for USB (bnc#565558) - -------------------------------------------------------------------- Tue Jun 7 11:24:16 CEST 2011 - ug@suse.de - Some machines can't boot with the new alignment that parted uses Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/include/io.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/include/io.ycp?rev=64315&r1=64314&r2=64315&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/include/io.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/include/io.ycp Fri Jun 10 15:22:36 2011 @@ -199,7 +199,7 @@ WFM::Execute(.local.umount, mount_point); } - else if (Scheme == "floppy") + else if (Scheme == "floppy" || Scheme == "usb") { if (StorageDevices::FloppyReady() && Scheme == "floppy") { @@ -215,91 +215,104 @@ ok = true; } SCR::Execute(.target.umount, mount_point); - } - } - else if (Scheme == "device" || Scheme == "usb" ) // Device or USB - { - if ( Path != "") - { - list<string> deviceList = []; - if( Host == "" ) { - list<map> disks = (Scheme == "device") ? (list<map>)SCR::Read(.probe.disk) : (list<map>)SCR::Read(.probe.usb); - foreach( map m, disks, ``{ - if( Scheme == "usb" && - m["bus"]:"USB" != "SCSI" ) - continue; - if( haskey( m, "dev_name") ) { - integer i = 0; - string dev = m["dev_name"]:""; - deviceList = add( deviceList, substring( dev, 5 ) ); // not uncommon for USB sticks to have no partition - do { + } else { + y2milestone("looking for %1 on USB", Path); + list<map> probe = (list<map>)SCR::Read(.probe.usb); + foreach( map d, probe, ``{ + if( d["bus"]:"USB" == "SCSI" && haskey(d, "dev_name") ) { + integer i = 0; + string dev = d["dev_name"]:""; + while( SCR::Read(.target.lstat, dev) != $[] || i < 5 ) { + string mounts = (string)(SCR::Read (.target.string, "/proc/mounts")); + list<string> mount_list = splitstring( mounts, "\n" ); + boolean already_mounted = false; + foreach( string m, mount_list, ``{ + list<string> entries = splitstring( m, " " ); + // FIXME: check for bind-mounted + if( entries[0]:"" == dev ) { + already_mounted = true; + mount_point = entries[1]:""; + break; + } + }); + y2milestone("already mounted=%1 mountpoint=%2",already_mounted,mount_point); + if( ! already_mounted && !(boolean)WFM::Execute(.local.mount, [ dev, mount_point ]) ) { + y2milestone("mount failed for %1", dev); i = i + 1; - dev = m["dev_name"]:"" + sformat("%1",i); - if( SCR::Read(.target.lstat, dev) != $[] ) - deviceList = add( deviceList, substring( dev, 5 ) ); - } while( SCR::Read(.target.lstat, dev) != $[] || i < 5 ); + dev = d["dev_name"]:"" + sformat("%1",i); + continue; + } + if (WFM::Execute (.local.bash, "/bin/cp " + mount_point + "/" + Path + " " + Localfile) != 0) { + y2milestone("not found on %1",dev); + } else { + y2milestone("found on %1", dev); + GET_error = ""; + ok = true; + } + if( !already_mounted ) + SCR::Execute(.target.umount, mount_point); + if( ok == true ) + break; + i = i + 1; + dev = d["dev_name"]:"" + sformat("%1",i); } - }); - y2milestone("devices to look on: %1", deviceList); - } else { - /* - sometimes we have devices like /dev/cciss/c1d0p5 - those "nested" devices will be catched here - as long as we find a directory where we expect a device, - we cut down the Path and enhance the Host (device name) - */ - while( SCR::Read( .target.dir, "/dev/"+Host ) != nil ) { + } + if( ok == true ) + break; + }); + } + } + else if (Scheme == "device") // Device + { + if ( Host != "" && Path != "") + { + /* + sometimes we have devices like /dev/cciss/c1d0p5 + those "nested" devices will be catched here + as long as we find a directory where we expect a device, + we cut down the Path and enhance the Host (device name) + */ + while( SCR::Read( .target.dir, "/dev/"+Host ) != nil ) { y2milestone("nested device found"); list<string> l = splitstring( Path, "/" ); Host = Host + "/" + l[0]:""; l = remove(l,0); Path = mergestring(l,"/"); y2milestone("Host=%1 Path=%2",Host,Path); - } - // catching nested devices done - deviceList = [ Host ]; } - foreach( string Host, deviceList, ``{ - y2milestone("looking for profile on %1", Host); - string mounts = (string)(SCR::Read (.target.string, "/proc/mounts")); - list<string> mount_list = splitstring( mounts, "\n" ); - boolean already_mounted = false; - foreach( string m, mount_list, ``{ - list<string> entries = splitstring( m, " " ); - if( entries[0]:"" == "/dev/"+Host ) { - already_mounted = true; - mount_point = entries[1]:""; - break; - } - }); - y2milestone("already mounted=%1 mountpoint=%2",already_mounted,mount_point); - if( ! already_mounted && - !(boolean)SCR::Execute(.target.mount, [sformat("/dev/%1", Host), - mount_point], "-o noatime") ) { - y2milestone("%1 is not mounted and mount failed", sformat("/dev/%1", Host)); - GET_error = sformat(_("%1 is not mounted and mount failed"), sformat("/dev/%1", Host)); - continue; - } + // catching nested devices done - if (WFM::Execute (.local.bash, "/bin/cp " + mount_point + "/" + Path + " " + Localfile) != 0 ) - { - // autoyast tried to copy a file but that file can't be found - GET_error = sformat(_("File %1 cannot be found"),mount_point + Path); - y2milestone("file %1 can't be found", mount_point + Path); - } - else - { - GET_error = ""; - ok = true; - y2milestone("found"); - } - if( ! already_mounted ) - WFM::Execute(.local.umount, mount_point); - if( ok == true ) - break; - }); + string mounts = (string)(SCR::Read (.target.string, "/proc/mounts")); + list<string> mount_list = splitstring( mounts, "\n" ); + boolean already_mounted = false; + foreach( string m, mount_list, ``{ + list<string> entries = splitstring( m, " " ); + if( entries[0]:"" == "/dev/"+Host ) { + already_mounted = true; + mount_point = entries[1]:""; + break; } - } + }); + y2milestone("already mounted=%1 mountpoint=%2",already_mounted,mount_point); + if( ! already_mounted ) + WFM::Execute(.local.mount, [sformat("/dev/%1", Host) , + mount_point]); + + if (WFM::Execute (.local.bash, "/bin/cp " + mount_point + "/" + Path + " " + Localfile) != 0 ) + { + // autoyast tried to copy a file but that file can't be found + GET_error = sformat(_("File %1 cannot be found"),mount_point + Path); + y2error("file %1 can't be found", mount_point + Path); + } + else + { + GET_error = ""; + ok = true; + } + if( ! already_mounted ) + WFM::Execute(.local.umount, mount_point); + } + } else if (Scheme == "tftp") // Device { if (TFTP::Get( Host, Path, Localfile )) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org