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

svn at pcbsd.org svn at pcbsd.org
Fri Apr 9 09:25:27 PDT 2010


Author: kris
Date: 2010-04-09 09:25:27 -0700 (Fri, 09 Apr 2010)
New Revision: 6541

Modified:
   pcbsd/trunk/SysInstaller/backend.cpp
   pcbsd/trunk/SysInstaller/dialogFileSystem.cpp
   pcbsd/trunk/SysInstaller/dialogFileSystem.h
   pcbsd/trunk/SysInstaller/sys-diskwidget.cpp
   pcbsd/trunk/SysInstaller/sysinstaller.h
Log:

Make SysInstaller aware of geom Schemes, MBR / GPT

Allow users to delete GPT/EFI partitions, in order to re-format the disk with MBR if they
so choose.



Modified: pcbsd/trunk/SysInstaller/backend.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/backend.cpp	2010-04-09 15:45:00 UTC (rev 6540)
+++ pcbsd/trunk/SysInstaller/backend.cpp	2010-04-09 16:25:27 UTC (rev 6541)
@@ -375,6 +375,15 @@
                      
                     if (info.indexOf(slice + "-label: ") == 0) slabel = info.replace(slice + "-label: ", "");
 
+                    // Check if we've found the format flag
+                    if (info.indexOf(dev + "-format: ") == 0) {
+                      QString format = info.replace(dev + "-format: ", "");
+                      qDebug() << "Found Disk Format: " <<  dev << " - " << format;
+                      partition.clear();
+                      partition << "FORMAT" << dev << format;
+                      drives.append(partition);
+                    }
+
                     // Check if we've found the new slice
                     if (info.indexOf(slice + "-sizemb: ") == 0) {
                       ssize = info.replace(slice + "-sizemb: ", "");

Modified: pcbsd/trunk/SysInstaller/dialogFileSystem.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/dialogFileSystem.cpp	2010-04-09 15:45:00 UTC (rev 6540)
+++ pcbsd/trunk/SysInstaller/dialogFileSystem.cpp	2010-04-09 16:25:27 UTC (rev 6541)
@@ -8,6 +8,17 @@
 }
 
 
+// Returns the disks MBR/GPT format scheme if known
+QString dialogFileSystem::getDiskScheme(QString disk)
+{
+  for (int z=0; z < sysDisks.count(); ++z)
+    if ( sysDisks.at(z).at(0) == "FORMAT" \
+      && sysDisks.at(z).at(1) == disk )
+        return sysDisks.at(z).at(2);
+
+  return QString();
+}
+
 // Init our dialog with our disk / layout from the parent
 void dialogFileSystem::dialogInit(QList<QStringList> disks, QList<QStringList> disklayout)
 {
@@ -113,9 +124,6 @@
   }
 }
 
-
-
-
 // Function which checks that we don't have any partitions selected for this disk when using a partition
 bool dialogFileSystem::sliceNoExistingDiskPartition(QString Device)
 {
@@ -180,7 +188,9 @@
       desc.truncate(20);
       comboDiskSelection->addItem(sysDisks.at(i).at(1) + " - " + sysDisks.at(i).at(2) + "MB (" + availSize + " Avail) " + desc);
       comboMirrorDisk->addItem(sysDisks.at(i).at(1) + " - " + sysDisks.at(i).at(2) + "MB " + sysDisks.at(i).at(3));
-    } else if ( sysDisks.at(i).at(0) == "SLICE" && sliceNoExistingDiskPartition(sysDisks.at(i).at(2) ) ) {
+    } else if ( sysDisks.at(i).at(0) == "SLICE" \
+      && getDiskScheme(sysDisks.at(i).at(1)) == "MBR" \
+      && sliceNoExistingDiskPartition(sysDisks.at(i).at(2) ) ) {
       availSize.setNum(calculateFreeSpace(i));
       desc = sysDisks.at(i).at(4);
       if ( desc != "Unused Space") {

Modified: pcbsd/trunk/SysInstaller/dialogFileSystem.h
===================================================================
--- pcbsd/trunk/SysInstaller/dialogFileSystem.h	2010-04-09 15:45:00 UTC (rev 6540)
+++ pcbsd/trunk/SysInstaller/dialogFileSystem.h	2010-04-09 16:25:27 UTC (rev 6541)
@@ -54,6 +54,7 @@
     bool isEditing;
     int editIndex;
     int calculateFreeSpace(int diskIndex);
+    QString getDiskScheme(QString disk);
     QList<QStringList> sysDisks; // Our lists which contains disk info
     QList<QStringList> sysFinalDiskLayout; // Our lists which contains the final disk layout
     QString encPhrase;

Modified: pcbsd/trunk/SysInstaller/sys-diskwidget.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sys-diskwidget.cpp	2010-04-09 15:45:00 UTC (rev 6540)
+++ pcbsd/trunk/SysInstaller/sys-diskwidget.cpp	2010-04-09 16:25:27 UTC (rev 6541)
@@ -20,6 +20,17 @@
   treeWidgetCustomPartition->setColumnHidden(0, true);
 }
 
+// Returns the disks MBR/GPT format scheme if known
+QString SysInstaller::getDiskScheme(QString disk)
+{
+  for (int z=0; z < sysDisks.count(); ++z)
+    if ( sysDisks.at(z).at(0) == "FORMAT" \
+      && sysDisks.at(z).at(1) == disk )
+        return sysDisks.at(z).at(2);
+
+  return QString();
+}
+
 void SysInstaller::slotAddMBRPartition()
 {
   QString Output, Disk;
@@ -107,7 +118,7 @@
 {
   int minsize, mysize;
   bool ok, goodsize;
-  QString tmp;
+  QString tmp, disk;
 
   goodsize = true;
 
@@ -135,6 +146,20 @@
       // Using a specific partition, check that size
       QString slice = listDiskSlices->currentItem()->text();
       slice.truncate(slice.indexOf(":"));
+
+      // Get the Disk
+      for (int i=0; i < sysDisks.count(); ++i)
+        if ( sysDisks.at(i).at(0) == "SLICE" && slice == sysDisks.at(i).at(2))
+          disk = sysDisks.at(i).at(1);
+
+      // Make sure this isn't a GPT slice / partition
+      if ( getDiskScheme(disk) != "MBR" ) {
+        QMessageBox::critical(this, tr("PC-BSD Installer Error"),
+        tr("Can only install directly to a MBR partition!\nPlease use 'entire disk' or delete all partitions and create a new one."),
+        QMessageBox::Ok);
+        return false;
+      }
+
       for (int i=0; i < sysDisks.count(); ++i) {
         // Make sure to only add the slices to the listDiskSlices
         if ( sysDisks.at(i).at(0) == "SLICE" && slice == sysDisks.at(i).at(2)) {

Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h	2010-04-09 15:45:00 UTC (rev 6540)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h	2010-04-09 16:25:27 UTC (rev 6541)
@@ -133,6 +133,7 @@
 
     QRegExp passwordRegExp;
 
+    QString getDiskScheme(QString disk);
     void connectDiskSlots(); // Function to connect disk-related slots
     void connectUserSlots(); // Function to connect user slots
     void connectKeyboardSlots();



More information about the Commits mailing list