[PC-BSD Commits] r5167 - pcbsd/trunk/SysInstaller

svn at pcbsd.org svn at pcbsd.org
Mon Nov 30 17:57:20 PST 2009


Author: kris
Date: 2009-11-30 17:57:20 -0800 (Mon, 30 Nov 2009)
New Revision: 5167

Modified:
   pcbsd/trunk/SysInstaller/sysinstaller.cpp
   pcbsd/trunk/SysInstaller/sysinstaller.h
Log:

Started adding support for generating the pc-sysinstall cfg on the summary page



Modified: pcbsd/trunk/SysInstaller/sysinstaller.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-12-01 00:18:14 UTC (rev 5166)
+++ pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-12-01 01:57:20 UTC (rev 5167)
@@ -88,7 +88,7 @@
 {
     // load languages
     comboLanguage->clear();
-    QStringList languages = Scripts::Backend::languages();
+    languages = Scripts::Backend::languages();
     for (int i=0; i < languages.count(); ++i) {
         QString languageStr = languages.at(i);
         QString language = languageStr.split("-").at(0);
@@ -235,6 +235,10 @@
    if ( stackWidget->currentIndex() == 4 && ! checkUserAccountInfo() )
       return;
 
+   // Generate the config and display the summary on the next page
+   if ( stackWidget->currentIndex() == 6 )
+     startConfigGen();
+
    proceed(true);
 }
 
@@ -322,3 +326,61 @@
   } 
  
 }
+
+QStringList SysInstaller::getGlobalCfgSettings()
+{
+
+  QStringList tmpList;
+  tmpList << "# Auto-Generated pc-sysinstall configuration";
+  tmpList << " ";
+  tmpList << "installInteractive=no";
+ 
+  if ( radioUpgrade->isChecked() )
+    tmpList << "installMode=upgrade";
+  else
+    tmpList << "installMode=fresh";
+
+
+  if ( radioRestore->isChecked() )
+  {
+    tmpList << "installMedium=rsync";
+  } else {
+    tmpList << "installMedium=dvd";
+
+    if ( radioInstallPCBSD->isChecked() )
+      tmpList << "installType=PCBSD";
+    else
+      tmpList << "installType=FreeBSD";
+  }
+
+  if ( comboLanguage->currentIndex() != 0 ) {
+    QString lang = languages.at(comboLanguage->currentIndex());
+    tmpList << "localizeLang=" + lang;
+  }
+  
+
+  tmpList << " ";
+
+  return tmpList;
+}
+
+void SysInstaller::startConfigGen()
+{
+  QStringList cfgList;
+
+  cfgList+=getGlobalCfgSettings();
+
+  textEditSummary->clear();
+
+  // Now write out the cfgList to file
+  QFile cfgfile( "/tmp/sys-install.cfg" );
+  if ( cfgfile.open( QIODevice::WriteOnly ) ) {
+    QTextStream stream( &cfgfile );
+    for ( int i=0; i < cfgList.count(); ++i) {
+      stream <<  cfgList.at(i) << "\n";
+      textEditSummary->append(cfgList.at(i));
+    }
+    cfgfile.close();
+  }
+
+}

Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h	2009-12-01 00:18:14 UTC (rev 5166)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h	2009-12-01 01:57:20 UTC (rev 5167)
@@ -130,6 +130,12 @@
 
     void refreshComponents(); // Function which re-draws components list widgets
 
+    // Functions which return parts of the config file
+    QStringList getGlobalCfgSettings();
+    
+
+    void startConfigGen(); // Function which takes pieces of cfg, and assembles
+
     void proceed(bool);
     bool isInstalled();
     bool checkDiskRequirements();
@@ -148,6 +154,7 @@
     QList<QStringList> listUsers; // QStringList which keeps our users
     QList<QStringList> listComponents; // QStringList for our available components
     QString netURL; // Saved network URL when doing remote install
+    QStringList languages;
 
 };
 



More information about the Commits mailing list