Mailinglist Archive: yast-commit (553 mails)

< Previous Next >
[yast-commit] r60032 - in /trunk/storage: package/yast2-storage.changes storage/src/modules/Storage.ycp
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Wed, 09 Dec 2009 16:47:16 -0000
  • Message-id: <E1NIPh6-0000V4-6o@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Wed Dec 9 17:47:15 2009
New Revision: 60032

URL: http://svn.opensuse.org/viewcvs/yast?rev=60032&view=rev
Log:
- use getFreeInfo from libstorage to detect home partitions

Modified:
trunk/storage/package/yast2-storage.changes
trunk/storage/storage/src/modules/Storage.ycp

Modified: trunk/storage/package/yast2-storage.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=60032&r1=60031&r2=60032&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Wed Dec 9 17:47:15 2009
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Wed Dec 09 17:44:27 CET 2009 - aschnell@xxxxxxx
+
+- use getFreeInfo from libstorage to detect home partitions
+
+-------------------------------------------------------------------
Thu Dec 03 15:45:27 CET 2009 - aschnell@xxxxxxx

- log untranslated messages (requires libstorage 2.19.2)

Modified: trunk/storage/storage/src/modules/Storage.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=60032&r1=60031&r2=60032&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/Storage.ycp (original)
+++ trunk/storage/storage/src/modules/Storage.ycp Wed Dec 9 17:47:15 2009
@@ -3463,57 +3463,33 @@
return( MountOpt( dev, mp, "" ) );
}

-global define map DetectHomeFs( map p )
+
+boolean DetectHomeFs( map p )
{
y2milestone( "DetectHomeFs p:%1", p );
- map ret = $[];
- boolean home = false;
- list poss_fs = [ `ext2, `ext3, `ext4, `btrfs, `reiser, `xfs, `jfs ];
+ boolean ret = false;
+ list<symbol> poss_fs = [ `ext2, `ext3, `ext4, `btrfs, `reiser, `xfs, `jfs
];
+ string device = p["device"]:"";
if( !p["created"]:false && contains( poss_fs, p["detected_fs"]:`unknown )
&&
- size(p["device"]:"")>0 )
- {
- boolean mount_ok = false;
- string tmpdir = (string) SCR::Read(.target.tmpdir) + "/tmp-home-mp";
- SCR::Execute(.target.mkdir, tmpdir );
- string fsto = FileSystems::DefaultFstabOptions( p );
- mount_ok = Storage::MountOpt( p["device"]:"", tmpdir, fsto );
- if( !mount_ok )
- mount_ok = Storage::Mount( p["device"]:"", tmpdir );
- else
- ret["fstopt"] = fsto;
- if( mount_ok )
- {
- list skip = [ ".", "..", "root" ];
- list tfile = [ ".profile", ".ssh", ".bashrc", ".kde2", ".gnome2",
".kde", ".gnome" ];
- list<string> files = (list<string>)SCR::Read (.target.dir, tmpdir);
- y2milestone( "DetectHomeFs files:%1", files );
- integer count=0;
-
- while( !home && count<size(files) )
- {
- string td = tmpdir + "/" + files[count]:"";
- if( !contains( skip, files[count]:"" ) &&
- FileUtils::IsDirectory( td ) )
- {
- integer i=0;
- while( !home && i<size(tfile) )
- {
- string tname = td + "/" + tfile[i]:"";
- home = FileUtils::GetSize( tname )>0;
- i = i+1;
- }
- }
- count = count+1;
- }
- Storage::Umount( p["device"]:"" );
- }
- SCR::Execute( .target.bash, "rmdir " + tmpdir );
- }
- ret["ishome"] = home;
- y2milestone( "DetectHomeFs ret:%1", ret );
- return( ret );
+ !isempty(device) )
+ {
+ integer used = 0;
+ integer resize_free = 0;
+ integer df_free = 0;
+ boolean win_disk = false;
+ boolean efi = false;
+ boolean home = false;
+
+ if (LibStorage::StorageInterface::getFreeInfo(sint, device, resize_free,
+ df_free, used, win_disk,
+ efi, home, true))
+ ret = home;
+ }
+ y2milestone("DetectHomeFs device:%1 ret:%2", device, ret);
+ return ret;
}

+
global define map SetVolOptions( map p, string mnt, symbol fs, string fs_opts,
string fstab_opts, string label )
{
@@ -3543,14 +3519,13 @@
ret["detected_fs"]:`unknown != `unknown && mnt=="/home" )
{
boolean lvm = p["type"]:`primary == `lvm;
- map h = DetectHomeFs( ret );
if( ( lvm && ret["name"]:""=="home") ||
- (!lvm && h["ishome"]:false ) )
+ (!lvm && DetectHomeFs(ret)))
{
ret["format"] = false;
ret["used_fs"] = ret["detected_fs"]:`unknown;
- if( size(fstab_opts)==0 )
- fstab_opts = h["fstopt"]:"";
+ if (isempty(fstab_opts))
+ fstab_opts = FileSystems::DefaultFstabOptions(ret);
}
}
if( ret["format"]:false && !ret["create"]:false &&

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages