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

svn at pcbsd.org svn at pcbsd.org
Mon Mar 25 12:19:36 PDT 2013


Author: kris
Date: 2013-03-25 19:19:36 +0000 (Mon, 25 Mar 2013)
New Revision: 21978

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

Add some disk space checks for the auto-detected partition layout. Still
need to add it to the disk wizard as well



Modified: pcbsd/current/src-qt4/pc-installgui/installer.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-installgui/installer.cpp	2013-03-25 17:11:26 UTC (rev 21977)
+++ pcbsd/current/src-qt4/pc-installgui/installer.cpp	2013-03-25 19:19:36 UTC (rev 21978)
@@ -164,14 +164,14 @@
       exit(1);
    }
 
-   //for (int i=0; i < sysDisks.count(); ++i) {
-      // Make sure to only add the drives to the comboDiskList
-   //   if ( sysDisks.at(i).at(0) == "DRIVE" )
-   //     comboDiskList->addItem(sysDisks.at(i).at(1) + " - " + sysDisks.at(i).at(2) + "MB " + sysDisks.at(i).at(3));
-   //}
-
    // For now use the first disk we find
-   autoGenPartitionLayout(sysDisks.at(0).at(1), true);
+   if ( ! autoGenPartitionLayout(sysDisks.at(0).at(1), true) )
+   {
+      QMessageBox::critical(this, tr("PC-BSD Installer"),
+        tr("Unable to suggest a partition for the detected disk."),
+        QMessageBox::Ok,
+        QMessageBox::Ok);
+   }
 
    textEditDiskSummary->clear();
    QStringList summary = getDiskSummary();
@@ -222,66 +222,81 @@
   totalSize = totalSize - 10;
 
   // We got a valid size for this disk / slice, lets generate the layout now
