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

svn at pcbsd.org svn at pcbsd.org
Tue Nov 24 11:08:21 PST 2009


Author: kris
Date: 2009-11-24 11:08:21 -0800 (Tue, 24 Nov 2009)
New Revision: 5134

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

Updated SysInstaller, now added disk requirement checking when using custom partitioning, to
ensure the user makes valid partitions with enough disk space to extract the image



Modified: pcbsd/trunk/SysInstaller/backend.h
===================================================================
--- pcbsd/trunk/SysInstaller/backend.h	2009-11-24 17:59:14 UTC (rev 5133)
+++ pcbsd/trunk/SysInstaller/backend.h	2009-11-24 19:08:21 UTC (rev 5134)
@@ -11,8 +11,18 @@
 
 #define PCSYSINSTALL    QString("/pc-sysinstall/pc-sysinstall")
 #define PCSYSINSTALLDIR QString("/pc-sysinstall")
+
+// Set the minimum sizes for FBSD
 #define FBSD_MINSIZE 4000
+#define FBSD_MINROOT 512
+#define FBSD_MINVAR 1000
+#define FBSD_MINUSR 2000
+
+// Set the minimum sizes for PCBSD
 #define PCBSD_MINSIZE 10000
+#define PCBSD_MINROOT 1000
+#define PCBSD_MINVAR 1000
+#define PCBSD_MINUSR 8000
 
 
 namespace Scripts {

Modified: pcbsd/trunk/SysInstaller/sys-diskwidget.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sys-diskwidget.cpp	2009-11-24 17:59:14 UTC (rev 5133)
+++ pcbsd/trunk/SysInstaller/sys-diskwidget.cpp	2009-11-24 19:08:21 UTC (rev 5134)
@@ -54,9 +54,95 @@
     } else {
       goodsize = false;
     }
-    
-  } // End of auto-partition checks
 
+    if (!goodsize)
+    {
+       QMessageBox::critical(this, tr("PC-BSD Installer Error"),
+           tr("This install requires a disk/slice with at least") \
+           + " " + tmp.setNum(minsize) + "MB " + tr("of disk space."),
+           QMessageBox::Ok);
+       return goodsize;
+    }
+
+  // End of auto-partition checks
+  }  else {
+  // Check if if the disk layout is good when using custom partitioning
+    bool haveRoot, haveUsr, haveVar, haveSwap;
+    int minRoot, minUsr, minVar;
+    haveRoot = false;
+    haveUsr = false;
+    haveVar = false;
+    haveSwap = false;
+
+    if ( radioInstallPCBSD->isChecked() ) {
+      minRoot = PCBSD_MINROOT;
+      minUsr = PCBSD_MINUSR;
+      minVar = PCBSD_MINVAR;
+    } else {
+      minRoot = FBSD_MINROOT;
+      minUsr = FBSD_MINUSR;
+      minVar = FBSD_MINVAR;
+    }
+
+    // Start by checking for some important mounts
+    for (int i=0; i < sysFinalDiskLayout.count(); ++i) {
+       if ( sysFinalDiskLayout.at(i).at(2) == "/" )
+         haveRoot = true;
+       if ( sysFinalDiskLayout.at(i).at(2) == "/usr" )
+         haveUsr = true;
+       if ( sysFinalDiskLayout.at(i).at(2) == "/var" )
+         haveVar = true;
+       if ( sysFinalDiskLayout.at(i).at(3) == "SWAP" \
+            || sysFinalDiskLayout.at(i).at(3) == "SWAP.eli" )
+         haveSwap = true;
+    }
+
+    if (!haveRoot) {
+      QMessageBox::critical(this, tr("PC-BSD Installer Error"),
+         tr("Missing '/' file-system, please add a file-system for mount-point '/' to continue."),
+         QMessageBox::Ok);
+      return false;
+    }
+    if (!haveSwap) {
+      QMessageBox::critical(this, tr("PC-BSD Installer Error"),
+         tr("Missing SWAP file-system, please add a SWAP file-system to continue."),
+         QMessageBox::Ok);
+      return false;
+    }
+
+    // Check if we have mounts for usr / var, and if not, add their requirements to /
+    if (!haveVar)
+      minRoot = minRoot + minVar;
+    if (!haveUsr)
+      minRoot = minRoot + minUsr;
+
+    // If we get this far, now check if we have any file-systems that are below the minimum size
+    for (int i=0; i < sysFinalDiskLayout.count(); ++i) {
+       mysize = sysFinalDiskLayout.at(i).at(4).toInt(&ok);
+       if(ok) {
+         if ( sysFinalDiskLayout.at(i).at(2) == "/" && mysize < minRoot ) {
+           QMessageBox::critical(this, tr("PC-BSD Installer Error"),
+             "'/' " + tr("file-system is below the required minimum:") + " " + tmp.setNum(minRoot),
+             QMessageBox::Ok);
+           return false;
+         }
+         if ( sysFinalDiskLayout.at(i).at(2) == "/usr" && mysize < minUsr ) {
+           QMessageBox::critical(this, tr("PC-BSD Installer Error"),
+             "'/var' " + tr("file-system is below the required minimum:") + " " + tmp.setNum(minUsr),
+             QMessageBox::Ok);
+           return false;
+         }
+         if ( sysFinalDiskLayout.at(i).at(2) == "/var" && mysize < minVar ) {
+           QMessageBox::critical(this, tr("PC-BSD Installer Error"),
+             "'/var' " + tr("file-system is below the required minimum:") + " " + tmp.setNum(minVar),
+             QMessageBox::Ok);
+           return false;
+         }
+       }
+    }
+
+  } // End of check for custom file-system validity
+
   return goodsize;
 }
 

Modified: pcbsd/trunk/SysInstaller/sysinstaller.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-11-24 17:59:14 UTC (rev 5133)
+++ pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-11-24 19:08:21 UTC (rev 5134)
@@ -187,20 +187,9 @@
 
 void SysInstaller::slotNext()
 {
-   if ( stackWidget->currentIndex() == 3 && ! checkDiskRequirements()) {
-     int minsize;
-     QString tmp;
-     if ( radioInstallPCBSD->isChecked() )
-       minsize = PCBSD_MINSIZE;
-     else
-       minsize = FBSD_MINSIZE;
-
-      QMessageBox::critical(this, tr("PC-BSD Installer Error"),
-           tr("This install requires a disk/slice with at least") \
-           + " " + tmp.setNum(minsize) + "MB " + tr("of disk space."),
-           QMessageBox::Ok);
+   // If the chosen disk is too small or partition is invalid, don't continue
+   if ( stackWidget->currentIndex() == 3 && ! checkDiskRequirements())
       return;
-   }
 
    // Check if we are on the disk page, and using auto-partitioning, and set it up if so
    if ( stackWidget->currentIndex() == 3 && radioAutoPartition->isChecked() )
@@ -234,6 +223,7 @@
     switch (ret) {
     case QMessageBox::Yes:
         //exit the installer :(
+        close();
         break;
     case QMessageBox::No: // :)
         break;



More information about the Commits mailing list