[PC-BSD Commits] r5090 - pcbsd/trunk/SysInstaller
svn at pcbsd.org
svn at pcbsd.org
Thu Nov 19 10:38:03 PST 2009
Author: kris
Date: 2009-11-19 10:38:03 -0800 (Thu, 19 Nov 2009)
New Revision: 5090
Modified:
pcbsd/trunk/SysInstaller/backend.cpp
pcbsd/trunk/SysInstaller/sysinstaller.cpp
pcbsd/trunk/SysInstaller/sysinstaller.h
Log:
Updated SysInstaller, added support for quering disk partitions now, and displaying them on the GUI
Modified: pcbsd/trunk/SysInstaller/backend.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/backend.cpp 2009-11-19 17:05:20 UTC (rev 5089)
+++ pcbsd/trunk/SysInstaller/backend.cpp 2009-11-19 18:38:03 UTC (rev 5090)
@@ -97,11 +97,12 @@
QList<QStringList> Backend::hardDrives()
{
QList<QStringList> drives;
- QStringList drive; //its a "list" so as to also append partions/slices
+ QStringList drive; //its a "list" so as to also append drive information
+ QStringList partition; //its a "list" so as to also append drive information
- QString device, size, devinfo, type;
+ QString size, devinfo, type;
QString line, info;
- QString tmp, dev;
+ QString tmp, dev, lastslice, slice, slabel, ssize;
Process p(QStringList() << "disk-list");
@@ -110,24 +111,76 @@
line = p.readLine();
dev = line.simplified();
dev.truncate(line.indexOf(":"));
- device = "/dev/" + dev;
tmp = line.simplified().remove(0, line.indexOf(":") + 2);
devinfo = tmp;
+ // Get the disk information for this dev
Process pp(QStringList() << "disk-info" << dev);
-
if (pp.waitForFinished()) {
while (pp.canReadLine()) {
info = pp.readLine().simplified();
- if (info.indexOf("size=") == 0) size = info.replace("size=", "") + "MB";
+ if (info.indexOf("size=") == 0) size = info.replace("size=", "");
if (info.indexOf("type=") == 0) type = info.replace("type=", "");
}
}
+
+ // Add this info to our list
+ qDebug() << "Found Drive:" << dev << size << devinfo << type;
+ drive.clear();
+ drive << "DRIVE" << dev << size << devinfo << type;
+ drives.append(drive);
+
+ // Get the slice information for this disk
+ Process ppp(QStringList() << "disk-part" << dev);
+ if (ppp.waitForFinished()) {
+ while (ppp.canReadLine()) {
+ info = ppp.readLine().simplified();
+ // Get the slice we are working on
+ if ( info.indexOf(dev + "s") == 0 ) {
+ slice = info;
+ slice.truncate(slice.indexOf("-"));
+ } else {
+ slice = "";
+ }
+
+ if (info.indexOf(slice + "-label: ") == 0) slabel = info.replace(slice + "-label: ", "");
+
+ // Check if we've found the new slice
+ if (info.indexOf(slice + "-sizemb: ") == 0) {
+ ssize = info.replace(slice + "-sizemb: ", "");
+ qDebug() << "Found Slice:" << dev << slice << slabel << ssize;
+ partition.clear();
+ partition << "SLICE" << dev << slice << ssize << slabel;
+ drives.append(partition);
+ lastslice = slice;
+ }
+
+ // Check if we've found some free disk space
+ if (info.indexOf(dev + "-freemb: ") == 0) {
+ ssize = info.replace(dev + "-freemb: ", "");
+ // Figure out the next slice number, if its less than 4
+ QString freeslice;
+ tmp = lastslice;
+ tmp = tmp.remove(0, tmp.size() - 1);
+ bool ok;
+ int nextslicenum = tmp.toInt(&ok);
+ if ( ok ) {
+ if ( nextslicenum < 4) {
+ nextslicenum++;
+ slice = dev + "s" + tmp.setNum(nextslicenum);
+ slabel = "Unused Space";
+ qDebug() << "Found Slice:" << dev << slice << slabel << ssize;
+ partition.clear();
+ partition << "SLICE" << dev << slice << ssize << slabel;
+ drives.append(partition);
+ }
+ }
+ }
+ }
+ }
+
}
- qDebug() << "Found Device Info:" << device << size << devinfo << type;
- drive << device << size << devinfo << type;
- drives.append(drive);
}
return drives;
}
Modified: pcbsd/trunk/SysInstaller/sysinstaller.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.cpp 2009-11-19 17:05:20 UTC (rev 5089)
+++ pcbsd/trunk/SysInstaller/sysinstaller.cpp 2009-11-19 18:38:03 UTC (rev 5090)
@@ -30,8 +30,8 @@
// Running a regular install
steps.append(Step(tr("Language"), path + "language.png", tr("Welcome & Language selection") ) );
steps.append(Step(tr("Keyboard"), path + "keyboard.png", tr("Keyboard setup") ) );
- steps.append(Step(tr("Install Selection"), path + "install.png", tr("Select installation type") ) );
- steps.append(Step(tr("Disk Selection"), path + "slices.png", tr("Disk setup") ) );
+ steps.append(Step(tr("System"), path + "install.png", tr("Select installation type") ) );
+ steps.append(Step(tr("Disk"), path + "slices.png", tr("Disk setup") ) );
steps.append(Step(tr("Components"), path + "components.png", tr("Optional components") ) );
steps.append(Step(tr("Summary"), path + "summary.png", tr("Pre-Install Summary") ) );
steps.append(Step(tr("Installation"), path + "pcbsd.png", tr("Installation Progress") ) );
@@ -109,6 +109,7 @@
connect(radioDVDUSBInstall,SIGNAL(toggled(bool)), this, SLOT(slotChangedInstallSource()));
connect(radioNetworkInstall,SIGNAL(toggled(bool)), this, SLOT(slotChangedInstallSource()));
connect(comboSelectNic,SIGNAL(currentIndexChanged(int)), this, SLOT(slotChangedNic()));
+ connect(comboDiskList,SIGNAL(currentIndexChanged(int)), this, SLOT(slotChangedDisk()));
setKbDefaults();
@@ -116,19 +117,48 @@
slotChangedInstallSource();
slotChangedNic();
- // load drives
- comboDiskList->clear();
- sysDisks = Scripts::Backend::hardDrives();
- for (int i=0; i < sysDisks.count(); ++i) {
- comboDiskList->addItem(sysDisks.at(i).at(0) + " - " + sysDisks.at(i).at(1) + " " + sysDisks.at(i).at(2));
- }
+ // Load the disks
+ loadDiskInfo();
// Load any nics
loadNics();
}
+// Load the Disk string list
+void SysInstaller::loadDiskInfo()
+{
+ // load drives
+ comboDiskList->clear();
+ sysDisks = Scripts::Backend::hardDrives();
+ 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));
+ }
+ // Reload the slice list box
+ slotChangedDisk();
+}
+
+// The selected disk has changed, refresh our partition box
+void SysInstaller::slotChangedDisk()
+{
+ if ( !comboDiskList->currentText().isEmpty())
+ {
+ listDiskSlices->clear();
+
+ QString disk = comboDiskList->currentText();
+ disk.truncate(disk.indexOf(" -"));
+ 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" && disk == sysDisks.at(i).at(1))
+ listDiskSlices->addItem(sysDisks.at(i).at(2) + ": " + sysDisks.at(i).at(3) + "MB " + sysDisks.at(i).at(4));
+ }
+ }
+}
+
+
// Load the NICS
void SysInstaller::loadNics()
{
Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h 2009-11-19 17:05:20 UTC (rev 5089)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h 2009-11-19 18:38:03 UTC (rev 5090)
@@ -70,6 +70,7 @@
void slotChangedOS();
void slotChangedInstallSource();
void slotChangedNic();
+ void slotChangedDisk();
private:
void initSteps();
@@ -77,6 +78,7 @@
void initPostInstall();
void loadStepsInfo(bool installed);
void loadNics();
+ void loadDiskInfo();
void setCurrentIndex(int);
void setKbVariants(const QString &);
@@ -89,7 +91,8 @@
QList<Step> steps;
QList<Label *> labels; // just to handle the "Labels" list
- QList<QStringList> sysDisks; // Our lists which contains disk / partition info
+ QList<QStringList> sysDisks; // Our lists which contains disk info
+ QList<QStringList> sysPartitions; // Our lists which contains partition info
//QList<QRadioButton *> radioOS; //the operating system choice :)
};
More information about the Commits
mailing list