-  if(ok)
-  {
-     mntsize = 2000;
+  if( !ok )
+    return false;
 
-     // If less than 2GB of memory, lets go with UFS+SUJ
-     if ( systemMemory < 2028 || Arch == "i386" ) {
-       fsType="UFS+SUJ";
+  // Lets print a nice handy warning for users with possible
+  // low disk space issues
+  if ( totalSize < 48000 ) {
+  QMessageBox::warning(this, tr("PC-BSD Installer"),
+      tr("The detected disk is less than 50GB. PC-BSD recommends at least 50GB of space for a desktop and 20GB for a server."),
+      QMessageBox::Ok,
+      QMessageBox::Ok);
+  }
 
-       fileSystem << targetDisk << targetSlice << "/" << fsType << tmp.setNum(mntsize) << "" << "";
-       totalSize = totalSize - mntsize;
-       //qDebug() << "Auto-Gen FS:" <<  fileSystem;
-       sysFinalDiskLayout << fileSystem;
-       fileSystem.clear();
-      
+  // If on amd64 lets use ZFS, it rox
+  if ( Arch == "amd64" ) {
+    // Add the main zfs pool with standard partitions
+    fsType= "ZFS";
+    fileSystem << targetDisk << targetSlice << "/,/swap(volsize=2G|org.freebsd:swap=on|checksum=off),/tmp(compress=lzjb),/usr(canmount=off),/usr/home,/usr/jails,/usr/obj(compress=lzjb),/usr/pbi,/usr/ports(compress=gzip),/usr/ports/distfiles(compress=off),/usr/src(compress=gzip),/var(canmount=off),/var/audit(compress=lzjb),/var/log(compress=gzip),/var/tmp(compress=lzjb)" << fsType << tmp.setNum(totalSize) << "" << "";
+    //qDebug() << "Auto-Gen FS:" <<  fileSystem;
+    sysFinalDiskLayout << fileSystem;
+    fileSystem.clear();
+    return true;
+  }
 
-       // Figure out the swap size, try for 2xPhysMem first, fallback to 256 if not enough space
-       mntsize = systemMemory * 2;
-       if ( totalSize - mntsize < 3000 )
-          mntsize = 256;
+  // Looks like not on amd64, fallback to UFS+SUJ and print a nice 
+  // warning for the user explaining they *really* want to be on amd64
+  QMessageBox::warning(this, tr("PC-BSD Installer"),
+      tr("Detected that you are running the 32bit version. If your system is 64bit capable (most systems made after 2005), you really should be running the 64bit version"),
+      QMessageBox::Ok,
+      QMessageBox::Ok);
 
-       // Cap the swap size to 2GB
-       if ( mntsize > 2000 )
-          mntsize = 2000;
+  // Start the UFS layout now
+  mntsize = 2000;
+  fsType="UFS+SUJ";
 
-       fileSystem << targetDisk << targetSlice << "SWAP" << "SWAP" << tmp.setNum(mntsize) << "" << "";
-       totalSize = totalSize - mntsize;
-       //qDebug() << "Auto-Gen FS:" <<  fileSystem;
-       sysFinalDiskLayout << fileSystem;
-       fileSystem.clear();
+  fileSystem << targetDisk << targetSlice << "/" << fsType << tmp.setNum(mntsize) << "" << "";
+  totalSize = totalSize - mntsize;
+  //qDebug() << "Auto-Gen FS:" <<  fileSystem;
+  sysFinalDiskLayout << fileSystem;
+  fileSystem.clear();
+    
 
-       // If less than 3GB, skip /var and leave on /
-       if ( totalSize > 3000 ) {
-         // Figure out the default size for /var if we are on FreeBSD / PC-BSD
-         mntsize = 2048;
-         fileSystem << targetDisk << targetSlice << "/var" << fsType << tmp.setNum(mntsize) << "" << "";
-         totalSize = totalSize - mntsize;
-         //qDebug() << "Auto-Gen FS:" <<  fileSystem;
-         sysFinalDiskLayout << fileSystem;
-         fileSystem.clear();
-       }
+  // Figure out the swap size, try for 2xPhysMem first, fallback to 256 if not enough space
+  mntsize = systemMemory * 2;
+  if ( totalSize - mntsize < 3000 )
+     mntsize = 256;
 
-       // Now use the rest of the disk / slice for /usr
-       fileSystem << targetDisk << targetSlice << "/usr" << fsType << tmp.setNum(totalSize) << "" << "";
-       //qDebug() << "Auto-Gen FS:" <<  fileSystem;
-       sysFinalDiskLayout << fileSystem;
-       fileSystem.clear();
+  // Cap the swap size to 2GB
+  if ( mntsize > 2000 )
+     mntsize = 2000;
 
-     } else {
-       // Add the main zfs pool with standard partitions
-       fsType= "ZFS";
-       fileSystem << targetDisk << targetSlice << "/,/swap(volsize=2G|org.freebsd:swap=on|checksum=off),/tmp(compress=lzjb),/usr(canmount=off),/usr/home,/usr/jails,/usr/obj(compress=lzjb),/usr/pbi,/usr/ports(compress=gzip),/usr/ports/distfiles(compress=off),/usr/src(compress=gzip),/var(canmount=off),/var/audit(compress=lzjb),/var/log(compress=gzip),/var/tmp(compress=lzjb)" << fsType << tmp.setNum(totalSize) << "" << "";
-       //qDebug() << "Auto-Gen FS:" <<  fileSystem;
-       sysFinalDiskLayout << fileSystem;
-       fileSystem.clear();
-     }
+  fileSystem << targetDisk << targetSlice << "SWAP" << "SWAP" << tmp.setNum(mntsize) << "" << "";
+  totalSize = totalSize - mntsize;
+  //qDebug() << "Auto-Gen FS:" <<  fileSystem;
+  sysFinalDiskLayout << fileSystem;
+  fileSystem.clear();
 
-     return true; 
+  // If less than 3GB, skip /var and leave on /
+  if ( totalSize > 3000 ) {
+    // Figure out the default size for /var if we are on FreeBSD / PC-BSD
+    mntsize = 2048;
+    fileSystem << targetDisk << targetSlice << "/var" << fsType << tmp.setNum(mntsize) << "" << "";
+    totalSize = totalSize - mntsize;
+    //qDebug() << "Auto-Gen FS:" <<  fileSystem;
+    sysFinalDiskLayout << fileSystem;
+    fileSystem.clear();
   }
+
+  // Now use the rest of the disk / slice for /usr
+  fileSystem << targetDisk << targetSlice << "/usr" << fsType << tmp.setNum(totalSize) << "" << "";
+  //qDebug() << "Auto-Gen FS:" <<  fileSystem;
+  sysFinalDiskLayout << fileSystem;
+  fileSystem.clear();
+
+  return true; 
   
-  return false;
 }
 
 // Function which returns the pc-sysinstall cfg data



More information about the Commits mailing list