[PC-BSD Commits] r5173 - pcbsd/trunk/SysInstaller
svn at pcbsd.org
svn at pcbsd.org
Tue Dec 1 09:06:30 PST 2009
Author: kris
Date: 2009-12-01 09:06:30 -0800 (Tue, 01 Dec 2009)
New Revision: 5173
Modified:
pcbsd/trunk/SysInstaller/dialogFileSystem.cpp
pcbsd/trunk/SysInstaller/dialogFileSystem.ui
pcbsd/trunk/SysInstaller/sys-diskwidget.cpp
pcbsd/trunk/SysInstaller/sysinstaller.cpp
pcbsd/trunk/SysInstaller/sysinstaller.h
pcbsd/trunk/SysInstaller/sysinstaller.ui
Log:
Updated SysInstall,
* Added support for generating the cfg file disk data
* Added many new checks for sanity when adding disk partitions
Modified: pcbsd/trunk/SysInstaller/dialogFileSystem.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/dialogFileSystem.cpp 2009-12-01 14:56:02 UTC (rev 5172)
+++ pcbsd/trunk/SysInstaller/dialogFileSystem.cpp 2009-12-01 17:06:30 UTC (rev 5173)
@@ -81,7 +81,8 @@
// Loop through the disk layouts, and check if we have any partitions on this device
for (int i=0; i < sysFinalDiskLayout.count(); ++i) {
// Check if this drive already has some partitions created for it
- if ( sysFinalDiskLayout.at(i).at(0) == Device && sysFinalDiskLayout.at(i).at(1) != "ALL" )
+ if ( ( sysFinalDiskLayout.at(i).at(0) == Device && sysFinalDiskLayout.at(i).at(1) != "ALL") \
+ || (sysFinalDiskLayout.at(i).at(0) == Device && sysFinalDiskLayout.at(i).at(2).indexOf("MIRROR") != -1 ) )
return false;
}
return true;
@@ -372,31 +373,88 @@
{
bool ready;
ready = true;
+ labelStatus->setText("");
+ QString Disk, Slice;
+
+ // Get the index
+ int sysIndex = getSysIndexFromCombo(comboDiskSelection->currentIndex());
+
+ if ( sysIndex == -1 )
+ return;
+ // Set our vars with Disk / Slice info, size, etc
+ if ( sysDisks.at(sysIndex).at(0) == "DRIVE") {
+ Disk = sysDisks.at(sysIndex).at(1);
+ Slice = "ALL";
+ } else {
+ Disk = sysDisks.at(sysIndex).at(1);
+ Slice = sysDisks.at(sysIndex).at(2);
+ Slice = Slice.remove(0, Slice.size() -2);
+ }
+
// If we are on a non-mirror type
if ( comboDiskType->currentText() != "MIRROR" ) {
+
if ( spinSize->value() <= 0)
ready = false;
- if ( (lineEditMount->text().isEmpty() || lineEditMount->text().indexOf("/") != 0) \
- && comboDiskType->currentText() != "SWAP" )
+
+ if ( lineEditMount->text().isEmpty() )
ready = false;
- // Make sure we don't have a duplicate mount point and not editing
+ if ( ! lineEditMount->text().isEmpty() \
+ && lineEditMount->text().indexOf("/") != 0 \
+ && comboDiskType->currentText() != "SWAP" ) {
+ labelStatus->setText(tr("Error: Invalid Mount Point."));
+ ready = false;
+ }
+
+ int totalPart = 0;
for (int i=0; i < sysFinalDiskLayout.count(); ++i) {
- // Check if this mount is on the target partition / drive
- if ( sysFinalDiskLayout.at(i).at(2) == lineEditMount->text() && ! isEditing )
+
+ // Make sure we don't have a duplicate mount point and not editing
+ if ( sysFinalDiskLayout.at(i).at(2) == lineEditMount->text() && ! isEditing ) {
ready = false;
+ labelStatus->setText(tr("Error: A partition with this mount-point already exists."));
+ }
+
+ // Check if we already have a swap for this partition
+ if ( sysFinalDiskLayout.at(i).at(0) == Disk \
+ && sysFinalDiskLayout.at(i).at(1) == Slice \
+ && sysFinalDiskLayout.at(i).at(2) == "SWAP" \
+ && comboDiskType->currentText() == "SWAP" \
+ && ! isEditing ) {
+ ready = false;
+ labelStatus->setText(tr("Error: This partition already has a valid swap."));
+ }
+
+ // Check the number of partitions for this disk already
+ if ( ( sysFinalDiskLayout.at(i).at(0) == Disk \
+ && sysFinalDiskLayout.at(i).at(1) == Slice ) \
+ && ( sysFinalDiskLayout.at(i).at(2) != "SWAP" \
+ && sysFinalDiskLayout.at(i).at(2) != "/" ) \
+ && ! isEditing ) {
+ totalPart++;
+ }
}
+ // Check if we ended up with more partitions than we can support
+ if ( totalPart > 4 )
+ {
+ ready = false;
+ labelStatus->setText(tr("Error: No more available partitions for this disk/slice."));
+ }
+
} else {
QString selDev = comboDiskSelection->currentText();
QString mirrorDev = comboMirrorDisk->currentText();
selDev.truncate(selDev.indexOf(" -") );
mirrorDev.truncate(mirrorDev.indexOf(" -") );
// Using a mirror, make sure we don't have the same disk selected as target as source
- if ( selDev == mirrorDev )
+ if ( selDev == mirrorDev ) {
+ labelStatus->setText(tr("Error: Drive cannot mirror itself."));
ready = false;
+ }
}
pushSave->setEnabled(ready);
Modified: pcbsd/trunk/SysInstaller/dialogFileSystem.ui
===================================================================
--- pcbsd/trunk/SysInstaller/dialogFileSystem.ui 2009-12-01 14:56:02 UTC (rev 5172)
+++ pcbsd/trunk/SysInstaller/dialogFileSystem.ui 2009-12-01 17:06:30 UTC (rev 5173)
@@ -128,6 +128,13 @@
</property>
</spacer>
</item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="labelStatus">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
Modified: pcbsd/trunk/SysInstaller/sys-diskwidget.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sys-diskwidget.cpp 2009-12-01 14:56:02 UTC (rev 5172)
+++ pcbsd/trunk/SysInstaller/sys-diskwidget.cpp 2009-12-01 17:06:30 UTC (rev 5173)
@@ -384,3 +384,107 @@
}
}
+
+// Function which returns the pc-sysinstall cfg data
+QStringList SysInstaller::getDiskCfgSettings()
+{
+ QStringList tmpList;
+ QList<QStringList> copyList;
+ QString tmp, workingDisk, workingSlice;
+ int disk = 0;
+
+ // Copy over the list to a new variable we can mangle without modifying the original
+ copyList = sysFinalDiskLayout;
+
+ while ( ! copyList.empty() )
+ {
+ workingDisk = copyList.at(0).at(0);
+ workingSlice = copyList.at(0).at(1);
+ tmpList << "# Disk Setup for " + workingDisk ;
+
+ tmpList << "disk" + tmp.setNum(disk) + "=" + workingDisk;
+ tmpList << "partition=" + workingSlice;
+ if ( checkBootLoader->isChecked() )
+ tmpList << "bootManager=bsd";
+ else
+ tmpList << "bootManager=none";
+
+
+ // Check for any mirror for this device
+ for (int i=0; i < copyList.count(); ++i) {
+ if ( copyList.at(i).at(2).indexOf("MIRROR(" + workingDisk + ")") != -1 )
+ {
+ tmpList << "mirror=" + copyList.at(i).at(0);
+ tmpList << "mirrorbal=" + copyList.at(i).at(3);
+ copyList.removeAt(i);
+ break;
+ }
+ }
+ tmpList << "commitDiskPart";
+ tmpList << "";
+
+ // If after doing the mirror, our list is empty, break out
+ if ( copyList.empty() )
+ break;
+
+ // Now print the partition section for this slice
+ tmpList << "# Partition Setup for " + workingDisk + "(" + workingSlice + ")";
+ tmpList << "# All sizes are expressed in MB";
+ tmpList << "# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP";
+ tmpList << "# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli";
+
+ // Start by looking for the root partition
+ for (int i=0; i < copyList.count(); ++i) {
+ if ( copyList.at(i).at(0) == workingDisk \
+ && copyList.at(i).at(1) == workingSlice \
+ && copyList.at(i).at(2) == "/" ) {
+ tmpList << "disk" + tmp.setNum(disk) + "-part=" \
+ + copyList.at(i).at(3) + " " + copyList.at(i).at(4) \
+ + " " + copyList.at(i).at(2);
+ // Done with this item, remove it now
+ copyList.removeAt(i);
+ break;
+ }
+ }
+
+
+ // Now look for SWAP
+ for (int i=0; i < copyList.count(); ++i) {
+ if ( copyList.at(i).at(0) == workingDisk \
+ && copyList.at(i).at(1) == workingSlice \
+ && copyList.at(i).at(2) == "SWAP" ) {
+ tmpList << "disk" + tmp.setNum(disk) + "-part=" \
+ + copyList.at(i).at(3) + " " + copyList.at(i).at(4) \
+ + " none";
+ // Done with this item, remove it now
+ copyList.removeAt(i);
+ break;
+ }
+ }
+
+
+ // Now look for any other partitions
+ int count = copyList.count();
+ for (int i=0; i < count; ++i) {
+ if ( copyList.at(i).at(0) == workingDisk \
+ && copyList.at(i).at(1) == workingSlice ) {
+ tmpList << "disk" + tmp.setNum(disk) + "-part=" \
+ + copyList.at(i).at(3) + " " + copyList.at(i).at(4) \
+ + " " + copyList.at(i).at(2);
+ // Done with this item, remove it now
+ copyList.removeAt(i);
+ i--;
+ count--;
+ }
+ }
+
+
+ // Close out this partition section
+ tmpList << "commitDiskLabel";
+
+ // Increment our disk counter
+ disk++;
+ }
+
+ return tmpList;
+}
Modified: pcbsd/trunk/SysInstaller/sysinstaller.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.cpp 2009-12-01 14:56:02 UTC (rev 5172)
+++ pcbsd/trunk/SysInstaller/sysinstaller.cpp 2009-12-01 17:06:30 UTC (rev 5173)
@@ -396,6 +396,7 @@
QStringList cfgList;
cfgList+=getGlobalCfgSettings();
+ cfgList+=getDiskCfgSettings();
textEditSummary->clear();
Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h 2009-12-01 14:56:02 UTC (rev 5172)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h 2009-12-01 17:06:30 UTC (rev 5173)
@@ -132,6 +132,7 @@
// Functions which return parts of the config file
QStringList getGlobalCfgSettings();
+ QStringList getDiskCfgSettings();
void startConfigGen(); // Function which takes pieces of cfg, and assembles
Modified: pcbsd/trunk/SysInstaller/sysinstaller.ui
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.ui 2009-12-01 14:56:02 UTC (rev 5172)
+++ pcbsd/trunk/SysInstaller/sysinstaller.ui 2009-12-01 17:06:30 UTC (rev 5173)
@@ -300,7 +300,7 @@
<item>
<widget class="QStackedWidget" name="anteInstallStack">
<property name="currentIndex">
- <number>2</number>
+ <number>3</number>
</property>
<widget class="QWidget" name="aiStep0">
<layout class="QGridLayout" name="gridLayout_10">
@@ -1726,7 +1726,7 @@
</spacer>
</item>
<item>
- <widget class="QCheckBox" name="checkBox_2">
+ <widget class="QCheckBox" name="checkBootLoader">
<property name="styleSheet">
<string>color: rgb(190, 0, 0);</string>
</property>
More information about the Commits
mailing list