Author: aschnell
Date: Fri Jul 31 11:55:20 2009
New Revision: 58237
URL: http://svn.opensuse.org/viewcvs/yast?rev=58237&view=rev
Log:
- new module StorageUpdate with update related functions
Added:
trunk/storage/storage/src/modules/StorageUpdate.ycp
Modified:
trunk/storage/VERSION
trunk/storage/package/yast2-storage.changes
trunk/storage/storage/src/modules/Makefile.am
trunk/storage/storage/src/modules/Storage.ycp
trunk/storage/storage/src/storage_finish.ycp
Modified: trunk/storage/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/VERSION?rev=58237&r1=58236&r2=58237&view=diff
==============================================================================
--- trunk/storage/VERSION (original)
+++ trunk/storage/VERSION Fri Jul 31 11:55:20 2009
@@ -1 +1 @@
-2.18.17
+2.18.18
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=58237&r1=58236&r2=58237&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Fri Jul 31 11:55:20 2009
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Fri Jul 31 11:02:57 CEST 2009 - aschnell@suse.de
+
+- new module StorageUpdate with update related functions
+- 2.18.18
+
+-------------------------------------------------------------------
Mon Jul 27 17:41:31 CEST 2009 - aschnell@suse.de
- work on proposal UI for LVM encryption (fate #305633)
Modified: trunk/storage/storage/src/modules/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Makefile.am?rev=58237&r1=58236&r2=58237&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/Makefile.am (original)
+++ trunk/storage/storage/src/modules/Makefile.am Fri Jul 31 11:55:20 2009
@@ -15,9 +15,10 @@
StorageControllers.ycp \
StorageDevices.ycp \
StorageFields.ycp \
+ StorageIcons.ycp \
StorageProposal.ycp \
StorageSettings.ycp \
- StorageIcons.ycp \
+ StorageUpdate.ycp \
TreePanel.ycp \
TabPanel.ycp \
MiniWorkflow.ycp \
Modified: trunk/storage/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=58237&r1=58236&r2=58237&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/Storage.ycp (original)
+++ trunk/storage/storage/src/modules/Storage.ycp Fri Jul 31 11:55:20 2009
@@ -4411,13 +4411,12 @@
return( ret );
}
-global define string PathToDestdir( string pt )
- ``{
- if( Installation::scr_destdir != "/" )
- {
- pt = Installation::scr_destdir + pt;
- }
- return( pt );
+
+ global string PathToDestdir(string p)
+ {
+ if (Installation::scr_destdir != "/")
+ p = Installation::scr_destdir + p;
+ return p;
}
@@ -4677,68 +4676,6 @@
return( ret );
}
-global define void UpdateFstabSubfs()
- ``{
- y2milestone( "UpdateFstabSubfs removing fstab entries for cdrom and floppy" );
- string tabpath = PathToDestdir( "/etc/fstab" );
- map fstab = Partitions::GetFstab( tabpath );
- integer line = 0;
- list<integer> rem_lines = [];
- while( line<=AsciiFile::NumLines( fstab ) )
- {
- map l = AsciiFile::GetLine( fstab, line );
- if( search( l["fields",1]:"", "/media/floppy" )==0 )
- {
- rem_lines = add( rem_lines, line );
- }
- else if( search( l["fields",1]:"", "/media/cdrom" )==0 ||
- search( l["fields",1]:"", "/media/dvd" )==0 ||
- search( l["fields",1]:"", "/media/cdrecorder" )==0 ||
- search( l["fields",1]:"", "/media/dvdrecorder" )==0 ||
- search( l["fields",1]:"", "/cdrom" )==0 ||
- search( l["fields",1]:"", "/dvd" )==0 ||
- search( l["fields",1]:"", "/cdrecorder" )==0 ||
- search( l["fields",1]:"", "/dvdrecorder" )==0 )
- {
- rem_lines = add( rem_lines, line );
- }
- line = line+1;
- }
- y2milestone( "UpdateFstabSubfs %1", rem_lines );
- if( size(rem_lines)>0 )
- {
- rem_lines = sort(rem_lines);
- AsciiFile::RemoveLines( fstab, rem_lines );
- }
- AsciiFile::RewriteFile( fstab, tabpath );
- }
-
-global define void UpdateFstabSysfs()
- ``{
- y2milestone( "UpdateFstabSysfs called" );
- string tabpath = PathToDestdir( "/etc/fstab" );
- map fstab = Partitions::GetFstab( tabpath );
- integer line = 0;
- boolean have_sysfs = false;
- while( !have_sysfs && line<=AsciiFile::NumLines( fstab ) )
- {
- map l = AsciiFile::GetLine( fstab, line );
- have_sysfs = l["fields",1]:"" == "/sys";
- line = line+1;
- }
- if( !have_sysfs )
- {
- map entry = FileSystems::GetFstabDefaultMap( "sys" );
- list fstlist = [ entry["spec"]:"", entry["mount"]:"",
- entry["vfstype"]:"", entry["mntops"]:"",
- sformat("%1",entry["freq"]:0),
- sformat("%1",entry["passno"]:0) ];
- y2milestone( "UpdateFstabSysfs entry %1", entry );
- y2milestone( "UpdateFstabSysfs fstlist %1", fstlist );
- AsciiFile::AppendLine( fstab, fstlist );
- AsciiFile::RewriteFile( fstab, tabpath );
- }
- }
global string HdToIseries( string input )
``{
@@ -4817,221 +4754,6 @@
return( ret );
}
-global define void UpdateFstabIseriesVd()
- ``{
- y2milestone( "UpdateFstabIseriesVd updating hdx to iseries/vdx" );
- string tabpath = PathToDestdir( "/etc/fstab" );
- map fstab = Partitions::GetFstab( tabpath );
- integer line = 0;
- string n = "";
- while( line<=AsciiFile::NumLines( fstab ) )
- {
- map l = AsciiFile::GetLine( fstab, line );
- n = HdToIseries( l["fields",0]:"" );
- if( n != l["fields",0]:"" )
- {
- AsciiFile::ChangeLineField( fstab, line, 0, n );
- }
- line = line+1;
- }
- AsciiFile::RewriteFile( fstab, tabpath );
- tabpath = PathToDestdir( "/etc/cryptotab" );
- map crtab = Partitions::GetCrypto( tabpath );
- line = 0;
- while( line<=AsciiFile::NumLines( crtab ) )
- {
- map l = AsciiFile::GetLine( crtab, line );
- n = HdToIseries( l["fields",1]:"" );
- if( n != l["fields",1]:"" )
- {
- AsciiFile::ChangeLineField( crtab, line, 1, n );
- }
- line = line+1;
- }
- AsciiFile::RewriteFile( crtab, tabpath );
- }
-
-global define void UpdateCdromLinks( map diskmap )
- ``{
- y2milestone( "UpdateCdromLinks map %1", diskmap );
- foreach( string link, StorageDevices::TypeNames,
- ``{
- string dev = "/dev/" + link;
- string cont = (string)SCR::Read( .target.symlink, dev );
- if( cont!=nil && search( cont, "/dev/") != 0 )
- cont = "/dev/" + cont;
- y2milestone( "UpdateCdromLinks dev %1 cont %2", dev, cont );
- if( cont!=nil && haskey( diskmap, cont ) && size(diskmap[cont]:"")>0 )
- {
- y2milestone( "Change symlink %1 from %2 -> %3", dev, cont,
- diskmap[cont]:"" );
- SCR::Execute( .target.remove, dev );
- SCR::Execute( .target.symlink, substring(diskmap[cont]:"",5), dev );
- }
- });
- }
-
-global define void UpdateFstabPersistentNames()
- ``{
- y2milestone( "UpdateFstabPersistentDevNames updating to SLES10 names" );
- string tabpath = PathToDestdir( "/etc/fstab" );
- map fstab = Partitions::GetFstab( tabpath );
- integer line = 0;
- string n = "";
- while( line<=AsciiFile::NumLines( fstab ) )
- {
- map l = AsciiFile::GetLine( fstab, line );
- n = SLES9PersistentDevNames( l["fields",0]:"" );
- if( n != l["fields",0]:"" )
- {
- AsciiFile::ChangeLineField( fstab, line, 0, n );
- }
- line = line+1;
- }
- AsciiFile::RewriteFile( fstab, tabpath );
- }
-
-global void UpdateFstabEvms2Lvm() {
- y2milestone( "UpdateFstabEvms2Lvm migrating EVMS to LVM" );
- string tabpath = PathToDestdir( "/etc/fstab" );
- map fstab = Partitions::GetFstab( tabpath );
- integer line = 0;
- string n = "";
- while( line<=AsciiFile::NumLines( fstab ) ) {
- map l = AsciiFile::GetLine( fstab, line );
- n = l["fields",0]:"";
- if (substring (n, 0, 15) == "/dev/evms/lvm2/")
- {
- n = "/dev/" + substring (n, 15);
- AsciiFile::ChangeLineField( fstab, line, 0, n );
- }
- line = line+1;
- }
- AsciiFile::RewriteFile( fstab, tabpath );
-}
-
-global define void UpdateFstabDiskmap( map diskmap )
- ``{
- y2milestone( "UpdateFstabDiskmap map %1", diskmap );
- string tabpath = PathToDestdir( "/etc/fstab" );
- map fstab = Partitions::GetFstab( tabpath );
- integer line = 0;
- string n = "";
- while( line<=AsciiFile::NumLines( fstab ) )
- {
- map l = AsciiFile::GetLine( fstab, line );
- n = HdDiskMap( l["fields",0]:"", diskmap );
- if( n != l["fields",0]:"" )
- {
- AsciiFile::ChangeLineField( fstab, line, 0, n );
- }
- line = line+1;
- }
- AsciiFile::RewriteFile( fstab, tabpath );
- tabpath = PathToDestdir( "/etc/cryptotab" );
- map crtab = Partitions::GetCrypto( tabpath );
- line = 0;
- while( line<=AsciiFile::NumLines( crtab ) )
- {
- map l = AsciiFile::GetLine( crtab, line );
- n = HdDiskMap( l["fields",1]:"", diskmap );
- if( n != l["fields",1]:"" )
- {
- AsciiFile::ChangeLineField( crtab, line, 1, n );
- }
- line = line+1;
- }
- AsciiFile::RewriteFile( crtab, tabpath );
- }
-
-global define void UpdateMdadm()
- ``{
- y2milestone( "UpdateMdadm" );
- string cpath = PathToDestdir( "/etc/mdadm.conf" );
- map file = $[];
- AsciiFile::SetComment( file, "^[ \t]*#" );
- AsciiFile::ReadFile( file, cpath );
- integer line = 0;
- boolean changed = false;
- while( line<=AsciiFile::NumLines( file ) )
- {
- if( search( file["l",line,"line"]:"", "DEVICE" )!=nil &&
- search( file["l",line,"line"]:"", "/dev/" )!=nil )
- {
- changed = true;
- file["l",line,"line"] = "DEVICE partitions";
- y2milestone( "UpdateMdadm %1", file["l",line]:$[] );
- }
- line = line+1;
- }
- if( changed )
- AsciiFile::RewriteFile( file, cpath );
- }
-
-global define void UpdateCryptoType()
- ``{
- y2milestone( "UpdateCryptoType" );
- string tabpath = PathToDestdir( "/etc/fstab" );
- map fstab = Partitions::GetFstab( tabpath );
- integer line = 0;
- integer pos = 0;
- string searchstr = "encryption=twofish256";
- while( line<=AsciiFile::NumLines( fstab ) )
- {
- map l = AsciiFile::GetLine( fstab, line );
- pos = search( l["fields",3]:"", searchstr );
- if( pos != nil )
- {
- string new = substring( l["fields",3]:"", 0, pos );
- new = new + "encryption=twofishSL92";
- new = new + substring( l["fields",3]:"", pos+size(searchstr) );
- y2milestone( "new options line in %1 is %2", l, new );
- AsciiFile::ChangeLineField( fstab, line, 3, new );
- }
- line = line+1;
- }
- AsciiFile::RewriteFile( fstab, tabpath );
- tabpath = PathToDestdir( "/etc/cryptotab" );
- map crtab = Partitions::GetCrypto( tabpath );
- line = 0;
- while( line<=AsciiFile::NumLines( crtab ) )
- {
- map l = AsciiFile::GetLine( crtab, line );
- if( l["fields",4]:"" == "twofish256" )
- {
- y2milestone( "set twofishSL92 in line %1", l );
- AsciiFile::ChangeLineField( crtab, line, 4, "twofishSL92" );
- }
- line = line+1;
- }
- AsciiFile::RewriteFile( crtab, tabpath );
- }
-
-global define void UpdateFstabUsbdevfs()
- ``{
- y2milestone( "UpdateFstabUsbdevfs updating usbdevfs to usbfs" );
- boolean changed = false;
- string tabpath = PathToDestdir( "/etc/fstab" );
- map fstab = Partitions::GetFstab( tabpath );
- integer line = 0;
- while( line<=AsciiFile::NumLines( fstab ) )
- {
- map l = AsciiFile::GetLine( fstab, line );
- if( l["fields",2]:"" == "usbdevfs" )
- {
- AsciiFile::ChangeLineField( fstab, line, 2, "usbfs" );
- AsciiFile::ChangeLineField( fstab, line, 0, "usbfs" );
- changed = true;
- }
- line = line+1;
- }
- if( changed )
- {
- y2milestone( "UpdateFstabUsbdevfs changed" );
- AsciiFile::RewriteFile( fstab, tabpath );
- }
- }
-
global define map BuildDiskmap( map oldv )
``{
@@ -5077,113 +4799,6 @@
return( DiskMap );
}
-// flag indicates calling Storage::Update()
-global boolean called_update = false;
-
-
-/**
- * Updates fstab on disk
- *
- * @param map old version
- * @param map new version
- *
- * @struct version $[
- * // This means version 9.1
- * "major" : 9,
- * "minor" : 1,
- * ]
- */
-global define void Update( map oldv, map newv )
- {
- if (!called_update)
- {
- y2milestone( "Update old:%1 new:%2", oldv, newv );
-
- // Enterprise products do not have minor release number
- // map enterprise releases to corresponding code bases of SL
- map sles_major_to_minor = $[ 8 : 2, 9 : 1, 10 : 1 ];
- if( haskey( oldv, "major" ) && !haskey( oldv, "minor" ) )
- {
- oldv["minor"] = sles_major_to_minor[oldv["major"]:0]:0;
- y2milestone( "Update old:%1", oldv );
- }
- if( haskey( newv, "major" ) && !haskey( newv, "minor" ) )
- {
- newv["minor"] = sles_major_to_minor[newv["major"]:0]:0;
- y2milestone( "Update new:%1", newv );
- }
- if( !haskey( oldv, "major" ) || !haskey( newv, "major" ) )
- y2error( "Missing key major or minor" );
-
- if( oldv["major"]:0<=9 )
- {
- UpdateFstabSysfs();
- }
- if( oldv["major"]:0<9 )
- {
- UpdateFstabUsbdevfs();
- }
- if( oldv["major"]:0==9 )
- {
- UpdateFstabPersistentNames();
- }
-
- // remove EVMS
- // FIXME add appropriate condition if needed (does not seem so)
- UpdateFstabEvms2Lvm();
-
- map dm = BuildDiskmap( oldv );
- if( size(dm)>0 )
- {
- UpdateFstabDiskmap( dm );
- UpdateMdadm();
- }
- if( oldv["major"]:0<9 || (oldv["major"]:0==9 && oldv["minor"]:0<=2))
- {
- Storage::UpdateCryptoType();
- }
- if( oldv["major"]:0<10 || (oldv["major"]:0==10 && oldv["minor"]:0==0) )
- {
- string of = "/etc/udev/rules.d/20-cdrom.rules";
- y2milestone( "removing obsolete %1", of );
- SCR::Execute( .target.remove, of );
- of = "/etc/udev/rules.d/55-cdrom.rules";
- y2milestone( "removing obsolete %1", of );
- SCR::Execute( .target.remove, of );
- }
- if( oldv["major"]:0<10 || (oldv["major"]:0==10 && oldv["minor"]:0<=2) )
- {
- string of = "/etc/udev/rules.d/65-cdrom.rules";
- y2milestone( "removing obsolete %1", of );
- SCR::Execute( .target.remove, of );
- }
- if( oldv["major"]:0<10 || (oldv["major"]:0==10 && oldv["minor"]:0==0))
- UpdateFstabSubfs();
- if( oldv["major"]:0<9 || (oldv["major"]:0==9 && oldv["minor"]:0==0))
- {
- if( Arch::board_iseries () )
- {
- UpdateFstabIseriesVd();
- }
- string cmd = "cd / && /sbin/insserv -r /etc/init.d/boot.evms";
- y2milestone( "Update cmd %1", cmd );
- map bo = (map)SCR::Execute (.target.bash_output, cmd );
- y2milestone( "Update bo %1", bo );
- }
- if( oldv["major"]:0<10 || (oldv["major"]:0==10 && oldv["minor"]:0<=2))
- {
- string cmd = "cd / && /sbin/insserv /etc/init.d/boot.crypto";
- map bo = (map)SCR::Execute (.target.bash_output, cmd );
- y2milestone( "Update bo %1", bo );
- }
- // set flag -> it indicates that Update was already called
- called_update = true;
- }
- else
- {
- y2milestone("Skip calling Update() -> It was already called");
- }
- }
global define list<string> GetTranslatedDevices( map oldv, map newv,
list<string> names )
@@ -5629,10 +5244,7 @@
string lower_point = tolower( mount_point );
if( lower_point != "" && mount_point != lower_point)
{
- if( Installation::scr_destdir != "/" )
- {
- lower_point = Installation::scr_destdir + lower_point;
- }
+ lower_point = PathToDestdir(lower_point);
y2milestone( "symlink %1 -> %2",
substring(mount_point,(findlastof(mount_point,"/")+1)),
lower_point );
Added: trunk/storage/storage/src/modules/StorageUpdate.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/StorageUpdate.ycp?rev=58237&view=auto
==============================================================================
--- trunk/storage/storage/src/modules/StorageUpdate.ycp (added)
+++ trunk/storage/storage/src/modules/StorageUpdate.ycp Fri Jul 31 11:55:20 2009
@@ -0,0 +1,395 @@
+/**
+ * Module: StorageUpdate.ycp
+ *
+ * Authors: Thomas Fehr