[PC-BSD Commits] r17290 - pcbsd/current/src-qt4/pc-installgui

svn at pcbsd.org svn at pcbsd.org
Fri Jun 15 08:28:54 PDT 2012


Author: kris
Date: 2012-06-15 15:28:52 +0000 (Fri, 15 Jun 2012)
New Revision: 17290

Modified:
   pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp
Log:

Fix a bug creating the pc-sysinstall config with ZFS and encryption enabled
Add some sanity checks to adding new UFS / ZFS mount-points / datasets



Modified: pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp	2012-06-15 15:03:41 UTC (rev 17289)
+++ pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp	2012-06-15 15:28:52 UTC (rev 17290)
@@ -358,7 +358,7 @@
   if ( totalSize != -1 )
   {
      // We got a valid size for this disk / slice, lets generate the layout now
-     mntsize = 2000;
+     mntsize = 2048;
 
      // This is set automatically if in basic mode
      if ( radioUFS->isChecked() ) {
@@ -414,8 +414,8 @@
 
        // If encryption is enabled, we need a ufs /boot partition
        if ( groupEncryption->isChecked() ) {
-         totalSize = totalSize - 1024;
-         fileSystem << targetDisk << targetSlice << "/boot" << "UFS" << tmp.setNum(1024) << "" << "";
+         totalSize = totalSize - 2048;
+         fileSystem << targetDisk << targetSlice << "/boot" << "UFS+SUJ" << tmp.setNum(2048) << "" << "";
          sysFinalDiskLayout << fileSystem;
          fileSystem.clear();
        }
@@ -482,12 +482,13 @@
 
   } else {
     // Show ZFS stuff
-    if ( groupEncryption->isChecked()) {
-      new QTreeWidgetItem(treeMounts, QStringList() << "0" << "/boot" << "UFSBOOT");
+
+    // If using encryption, skip the /boot UFS partition
+    if ( groupEncryption->isChecked())
       zMnts = sysFinalDiskLayout.at(1).at(2).split(",");
-    } else {
+    else
       zMnts = sysFinalDiskLayout.at(0).at(2).split(",");
-    } 
+
     // Now loop through ZFS mounts
     for (int i=0; i < zMnts.count(); ++i) {
       tmpList.clear();
@@ -628,6 +629,25 @@
   if (!ok || nMount.isEmpty())
     return;
 
+  // Sanity checks
+  ////////////////////////////////////////
+  if (nMount == "/boot" && radioZFS->isChecked() && groupEncryption->isChecked() ) {
+      QMessageBox::critical(this, tr("Invalid Mount"),
+              tr("Cannot create /boot dataset on ZFS with encryption enabled!"),
+              QMessageBox::Ok,
+              QMessageBox::Ok);
+      return;
+  }
+  if ( nMount.indexOf("/") != 0 ) {
+      QMessageBox::critical(this, tr("Invalid Mount"),
+              tr("Mount point should start with '/'"),
+              QMessageBox::Ok,
+              QMessageBox::Ok);
+      return;
+  }
+  // End sanity checks
+  ////////////////////////////////////////
+
   // Make sure this mount doesn't already exist
   QList<QTreeWidgetItem *> mItems = treeMounts->findItems("*", Qt::MatchWildcard);
   for ( int i = 0; i < mItems.size(); ++i) {
@@ -635,10 +655,6 @@
       return;
   }
 
-  // Basic sanity check, needs some improvement KPM
-  if ( nMount.indexOf("/") != 0 )
-    return;
-
   if  ( radioUFS->isChecked() ) {
     // Doing UFS mount, lets get a size from the user
     addingMount = nMount;
@@ -933,13 +949,15 @@
   } else {
     // Start building the ZFS file-systems
     QStringList zMnts;
+    QString fsType = "ZFS";
     int zpoolSize = getDiskSliceSize();
 
     // Check if we need a UFS /boot for encryption
     if ( groupEncryption->isChecked()) {
-      fileSystem << targetDisk << targetSlice << "/boot" << "UFS+SUJ" << "1028" << "" << "";
+      fileSystem << targetDisk << targetSlice << "/boot" << "UFS+SUJ" << "2048" << "" << "";
       sysFinalDiskLayout << fileSystem;
-      zpoolSize = zpoolSize - 1028;
+      zpoolSize = zpoolSize - 2048;
+      fsType="ZFS.eli";
       tmpPass=lineEncPW->text();
     }
 
@@ -966,7 +984,7 @@
 
     // Save the final disk layout
     fileSystem.clear();
-    fileSystem << targetDisk << targetSlice << zMnts.join(",") << "ZFS" << tmp.setNum(zpoolSize) << zOpts << tmpPass;
+    fileSystem << targetDisk << targetSlice << zMnts.join(",") << fsType << tmp.setNum(zpoolSize) << zOpts << tmpPass;
     sysFinalDiskLayout << fileSystem;
   }
 



More information about the Commits mailing list