[yast-commit] r40987 - in /trunk/storage: VERSION libstorage/src/Storage.cc package/yast2-storage.changes storage/src/include/custom_part_lib.ycp storage/src/modules/Storage.ycp
Author: fehr Date: Thu Sep 20 15:52:49 2007 New Revision: 40987 URL: http://svn.opensuse.org/viewcvs/yast?rev=40987&view=rev Log: - make importing fstab cope with changing disk names (#309774) - version 2.15.26 Modified: trunk/storage/VERSION trunk/storage/libstorage/src/Storage.cc trunk/storage/package/yast2-storage.changes trunk/storage/storage/src/include/custom_part_lib.ycp trunk/storage/storage/src/modules/Storage.ycp Modified: trunk/storage/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/VERSION?rev=40987&r1=40986&r2=40987&view=diff ============================================================================== --- trunk/storage/VERSION (original) +++ trunk/storage/VERSION Thu Sep 20 15:52:49 2007 @@ -1 +1 @@ -2.15.25 +2.15.26 Modified: trunk/storage/libstorage/src/Storage.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=40987&r1=40986&r2=40987&view=diff ============================================================================== --- trunk/storage/libstorage/src/Storage.cc (original) +++ trunk/storage/libstorage/src/Storage.cc Thu Sep 20 15:52:49 2007 @@ -5748,6 +5748,7 @@ Storage::readFstab( const string& dir, deque<VolumeInfo>& infos ) { static deque<VolumeInfo> vil; + static Regex disk_part( "^/dev/[sh]d[a-z]+[0-9]+$" ); vil.clear(); bool ret = false; VolIterator vol; @@ -5759,13 +5760,31 @@ for( list<FstabEntry>::const_iterator i=le.begin(); i!=le.end(); ++i ) { y2mil( "entry:" << *i ); - if( findVolume( i->dentry, vol ) ) + VolumeInfo* info = NULL; + if( disk_part.match( i->dentry ) ) { - VolumeInfo info; - vol->getInfo( info ); - vol->mergeFstabInfo( info, *i ); + info = new VolumeInfo; + info->create = info->format = info->resize = false; + info->sizeK = info->OrigSizeK = info->minor = info->major = 0; + info->device = i->dentry; + info->mount = i->mount; + info->mount_by = MOUNTBY_DEVICE; + info->fs = Volume::toFsType( i->fs ); + info->fstab_options = mergeString( i->opts, "," ); + vil.push_back( *info ); + } + else if( findVolume( i->dentry, vol ) ) + { + info = new VolumeInfo; + vol->getInfo( *info ); + vol->mergeFstabInfo( *info, *i ); y2mil( "volume:" << *vol ); - vil.push_back( info ); + vil.push_back( *info ); + } + if( info ) + { + delete info; + info = NULL; } } delete fstab; Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=40987&r1=40986&r2=40987&view=diff ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Thu Sep 20 15:52:49 2007 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Sep 20 15:50:27 CEST 2007 - fehr@suse.de + +- make importing fstab cope with changing disk names (#309774) +- version 2.15.26 + +------------------------------------------------------------------- Tue Sep 18 18:22:57 CEST 2007 - fehr@suse.de - fix wrong cryptotab line for old style encryption (#325597) @@ -6,7 +12,7 @@ ------------------------------------------------------------------- Mon Sep 17 14:26:39 CEST 2007 - fehr@suse.de -- version 2.15.24 +- version 2.15.25 ------------------------------------------------------------------- Thu Sep 13 12:54:38 CEST 2007 - fehr@suse.de Modified: trunk/storage/storage/src/include/custom_part_lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_lib.ycp?rev=40987&r1=40986&r2=40987&view=diff ============================================================================== --- trunk/storage/storage/src/include/custom_part_lib.ycp (original) +++ trunk/storage/storage/src/include/custom_part_lib.ycp Thu Sep 20 15:52:49 2007 @@ -28,6 +28,61 @@ #include "partitioning/partition_defines.ycp"; +define string mountVar( map var, map root, string rdev, string mp, + map<string,map> targetMap ) + ``{ + string ret = ""; + boolean mount_success = false; + y2milestone( "mountVar rdev:%1 mp:%2 var:%3 root:%4", rdev, mp, var, root ); + if( var["size_k"]:0>0 ) + { + ret = var["device"]:""; + } + else + { + list<string> ds = maplist( string d, map disk, targetMap, ``(d)); + y2milestone( "mountVar ds:%1", ds ); + ds = filter( string d, ds, ``(targetMap[d,"type"]:`CT_UNKNOWN==`CT_DISK)); + y2milestone( "mountVar ds:%1", ds ); + map rootm = Storage::GetDiskPartition( rdev ); + map rootf = Storage::GetDiskPartition( root["device"]:"" ); + map varf = Storage::GetDiskPartition( var["device"]:"" ); + if( rootf["disk"]:""==varf["disk"]:"" ) + { + ret = Storage::GetDeviceName( rootm["disk"]:"", varf["nr"]:(any)0 ); + } + else if( size(ds)==1 ) + { + ret = Storage::GetDeviceName( ds[0]:"", varf["nr"]:(any)0 ); + } + else if( size(ds)>1 ) + { + integer i = 0; + while( i<size(ds) && size(ret)==0 ) + { + ret = Storage::GetDeviceName( ds[i]:"", varf["nr"]:(any)0 ); + if( size(Storage::GetPartition( targetMap, ret ))>0 && + Storage::Mount( ret, mp ) ) + { + map d = (map)SCR::Read( .target.stat, mp+"/lib/hardware" ); + y2milestone( "mountVar d:%1", d ); + if( !d["isdir"]:false ) + ret = ""; + Storage::Umount( ret ); + } + else + ret = ""; + i = i+1; + } + } + } + if( size(ret)>0 && !Storage::Mount( ret, mp )) + ret = ""; + y2milestone( "mountVar ret:%1", ret ); + return( ret ); + } + + /** * Find and read fstab by installation. Scan existing partitions. * @parm targetMap all targets @@ -38,14 +93,15 @@ ``{ ///////////////////////////////////////////////////////////////// // foreach partition on each target - list<list> fstab = []; - list skip_fs = [ `unknown, `swap, `vfat, `ntfs ]; + list<list> fstab = []; + list skip_fs = [ `unknown, `swap, `vfat, `ntfs ]; foreach( string dev, map disk, targetMap, ``{ foreach( map part, filter( map p, disk["partitions"]:[], - ``(!contains( skip_fs, p["detected_fs"]:`unknown) )), + ``(!contains( skip_fs, + p["detected_fs"]:`unknown) )), ``{ ///////////////////////////////////////////////////// // try to mount @@ -55,10 +111,40 @@ if( mount_success && SCR::Read(.target.size, search_point+"/etc/fstab") > 0 ) { - list tmp = Storage::ReadFstab( search_point+"/etc" ); + list<map> tmp = + (list<map>)Storage::ReadFstab( search_point+"/etc" ); y2milestone( "findExistingFstab fstab %1", tmp ); if( size(tmp)>0 ) { + if( find( map p, tmp, ``(p["size_k"]:0==0 ))!=nil ) + { + string vardev = ""; + map var = find( map p, tmp, ``(p["mount"]:""=="/var")); + map root = find( map p, tmp, ``(p["mount"]:""=="/")); + y2milestone( "findExistingFstab var %1", var ); + if( var != nil ) + { + vardev = mountVar( var, root, part["device"]:"", + search_point+"/var", targetMap ); + y2milestone( "findExistingFstab vardev %1", + vardev ); + } + map dmap = Storage::BuildDiskmap( $[] ); + if( size(dmap)>0 ) + { + y2milestone( "findExistingFstab dmap %1", dmap ); + y2milestone( "findExistingFstab tmp %1", tmp ); + tmp = maplist( map p, tmp, + ``{ + if( p["size_k"]:0 == 0 ) + p["device"] = Storage::HdDiskMap( p["device"]:"", dmap ); + return( p ); + }); + y2milestone( "findExistingFstab tmp %1", tmp ); + } + if( size(vardev)>0 ) + Storage::Umount( vardev ); + } fstab = add( fstab, tmp ); } } Modified: trunk/storage/storage/src/modules/Storage.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=40987&r1=40986&r2=40987&view=diff ============================================================================== --- trunk/storage/storage/src/modules/Storage.ycp (original) +++ trunk/storage/storage/src/modules/Storage.ycp Thu Sep 20 15:52:49 2007 @@ -5243,10 +5243,12 @@ } -define map BuildDiskmap( map oldv ) +global define map BuildDiskmap( map oldv ) ``{ map d = (map)SCR::Read( .target.stat, Installation::destdir + "/var/lib/hardware" ); + if( !d["isdir"]:false ) + DiskMap = $[]; if( d["isdir"]:false && (oldv != DiskMapVersion || size(oldv)==0) ) { DiskMap = $[]; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
fehr@svn.opensuse.org