[PC-BSD Commits] r15155 - in users/kris/pc-installgui: . images
svn at pcbsd.org
svn at pcbsd.org
Fri Feb 10 06:19:36 PST 2012
Author: kris
Date: 2012-02-10 14:19:35 +0000 (Fri, 10 Feb 2012)
New Revision: 15155
Added:
users/kris/pc-installgui/dialogFSSize.cpp
users/kris/pc-installgui/dialogFSSize.h
users/kris/pc-installgui/dialogFSSize.ui
users/kris/pc-installgui/images/backgroundimage.jpg
Removed:
users/kris/pc-installgui/dialogFileSystem.cpp
users/kris/pc-installgui/dialogFileSystem.h
users/kris/pc-installgui/dialogFileSystem.ui
users/kris/pc-installgui/dialogSelectNet.cpp
users/kris/pc-installgui/dialogSelectNet.h
users/kris/pc-installgui/dialogSelectNet.ui
users/kris/pc-installgui/sys-componentwidget.cpp
users/kris/pc-installgui/sys-diskwidget.cpp
users/kris/pc-installgui/sys-installwidget.cpp
users/kris/pc-installgui/sys-keyboardwidget.cpp
users/kris/pc-installgui/sys-pkgmgmt.cpp
users/kris/pc-installgui/sys-userwidget.cpp
users/kris/pc-installgui/sysinstaller.cpp
users/kris/pc-installgui/sysinstaller.h
users/kris/pc-installgui/sysinstaller.ui
Modified:
users/kris/pc-installgui/installer.cpp
users/kris/pc-installgui/installer.h
users/kris/pc-installgui/installer.ui
users/kris/pc-installgui/pc-sysinstaller.pro
users/kris/pc-installgui/sysinstaller.qrc
users/kris/pc-installgui/wizardDisk.cpp
users/kris/pc-installgui/wizardDisk.h
users/kris/pc-installgui/wizardDisk.ui
users/kris/pc-installgui/wizardFreeBSD.cpp
users/kris/pc-installgui/wizardFreeBSD.h
users/kris/pc-installgui/wizardFreeBSD.ui
Log:
Add finished pc-installgui code
Index: users/kris/pc-installgui/dialogFSSize.ui
===================================================================
--- users/kris/pc-installgui/dialogFSSize.ui 2012-02-10 14:12:58 UTC (rev 15154)
+++ users/kris/pc-installgui/dialogFSSize.ui 2012-02-10 14:19:35 UTC (rev 15155)
Property changes on: users/kris/pc-installgui/dialogFSSize.ui
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/xml
Index: users/kris/pc-installgui/images/backgroundimage.jpg
===================================================================
--- users/kris/pc-installgui/images/backgroundimage.jpg 2012-02-10 14:12:58 UTC (rev 15154)
+++ users/kris/pc-installgui/images/backgroundimage.jpg 2012-02-10 14:19:35 UTC (rev 15155)
Property changes on: users/kris/pc-installgui/images/backgroundimage.jpg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/jpeg
Modified: users/kris/pc-installgui/installer.cpp
===================================================================
--- users/kris/pc-installgui/installer.cpp 2012-02-10 14:12:58 UTC (rev 15154)
+++ users/kris/pc-installgui/installer.cpp 2012-02-10 14:19:35 UTC (rev 15155)
@@ -18,6 +18,15 @@
connect(pushTouchKeyboard, SIGNAL(clicked()), this, SLOT(slotPushVirtKeyboard()));
connect(pushChangeKeyLayout, SIGNAL(clicked()), this, SLOT(slotPushKeyLayout()));
+ // Init the MBR to yes
+ loadMBR = true;
+ // Init the GPT to no
+ loadGPT = false;
+
+ // No optional components by default
+ fSRC=false;
+ fPORTS=false;
+
// Load the keyboard info
keyModels = Scripts::Backend::keyModels();
keyLayouts = Scripts::Backend::keyLayouts();
@@ -91,6 +100,9 @@
else
isLiveMode = false;
+ // Get available memory
+ systemMemory = Scripts::Backend::systemMemory();
+
// Load up the keyboard information
//connectKeyboardSlots();
@@ -101,10 +113,6 @@
loadDiskInfo();
- // Get available memory
- systemMemory = Scripts::Backend::systemMemory();
-
-
// Init the desktop wheel
initDesktopSelector();
}
@@ -212,39 +220,18 @@
}
// Now use the rest of the disk / slice for /usr
- fileSystem << targetDisk << targetSlice << "/usr" << fsType << tmp.setNum(totalSize) << "" << tmpPass;
+ fileSystem << targetDisk << targetSlice << "/usr" << fsType << tmp.setNum(totalSize) << "" << "";
//qDebug() << "Auto-Gen FS:" << fileSystem;
sysFinalDiskLayout << fileSystem;
fileSystem.clear();
} else {
- // Using ZFS
-
- // Figure out the swap size, try for 2xPhysMem first, fallback to 512 if not enough space
- int swapsize = systemMemory * 2;
- if ( totalSize - swapsize < 3000 )
- swapsize = 256;
- totalSize = totalSize - swapsize;
-
- // Setup a UFS boot partition
- totalSize = totalSize - 1024;
- fileSystem << targetDisk << targetSlice << "/boot" << "UFS" << tmp.setNum(1024) << "" << "";
- sysFinalDiskLayout << fileSystem;
- fileSystem.clear();
-
-
// Add the main zfs pool with standard partitions
fsType= "ZFS";
- fileSystem << targetDisk << targetSlice << "/,/var,/usr" << fsType << tmp.setNum(totalSize) << "" << tmpPass;
+ fileSystem << targetDisk << targetSlice << "/,/swap(swap),/var,/usr,/usr/ports(compress),/usr/src(compress),/tmp" << fsType << tmp.setNum(totalSize) << "" << "";
//qDebug() << "Auto-Gen FS:" << fileSystem;
sysFinalDiskLayout << fileSystem;
fileSystem.clear();
-
- // Add the previously calculated swap size
- fileSystem << targetDisk << targetSlice << "SWAP" << "SWAP" << tmp.setNum(swapsize) << "" << "";
- //qDebug() << "Auto-Gen FS:" << fileSystem;
- sysFinalDiskLayout << fileSystem;
- fileSystem.clear();
}
return true;
@@ -264,6 +251,13 @@
// Copy over the list to a new variable we can mangle without modifying the original
copyList = sysFinalDiskLayout;
+ if ( copyList.at(0).at(0) == "MANUAL" )
+ {
+ summaryList << "";
+ summaryList << tr("Installing to file-system mounted at /mnt");
+ return summaryList;
+ }
+
// Start our summary
summaryList << "";
summaryList << "<b>" + tr("The disk will be setup with the following configuration:") + "</b>";
@@ -400,7 +394,7 @@
wDisk = new wizardDisk();
wDisk->programInit();
wDisk->setWindowModality(Qt::ApplicationModal);
- //connect(wDisk, SIGNAL(saved(QStringList)), this, SLOT(slotSaveMetaChanges(QStringList)));
+ connect(wDisk, SIGNAL(saved(QList<QStringList>, bool, bool)), this, SLOT(slotSaveDiskChanges(QList<QStringList>, bool, bool)));
wDisk->show();
wDisk->raise();
}
@@ -424,6 +418,22 @@
graphicsViewOS->setScene(customScene);
}
+void Installer::slotSaveDiskChanges(QList<QStringList> newSysDisks, bool MBR, bool GPT)
+{
+ // Save the new disk layout
+ loadMBR = MBR;
+ loadGPT = GPT;
+ sysFinalDiskLayout = newSysDisks;
+ textEditDiskSummary->clear();
+ QStringList summary = getDiskSummary();
+ for ( int i=0; i < summary.count(); ++i)
+ textEditDiskSummary->append(summary.at(i));
+
+ textEditDiskSummary->moveCursor(QTextCursor::Start);
+
+ // Regenerate the config
+ startConfigGen();
+}
void Installer::slotDesktopLeftClicked()
{
@@ -523,25 +533,21 @@
// 1 = FreeBSD
switch (wheelCurItem)
{
- // 2 = KDE
- case 2:
+ case wKDE:
selectedPkgs.clear();
selectedPkgs << "KDE" << "KDE-Accessibility" << "KDE-Artwork" << "KDE-Education" << "KDE-Games" << "KDE-Graphics" << "KDE-Multimedia" << "KDE-Network" << "KDE-PIM";
if ( comboLanguage->currentIndex() != 0 )
selectedPkgs << "KDE-L10N";
break;
- // 3 = LXDE
- case 3:
+ case wLXDE:
selectedPkgs.clear();
selectedPkgs << "LXDE";
break;
- // 4 = GNOME
- case 4:
+ case wGNOME:
selectedPkgs.clear();
selectedPkgs << "GNOME" << "GNOME-Accessibility" << "GNOME-Games" << "GNOME-Net" << "GNOME-Utilities";
break;
- // 5 = XFCE
- case 5:
+ case wXFCE:
selectedPkgs.clear();
selectedPkgs << "XFCE" << "XFCE-Plugins";
break;
@@ -574,7 +580,11 @@
// Init the desktop selector
wheelIcons << ":/modules/images/freebsd.png" << ":/PCBSD/images/kde.png" << ":/PCBSD/images/lxde.png" << ":/PCBSD/images/gnome.png" << ":/PCBSD/images/xfce.png";
wheelName << "FreeBSD" << "KDE" << "LXDE" << "GNOME" << "XFCE";
- wheelDesc << tr("FreeBSD is a great server") << tr("KDE is a flashy desktop") << tr("LXDE is a lightweight desktop") << tr("GNOME is inbetween") << tr("XFCE? Who knows?");
+ wheelDesc << tr("FreeBSD is an advanced operating system for modern server, desktop, and embedded computer platforms. FreeBSD's code base has undergone over thirty years of continuous development, improvement, and optimization. It is developed and maintained by a large team of individuals. FreeBSD provides advanced networking, impressive security features, and world class performance and is used by some of the world's busiest web sites and most pervasive embedded networking and storage devices.") \
+ << tr("KDE is a full-featured desktop environment, which includes support for 3D desktop effects, multiple desktops, and a variety of built-in tools and utilities for both new and power-desktop users.<br><br>* Recommended for higher-end systems with 2GB of RAM or more *") \
+ << tr("LXDE is a lightweight desktop, minimalist in nature, with support for multiple-desktops, a system tray, application menu and more.<br><br>* Recommended for netbooks, or lower-end systems * ") \
+ << tr("GNOME is a full-featured desktop environment, complete with a large number of integrated utilities and tools for desktop users.") \
+ << tr("XFCE is a light and modular desktop, with a number of features to enhance customizing the desktop to your liking.");
int xOff=96;
defaultScene = new QGraphicsScene(0,0,(96 + 96 + (wheelIcons.size()*64) + (wheelIcons.size()*32) ),64);
@@ -625,9 +635,22 @@
close();
}
-void Installer::slotSaveFBSDSettings(QString, QString, QString, QString, QString, QString, bool, bool, bool)
+void Installer::slotSaveFBSDSettings(QString rootPW, QString name, QString userName, QString userPW, QString shell, QString hostname, bool ssh, bool src, bool ports, QStringList netSettings)
{
+ fRootPW = rootPW;
+ fName = name;
+ fUserName = userName;
+ fUserPW = userPW;
+ fShell = shell;
+ fHost = hostname;
+ fSSH = ssh;
+ fSRC = src;
+ fPORTS = ports;
+ fNetSettings = netSettings;
installStackWidget->setCurrentIndex(installStackWidget->currentIndex() + 1);
+
+ // Generate the pc-sysinstall config
+ startConfigGen();
}
void Installer::slotNext()
@@ -645,17 +668,21 @@
wFBSD = new wizardFreeBSD();
wFBSD->setWindowModality(Qt::ApplicationModal);
wFBSD->programInit();
- connect(wFBSD, SIGNAL(saved(QString, QString, QString, QString, QString, QString, bool, bool, bool)), this, SLOT(slotSaveFBSDSettings(QString, QString, QString, QString, QString, QString, bool, bool, bool)));
+ connect(wFBSD, SIGNAL(saved(QString, QString, QString, QString, QString, QString, bool, bool, bool, QStringList)), this, SLOT(slotSaveFBSDSettings(QString, QString, QString, QString, QString, QString, bool, bool, bool, QStringList)));
wFBSD->show();
wFBSD->raise();
return ;
}
+ // Create the pc-sysinstall config
+ if ( installStackWidget->currentIndex() == 1 )
+ startConfigGen();
+
// If the chosen disk is too small or partition is invalid, don't continue
if ( installStackWidget->currentIndex() == 2 && ! checkDiskRequirements())
return;
- if ( installStackWidget->currentIndex() == 3 )
+ if ( installStackWidget->currentIndex() == 2 )
{
int ret = QMessageBox::question(this, tr("PC-BSD Installer"),
tr("Start the installation now?"),
@@ -663,8 +690,7 @@
QMessageBox::No);
switch (ret) {
case QMessageBox::Yes:
- // KPM
- //startInstall();
+ startInstall();
break;
case QMessageBox::No: // :)
return;
@@ -738,22 +764,20 @@
connect(comboLanguage, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotChangeLanguage()));
}
-QStringList Installer::getGlobalCfgSettings(QStringList &summaryList)
+QStringList Installer::getGlobalCfgSettings()
{
QStringList tmpList;
QString tmp, upDrive;
- summaryList << "<b>" + tr("The system will be installed with the following options:") + "</b>";
-
tmpList << "# Auto-Generated pc-sysinstall configuration";
tmpList << "installInteractive=no";
// Doing a fresh install
tmpList << "installMode=fresh";
- //if ( radioInstallPCBSD->isChecked() ) {
- // KPM CHANGE ME
- if ( true ) {
+
+ // If we are doing a PC-BSD install
+ if ( wheelCurItem != wFREEBSD ) {
tmpList << "installType=PCBSD";
// If installing from a install media, use tar, otherwise uzip
@@ -763,24 +787,58 @@
tmpList << "packageType=uzip";
tmpList << "";
- summaryList << tr("Performing a fresh install of PC-BSD");
} else {
tmpList << "installType=FreeBSD";
tmpList << "packageType=tar";
- summaryList << tr("Performing a fresh install of FreeBSD");
}
// If we have a custom hostname, add it to the config
- // KPM
- //if ( checkHostname->isChecked() ) {
- // tmpList << "hostname=" + lineHostname->text();
- // summaryList << tr("Using custom hostname:") + " " + lineHostname->text();
+ if ( ! fHost.isEmpty() )
+ tmpList << "hostname=" + fHost;
- tmpList << "netSaveDev=AUTO-DHCP-SLAAC";
+
+ // Networking setup
+ if ( wheelCurItem != wFREEBSD ) {
+ // PC-BSD network setup
+ tmpList << "netSaveDev=AUTO-DHCP-SLAAC";
+ } else {
+ // FreeBSD network setup
+ if ( fNetSettings.at(0) == "AUTO-DHCP" )
+ tmpList << "netSaveDev=AUTO-DHCP";
+ else if ( fNetSettings.at(0) == "AUTO-DHCP-SLAAC" ) {
+ tmpList << "netSaveDev=AUTO-DHCP-SLAAC";
+ // We cannot rely on SLAAC to provide DNS for example. The same is true
+ // for DHCP but the worls seems to have forgotten...
+ tmpList << "netSaveIPv6=" + fNetSettings.at(5);
+ tmpList << "netSaveIPv6NameServer=" + fNetSettings.at(6);
+ tmpList << "netSaveIPv6DefaultRouter=" + fNetSettings.at(7);
+ } else if ( fNetSettings.at(0) == "IPv6-SLAAC" ) {
+ tmpList << "netSaveDev=IPv6-SLAAC";
+ // We cannot rely on SLAAC to provide DNS for example. The same is true
+ // for DHCP but the worls seems to have forgotten...
+ tmpList << "netSaveIPv6=" + fNetSettings.at(5);
+ tmpList << "netSaveIPv6NameServer=" + fNetSettings.at(6);
+ tmpList << "netSaveIPv6DefaultRouter=" + fNetSettings.at(7);
+ }
+ else
+ {
+ tmp = fNetSettings.at(0);
+ if ( tmp.indexOf(":") > 0 )
+ tmp.truncate(tmp.indexOf(":"));
+ tmpList << "netSaveDev=" + tmp;
+ tmpList << "netSaveIP=" + fNetSettings.at(1);
+ tmpList << "netSaveMask=" + fNetSettings.at(2);
+ tmpList << "netSaveNameServer=" + fNetSettings.at(3);
+ tmpList << "netSaveDefaultRouter=" + fNetSettings.at(4);
+ tmpList << "netSaveIPv6=" + fNetSettings.at(5);
+ tmpList << "netSaveIPv6NameServer=" + fNetSettings.at(6);
+ tmpList << "netSaveIPv6DefaultRouter=" + fNetSettings.at(7);
+ }
+ }
+
// Doing a regular DVD/USB install
tmpList << "installMedium=dvd";
- summaryList << tr("Installing From:") + " " + tr("DVD/USB");
if ( comboLanguage->currentIndex() != 0 ) {
QString lang = languages.at(comboLanguage->currentIndex());
@@ -821,19 +879,16 @@
void Installer::startConfigGen()
{
QStringList cfgList;
- QStringList summaryList;
// Generate the config file now
- cfgList+=getGlobalCfgSettings(summaryList);
+ cfgList+=getGlobalCfgSettings();
- cfgList+=getDiskCfgSettings(summaryList);
+ cfgList+=getDiskCfgSettings();
- cfgList+=getComponentCfgSettings(summaryList);
+ cfgList+=getComponentCfgSettings();
// If this is a PC-BSD Install, do a few extra commands after everything else
- // KPM
- // if ( radioInstallPCBSD->isChecked() ) {
- if ( true ) {
+ if ( wheelCurItem != wFREEBSD ) {
// First mount /dev inside chroot
cfgList << "runExtCommand=mount -t devfs devfs ${FSMNT}/dev";
@@ -864,9 +919,8 @@
//cfgList << "runCommand=/usr/local/share/pcbsd/scripts/set-lang.sh " + lang + " " + layout;
// If doing install from package disk
- // KPM
- // if ( (availPackageData && hasPkgsOnMedia ) || ( availPackageData && radioNetworkInstall->isChecked() ) )
- cfgList+=getDeskPkgCfg(summaryList);
+ if ( availPackageData && hasPkgsOnMedia )
+ cfgList+=getDeskPkgCfg();
// Set all firewall rules
cfgList << "runCommand=sh /usr/local/share/pcbsd/scripts/sys-init.sh";
@@ -877,9 +931,14 @@
// Unmount our /dev
cfgList << "runExtCommand=umount ${FSMNT}/dev";
- } // End of PC-BSD specific setup
+ } else { // End of PC-BSD specific setup
+ // FreeBSD specific config options
+ cfgList+=getUsersCfgSettings();
- textEditSummary->clear();
+ // Enable SSH?
+ if ( fSSH )
+ cfgList << "runCommand=echo 'sshd_enable=\"YES\"' >>/etc/rc.conf";
+ }
// Now write out the cfgList to file
QFile cfgfile( PCSYSINSTALLCFG );
@@ -890,12 +949,6 @@
}
cfgfile.close();
}
-
- for ( int i=0; i < summaryList.count(); ++i)
- textEditSummary->append(summaryList.at(i));
-
- textEditSummary->moveCursor(QTextCursor::Start);
-
}
void Installer::slotHelp()
@@ -919,7 +972,7 @@
}
// Function which returns the pc-sysinstall cfg data
-QStringList Installer::getDiskCfgSettings(QStringList &summaryList)
+QStringList Installer::getDiskCfgSettings()
{
QStringList tmpList;
QList<QStringList> copyList;
@@ -929,10 +982,6 @@
// Copy over the list to a new variable we can mangle without modifying the original
copyList = sysFinalDiskLayout;
- // Start our summary
- summaryList << "";
- summaryList << "<b>" + tr("The disk will be setup with the following configuration:") + "</b>";
-
while ( ! copyList.empty() )
{
workingDisk = copyList.at(0).at(0);
@@ -950,46 +999,18 @@
tmpList << "disk" + tmp.setNum(disk) + "=" + workingDisk;
tmpList << "partition=" + tmpSlice;
- // If doing a basic disk setup
- // KPM
- //if ( tabDisk->currentIndex() == 0 ) {
- // tmpList << "bootManager=none";
- tmpList << "bootManager=none";
- tmpList << "partscheme=MBR";
-
- // If this is a dedicated disk, mark if using MBR/GPT
- // KPM
- //if ( tmpSlice == "ALL" ) {
- // if ( checkDiskGPT->isChecked() )
- // tmpList << "partscheme=GPT";
- // else
- // tmpList << "partscheme=MBR";
- //}
- //} else {
- // Doing advanced disk setup
+ // Are we loading a boot-loader?
+ if ( loadMBR )
+ tmpList << "bootManager=bsd";
+ else
tmpList << "bootManager=none";
- // KPM
- // If this is a dedicated disk, mark if using MBR/GPT
- //if ( tmpSlice == "ALL" ) {
- // if ( checkDiskGPTAdv->isChecked() )
- // tmpList << "partscheme=GPT";
- // else
- // tmpList << "partscheme=MBR";
- //}
- //}
+ // Set the GPT/MBR options
+ if ( loadGPT )
+ tmpList << "partscheme=GPT";
+ else
+ tmpList << "partscheme=MBR";
- // 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);
- summaryList << tr("Disk:") + copyList.at(i).at(0) + " " + tr("Mirroring:") + workingDisk;
- copyList.removeAt(i);
- break;
- }
- }
tmpList << "commitDiskPart";
tmpList << "";
@@ -1040,13 +1061,6 @@
if ( ! copyList.at(i).at(6).isEmpty() )
tmpList << "encpass=" + copyList.at(i).at(6);
- // Write the user summary
- summaryList << "";
- summaryList << tr("Partition:") + " " + workingDisk + "(" + workingSlice + "):";
- summaryList << tr("FileSystem:") + " " + copyList.at(i).at(3);
- summaryList << tr("Size:") + " " + copyList.at(i).at(4) + "MB ";
- summaryList << tr("Mount:") + " " + copyList.at(i).at(2);
-
// Done with this item, remove it now
copyList.removeAt(i);
break;
@@ -1054,7 +1068,6 @@
}
}
-
// Now look for SWAP
for (int i=0; i < copyList.count(); ++i) {
if ( copyList.at(i).at(0) == workingDisk \
@@ -1066,18 +1079,11 @@
+ copyList.at(i).at(3) + " " + copyList.at(i).at(4) \
+ " none";
- // Write the user summary
- summaryList << "";
- summaryList << tr("Partition:") + " " + workingDisk + "(" + workingSlice + "):";
- summaryList << tr("FileSystem:") + " " + copyList.at(i).at(3);
- summaryList << tr("Size:") + " " + copyList.at(i).at(4) + "MB ";
-
// Done with this item, remove it now
copyList.removeAt(i);
break;
}
}
-
// Now look for any other partitions
int count = copyList.count();
@@ -1105,13 +1111,6 @@
if ( ! copyList.at(i).at(6).isEmpty() )
tmpList << "encpass=" + copyList.at(i).at(6);
- // Write the user summary
- summaryList << "";
- summaryList << tr("Partition:") + " " + workingDisk + "(" + workingSlice + "):";
- summaryList << tr("FileSystem:") + " " + copyList.at(i).at(3);
- summaryList << tr("Size:") + " " + copyList.at(i).at(4) + "MB ";
- summaryList << tr("Mount:") + " " + copyList.at(i).at(2);
-
// Done with this item, remove it now
copyList.removeAt(i);
i--;
@@ -1339,11 +1338,6 @@
connect(installProc,SIGNAL(readyRead()),this,SLOT(slotReadInstallerOutput()));
installProc->start(program, arguments);
- // If doing a restore, set the progressBar to unknown
- //if ( radioRestore->isChecked() )
- // progressBarInstall->setRange(0, 0);
-
-
}
// Function run when the install failed to prompt user for course of action
@@ -1564,26 +1558,20 @@
}
// Return list of components to install
-QStringList Installer::getComponentCfgSettings(QStringList &summaryList)
+QStringList Installer::getComponentCfgSettings()
{
- QStringList componentList;
- QString tmpList;
- for ( int i=0; i<listComponents.count(); ++i) {
- if ( listComponents.at(i).at(4) == "on" )
- tmpList = tmpList + listComponents.at(i).at(0) + ",";
+ QStringList componentList, com;
+ if ( fSRC )
+ com << "src";
+ if ( fPORTS )
+ com << "ports";
+
+ if ( ! com.isEmpty() ) {
+ componentList << "";
+ componentList << "# Optional Components";
+ componentList << "installComponents=" + com.join(",");
}
- if ( tmpList.size() > 0 )
- tmpList.truncate(tmpList.size() -1 );
-
- componentList << "";
- componentList << "# Optional Components";
- componentList << "installComponents=" + tmpList;
-
- summaryList << "";
- summaryList << "<b>" + tr("Selected Components:") + "</b>";
- summaryList << tmpList;
-
return componentList;
}
@@ -1594,22 +1582,40 @@
}
// Return the configuration for desktop packages
-QStringList Installer::getDeskPkgCfg(QStringList &summaryList)
+QStringList Installer::getDeskPkgCfg()
{
QStringList cfgList;
QString cfgLine;
- summaryList << "";
- summaryList << "<b>" + tr("The following packages will be installed:") + "</b>";
- summaryList << "base-system";
-
cfgLine="runExtCommand=sh /root/insMetaPkgs.sh base-system";
for ( int i=0; i<selectedPkgs.count(); ++i) {
cfgLine+="," + selectedPkgs.at(i);
- summaryList << selectedPkgs.at(i);
}
cfgLine += " CD";
cfgList << cfgLine;
return cfgList;
}
+
+// Return list of users in cfg format
+QStringList Installer::getUsersCfgSettings()
+{
+ QStringList userList;
+
+ userList << "";
+ userList << "# Root Password";
+ userList << "rootPass=" + fRootPW;
+
+ userList << "";
+ userList << "# Users";
+ userList << "userName=" + fUserName;
+ userList << "userComment=" + fName;
+ userList << "userPass=" + fUserPW;
+ userList << "userShell=" + fShell;
+ userList << "userHome=/home/" + fUserName;
+ userList << "userGroups=wheel,operator";
+ userList << "commitUser";
+ userList << "";
+
+ return userList;
+}
Modified: users/kris/pc-installgui/installer.h
===================================================================
--- users/kris/pc-installgui/installer.h 2012-02-10 14:12:58 UTC (rev 15154)
+++ users/kris/pc-installgui/installer.h 2012-02-10 14:19:35 UTC (rev 15155)
@@ -10,12 +10,17 @@
#include "ui_installer.h"
#include "dialogHelp.h"
-#include "dialogInfoBox.h"
#include "dialogKeyboard.h"
#include "dialogDesktopSelection.h"
#include "wizardFreeBSD.h"
#include "wizardDisk.h"
+#define wFREEBSD 1
+#define wKDE 2
+#define wLXDE 3
+#define wGNOME 4
+#define wXFCE 5
+
#include "backend.h"
class Installer : public QWidget, private Ui::Installer
@@ -38,6 +43,7 @@
// Disk slots
void slotDiskCustomizeClicked();
+ void slotSaveDiskChanges(QList<QStringList>, bool, bool);
// Slots for the installation
void slotInstallProcFinished( int exitCode, QProcess::ExitStatus status);
@@ -54,7 +60,7 @@
void slotDesktopRightClicked();
void slotDesktopCustomizeClicked();
void slotSaveMetaChanges(QStringList);
- void slotSaveFBSDSettings(QString, QString, QString, QString, QString, QString, bool, bool, bool);
+ void slotSaveFBSDSettings(QString, QString, QString, QString, QString, QString, bool, bool, bool, QStringList);
private:
@@ -67,9 +73,9 @@
QStringList getDiskSummary();
// Functions which return parts of the config file
- QStringList getGlobalCfgSettings(QStringList &summaryList);
- QStringList getDiskCfgSettings(QStringList &summaryList);
- QStringList getComponentCfgSettings(QStringList &summaryList);
+ QStringList getGlobalCfgSettings();
+ QStringList getDiskCfgSettings();
+ QStringList getComponentCfgSettings();
void startConfigGen(); // Function which takes pieces of cfg, and assembles
@@ -81,7 +87,7 @@
void initDesktopSelector();
void moveDesktopWheel(bool direction);
void changeMetaPkgSelection();
- QStringList getDeskPkgCfg(QStringList &summaryList);
+ QStringList getDeskPkgCfg();
QStringList wheelIcons;
QStringList wheelName;
QStringList wheelDesc;
@@ -100,6 +106,8 @@
QList<QStringList> sysDisks; // Our lists which contains disk info
QList<QStringList> sysPartitions; // Our lists which contains partition info
QList<QStringList> sysFinalDiskLayout; // Our lists which contains the final disk layout
+ bool loadMBR;
+ bool loadGPT;
int systemMemory; // Ammount of system RAM we have in MB
QList<QStringList> listComponents; // QStringList for our available components
QStringList languages;
@@ -123,6 +131,19 @@
// FreeBSD setup wizard
wizardFreeBSD *wFBSD;
+
+ // FreeBSD options
+ QString fRootPW;
+ QString fName;
+ QString fUserName;
+ QString fUserPW;
+ QString fShell;
+ QString fHost;
+ bool fSSH;
+ bool fSRC;
+ bool fPORTS;
+ QStringList fNetSettings;
+ QStringList getUsersCfgSettings();
// Keyboard Widget
widgetKeyboard *wKey;
Modified: users/kris/pc-installgui/installer.ui
===================================================================
(Binary files differ)
Modified: users/kris/pc-installgui/pc-sysinstaller.pro
===================================================================
--- users/kris/pc-installgui/pc-sysinstaller.pro 2012-02-10 14:12:58 UTC (rev 15154)
+++ users/kris/pc-installgui/pc-sysinstaller.pro 2012-02-10 14:19:35 UTC (rev 15155)
@@ -5,25 +5,21 @@
DESTDIR=/usr/local/bin
TEMPLATE = app
SOURCES += main.cpp \
+ dialogDesktopSelection.cpp \
+ dialogFSSize.cpp \
dialogInfoBox.cpp \
- dialogDesktopSelection.cpp \
- dialogFileSystem.cpp \
dialogKeyboard.cpp \
dialogHelp.cpp \
- dialogSelectNet.cpp \
- dialogZFSMount.cpp \
wizardDisk.cpp \
wizardFreeBSD.cpp \
installer.cpp \
backend.cpp
HEADERS += installer.h \
+ dialogDesktopSelection.h \
+ dialogFSSize.h \
dialogInfoBox.h \
- dialogDesktopSelection.h \
- dialogFileSystem.h \
dialogKeyboard.h \
dialogHelp.h \
- dialogSelectNet.h \
- dialogZFSMount.h \
wizardDisk.h \
wizardFreeBSD.h \
helpText.h \
@@ -98,5 +94,5 @@
INSTALLS += dotrans
-FORMS += installer.ui dialogDesktopSelection.ui dialogFileSystem.ui dialogHelp.ui dialogSelectNet.ui dialogZFSMount.ui dialogInfoBox.ui wizardFreeBSD.ui dialogKeyboard.ui wizardDisk.ui
+FORMS += installer.ui dialogDesktopSelection.ui dialogFSSize.ui dialogHelp.ui wizardFreeBSD.ui dialogKeyboard.ui wizardDisk.ui dialogInfoBox.ui
RESOURCES += sysinstaller.qrc
Modified: users/kris/pc-installgui/sysinstaller.qrc
===================================================================
--- users/kris/pc-installgui/sysinstaller.qrc 2012-02-10 14:12:58 UTC (rev 15154)
+++ users/kris/pc-installgui/sysinstaller.qrc 2012-02-10 14:19:35 UTC (rev 15155)
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/modules">
+ <file>images/backgroundimage.jpg</file>
<file>images/basic.png</file>
<file>images/advanced.png</file>
<file>images/expert.png</file>
Modified: users/kris/pc-installgui/wizardDisk.cpp
===================================================================
--- users/kris/pc-installgui/wizardDisk.cpp 2012-02-10 14:12:58 UTC (rev 15154)
+++ users/kris/pc-installgui/wizardDisk.cpp 2012-02-10 14:19:35 UTC (rev 15155)
@@ -9,18 +9,78 @@
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
+#include <QDebug>
+#include <QInputDialog>
+#include <QMessageBox>
#include "wizardDisk.h"
#include "ui_wizardDisk.h"
void wizardDisk::programInit()
{
+ prevID = 0;
+
+ populateDiskInfo();
+
//connect(pushClose, SIGNAL(clicked()), this, SLOT(slotClose()));
- //connect(this,SIGNAL(currentIdChanged(int)),this,SLOT(slotCheckComplete()));
- //connect(lineEncPW,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckComplete()));
- //connect(lineEncPW2,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckComplete()));
+ connect(pushSizeMount, SIGNAL(clicked()), this, SLOT(slotResizeFS()));
+ connect(pushRemoveMount, SIGNAL(clicked()), this, SLOT(slotRemoveFS()));
+ connect(pushAddMount, SIGNAL(clicked()), this, SLOT(slotAddFS()));
+ connect(this,SIGNAL(currentIdChanged(int)),this,SLOT(slotCheckComplete()));
+ connect(lineEncPW,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckComplete()));
+ connect(lineEncPW2,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckComplete()));
+ connect(comboDisk,SIGNAL(currentIndexChanged(int)),this,SLOT(slotCheckComplete()));
+ connect(comboDisk,SIGNAL(currentIndexChanged(int)),this,SLOT(slotChangedDisk()));
+ connect(comboPartition,SIGNAL(currentIndexChanged(int)),this,SLOT(slotCheckComplete()));
+ connect(groupEncryption,SIGNAL(toggled(bool)),this,SLOT(slotCheckComplete()));
+ connect(treeMounts,SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),this,SLOT(slotTreeDiskChanged()));
+ treeMounts->setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(treeMounts,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(slotTreeMountsRightClick()));
+ connect(pushTerminal, SIGNAL(clicked()), this, SLOT(slotTerminal()));
+ // Set the suggested FileSystem
+ systemMemory = Scripts::Backend::systemMemory();
+ if ( systemMemory > 4028 )
+ radioZFS->setChecked(true);
+ else
+ radioUFS->setChecked(true);
+
}
+void wizardDisk::populateDiskInfo()
+{
+ qDebug() << "Loading Disk Info";
+ sysDisks = Scripts::Backend::hardDrives();
+
+ // load drives
+ comboDisk->clear();
+ for (int i=0; i < sysDisks.count(); ++i) {
+ // Make sure to only add the drives to the comboDisk
+ if ( sysDisks.at(i).at(0) == "DRIVE" )
+ comboDisk->addItem(sysDisks.at(i).at(1) + " - " + sysDisks.at(i).at(2) + "MB " + sysDisks.at(i).at(3));
+ }
+
+ // Reload the slice list box
+ slotChangedDisk();
+}
+
+void wizardDisk::slotChangedDisk()
+{
+ if ( comboDisk->currentText().isEmpty())
+ return;
+
+ comboPartition->clear();
+ comboPartition->addItem(tr("Use entire disk"));
+
+ QString disk = comboDisk->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) && sysDisks.at(i).at(4) != "Unused Space")
+ comboPartition->addItem(sysDisks.at(i).at(2) + ": " + sysDisks.at(i).at(3) + "MB " + sysDisks.at(i).at(4));
+ }
+
+}
+
void wizardDisk::slotClose()
{
close();
@@ -28,17 +88,89 @@
void wizardDisk::accept()
{
+ bool useGPT = false;
+ if (comboPartition->currentIndex() == 0 )
+ useGPT = checkGPT->isChecked();
+ if ( radioExpert->isChecked() )
+ emit saved(sysFinalDiskLayout, false, false);
+ else
+ emit saved(sysFinalDiskLayout, checkMBR->isChecked(), useGPT);
+ close();
}
+int wizardDisk::nextId() const
+{
+ switch (currentId()) {
+ case Page_Intro:
+ if (radioExpert->isChecked())
+ return Page_Expert;
+ if (radioBasic->isChecked())
+ checkGPT->setVisible(false);
+ if (radioAdvanced->isChecked())
+ checkGPT->setVisible(true);
+ break;
+ case Page_BasicEnc:
+ if (radioBasic->isChecked())
+ return Page_Confirmation;
+ break;
+ case Page_Mounts:
+ return Page_Confirmation;
+ break;
+ case Page_Confirmation:
+ return -1;
+ break;
+ default:
+ return currentId() + 1;
+ }
+ return currentId() + 1;
+}
+
// Logic checks to see if we are ready to move onto next page
bool wizardDisk::validatePage()
{
+ // Generate suggested disk layout and show disk tree
+ if ( prevID == Page_FS && currentId() == Page_Mounts) {
+ generateDiskLayout();
+ populateDiskTree();
+ }
+
+ // Basic mode, generate a disk layout and show summary
+ if ( prevID == Page_BasicEnc && currentId() == Page_Confirmation) {
+ generateDiskLayout();
+ generateConfirmationText();
+ }
+
+ // Create the final disk layout from user options
+ if ( prevID == Page_Mounts && currentId() == Page_Confirmation) {
+ generateCustomDiskLayout();
+ generateConfirmationText();
+ }
+
+ // Create the final disk layout from user options
+ if ( prevID == Page_Expert && currentId() == Page_Confirmation) {
+ generateConfirmationText();
+ }
+
+
+ // Reset the prevID
+ prevID = currentId();
+
switch (currentId()) {
case Page_Intro:
button(QWizard::NextButton)->setEnabled(true);
return true;
case Page_BasicDisk:
+ if ( comboPartition->currentIndex() == 0 && radioAdvanced->isChecked())
+ checkGPT->setVisible(true);
+ else
+ checkGPT->setVisible(false);
+
+ if ( ! checkDiskSpace() ) {
+ button(QWizard::NextButton)->setEnabled(false);
+ return false;
+ }
+
// if we get this far, all the fields are filled in
button(QWizard::NextButton)->setEnabled(true);
return true;
@@ -60,9 +192,707 @@
return true;
}
+bool wizardDisk::checkDiskSpace()
+{
+ if ( getDiskSliceSize() < 10000 )
+ return false;
+
+ return true;
+}
+
void wizardDisk::slotCheckComplete()
{
// Validate this page
validatePage();
}
+
+void wizardDisk::generateDiskLayout()
+{
+ QString targetType, tmp;
+ int targetLoc, totalSize = 0, mntsize;
+ QString targetDisk, targetSlice, tmpPass, fsType, target;
+
+ // Clear out the original disk layout
+ sysFinalDiskLayout.clear();
+ QStringList fileSystem;
+ qDebug() << "Generating disk layout";
+
+
+ if ( comboPartition->currentIndex() == 0) {
+ targetType = "DRIVE";
+ targetSlice = "ALL";
+ targetDisk = comboDisk->currentText();
+ targetDisk.truncate(targetDisk.indexOf(" -"));
+ target = targetDisk;
+ targetLoc = 1;
+ } else {
+ targetType = "SLICE";
+ targetDisk = comboDisk->currentText();
+ targetDisk.truncate(targetDisk.indexOf(" -"));
+ targetSlice = comboPartition->currentText();
+ targetSlice.truncate(targetSlice.indexOf(":"));
+ targetSlice = targetSlice.remove(0, targetSlice.size() -2);
+ target = targetDisk + targetSlice;
+ targetLoc = 2;
+ }
+
+
+ totalSize = getDiskSliceSize();
+ if ( totalSize != -1 )
+ {
+ // We got a valid size for this disk / slice, lets generate the layout now
+ mntsize = 2000;
+
+ // This is set automatically if in basic mode
+ if ( radioUFS->isChecked() ) {
+
+ fsType="UFS+SUJ";
+
+ fileSystem << targetDisk << targetSlice << "/" << 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;
+
+ // Cap the swap size to 2GB
+ if ( mntsize > 2000 )
+ mntsize = 2000;
+
+ fileSystem << targetDisk << targetSlice << "SWAP" << "SWAP" << 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();
+ }
+
+ // See if using encryption for this partition
+ if ( groupEncryption->isChecked() ) {
+ fsType+= ".eli";
+ tmpPass=lineEncPW->text();
+ }
+
+ // Now use the rest of the disk / slice for /usr
+ fileSystem << targetDisk << targetSlice << "/usr" << fsType << tmp.setNum(totalSize) << "" << tmpPass;
+ sysFinalDiskLayout << fileSystem;
+ fileSystem.clear();
+
+ } else {
+ // Using ZFS
+
+ // If encryption is enabled, we need a ufs /boot partition
+ if ( groupEncryption->isChecked() ) {
+ totalSize = totalSize - 1024;
+ fileSystem << targetDisk << targetSlice << "/boot" << "UFS" << tmp.setNum(1024) << "" << "";
+ sysFinalDiskLayout << fileSystem;
+ fileSystem.clear();
+ }
+
+ // See if using encryption for this partition
+ if ( groupEncryption->isChecked() ) {
+ fsType= "ZFS.eli";
+ tmpPass=lineEncPW->text();
+ } else {
+ fsType= "ZFS";
+ }
+
+ // Add the main zfs pool with standard partitions including a /swap on ZFS
+ // This lets the user do nifty stuff like a mirror/raid post-install with a single zpool command
+ fileSystem << targetDisk << targetSlice << "/,/swap(swap),/var,/usr,/usr/ports(compress),/usr/src(compress),/tmp" << fsType << tmp.setNum(totalSize) << "" << tmpPass;
+ //qDebug() << "Auto-Gen FS:" << fileSystem;
+ sysFinalDiskLayout << fileSystem;
+ fileSystem.clear();
+ }
+ }
+
+ qDebug() << "AutoLayout:" << sysFinalDiskLayout;
+}
+
+void wizardDisk::populateDiskTree()
+{
+ QStringList tmpList, zMnts;
+ QString tmp, opts;
+ int usedSpace = 0;
+ bool ok;
+
+ treeMounts->clear();
+ if (radioUFS->isChecked()) {
+ treeMounts->setHeaderLabels(QStringList() << "ID" << tr("Mount") << tr("Size") << tr("Type") );
+ treeMounts->setColumnCount(4);
+ labelFreeSpace->setVisible(true);
+ lineFreeMB->setVisible(true);
+ pushSizeMount->setVisible(true);
+ } else {
+ treeMounts->setHeaderLabels(QStringList() << "ID" << tr("ZFS Mounts") << tr("ZFS Options") );
+ treeMounts->setColumnCount(3);
+ labelFreeSpace->setVisible(false);
+ lineFreeMB->setVisible(false);
+ pushSizeMount->setVisible(false);
+ }
+
+ treeMounts->header()->setDefaultSectionSize(100);
+ treeMounts->header()->setSectionHidden(0, true);
+
+ if (radioUFS->isChecked()) {
+ for (int i=0; i < sysFinalDiskLayout.count(); ++i) {
+ // Start adding the disk items to our tree widget
+ new QTreeWidgetItem(treeMounts, QStringList() << tmp.setNum(i) << sysFinalDiskLayout.at(i).at(2) << sysFinalDiskLayout.at(i).at(4) << sysFinalDiskLayout.at(i).at(3));
+ usedSpace = usedSpace + sysFinalDiskLayout.at(i).at(4).toInt(&ok);
+ }
+
+ // Now lets show how much is free to play with
+ lineFreeMB->setText(QString().setNum(getDiskSliceSize() - usedSpace));
+
+ } else {
+ // Show ZFS stuff
+ if ( groupEncryption->isChecked()) {
+ new QTreeWidgetItem(treeMounts, QStringList() << "0" << "/boot" << "UFSBOOT");
+ zMnts = sysFinalDiskLayout.at(1).at(2).split(",");
+ } else {
+ zMnts = sysFinalDiskLayout.at(0).at(2).split(",");
+ }
+ // Now loop through ZFS mounts
+ for (int i=0; i < zMnts.count(); ++i) {
+ tmpList.clear();
+ opts = zMnts.at(i).section("(", 1, 1).section(")", 0, 0);
+ tmpList << tmp.setNum(i+1) << zMnts.at(i).split("(").at(0) << opts ;
+ new QTreeWidgetItem(treeMounts, tmpList);
+ }
+ }
+
+ treeMounts->setCurrentItem(treeMounts->findItems("0", Qt::MatchFixedString).at(0));
+ slotTreeDiskChanged();
+
+}
+
+int wizardDisk::getDiskSliceSize()
+{
+ bool ok;
+ QString disk = comboDisk->currentText();
+ disk.truncate(disk.indexOf(" -"));
+
+ int safeBuf = 10;
+
+ // Check the full disk
+ if ( comboPartition->currentIndex() == 0) {
+ 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" && sysDisks.at(i).at(1) == disk ) {
+ //qDebug() << "Selected Disk Size: " + sysDisks.at(i).at(2);
+ sysDisks.at(i).at(2).toInt(&ok);
+ if( ok )
+ return sysDisks.at(i).at(2).toInt(&ok) - safeBuf;
+ else
+ return -1;
+ }
+ }
+ } else {
+ // Check the selected partition
+ QString slice = comboPartition->currentText();
+ slice.truncate(slice.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" && slice == sysDisks.at(i).at(2)) {
+ //qDebug() << "Selected Slice Size: " + sysDisks.at(i).at(3);
+ sysDisks.at(i).at(3).toInt(&ok);
+ if( ok )
+ return sysDisks.at(i).at(3).toInt(&ok) - safeBuf;
+ else
+ return -1;
+ }
+ }
+ }
+
+ return -1;
+}
+
+void wizardDisk::slotTreeDiskChanged()
+{
+ if ( ! treeMounts->currentItem() )
+ return;
+
+ pushRemoveMount->setEnabled(true);
+ pushAddMount->setEnabled(true);
+ pushSizeMount->setEnabled(true);
+
+ if ( treeMounts->currentItem()->text(1) == "SWAP" || treeMounts->currentItem()->text(1) == "/boot" || treeMounts->currentItem()->text(1) == "/" || treeMounts->currentItem()->text(1) == "/swap" )
+ pushRemoveMount->setEnabled(false);
+
+ if ( lineFreeMB->text() == "0" )
+ pushAddMount->setEnabled(false);
+}
+
+void wizardDisk::slotResizeFS()
+{
+ if ( ! treeMounts->currentItem() )
+ return;
+
+ QString mnt = treeMounts->currentItem()->text(1);
+ bool ok;
+ int curSize, availSize, minSize;
+ curSize = treeMounts->currentItem()->text(2).toInt(&ok);
+ availSize = curSize + lineFreeMB->text().toInt(&ok);
+
+ minSize = 100;
+
+ // See if we need some other sanity check on sizes
+ if ( mnt == "SWAP" )
+ minSize = 256;
+ if ( mnt == "/" )
+ minSize = 2000;
+ if ( mnt == "/boot" )
+ minSize = 1000;
+
+ addingMount="";
+ rFS = new dialogFSSize();
+ rFS->programInit(QString(tr("Resizing") + " " + mnt), curSize, availSize, minSize);
+ rFS->setWindowModality(Qt::ApplicationModal);
+ connect(rFS, SIGNAL(saved(int)), this, SLOT(slotSaveFSResize(int)));
+ rFS->show();
+ rFS->raise();
+}
+
+void wizardDisk::slotRemoveFS()
+{
+ if ( ! treeMounts->currentItem() )
+ return;
+
+ int ret = QMessageBox::question(this, tr("Remove mount-point"),
+ tr("Are you sure you want to remove this mount point?"),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No);
+
+ if ( ret != QMessageBox::Yes )
+ return;
+
+ QTreeWidgetItem *rmItem = treeMounts->currentItem();
+ treeMounts->setCurrentItem(treeMounts->findItems("0", Qt::MatchFixedString).at(0));
+
+ // If editing UFS, lets adjust the available size
+ if (radioUFS->isChecked()) {
+ bool ok;
+ QString tmp;
+ int fSize = rmItem->text(2).toInt(&ok);
+ int newAvailSize = lineFreeMB->text().toInt(&ok) + fSize;
+ lineFreeMB->setText(tmp.setNum(newAvailSize));
+ }
+
+ delete rmItem;
+}
+
+void wizardDisk::slotAddFS()
+{
+ bool ok;
+ QString tmp;
+ QString nMount = QInputDialog::getText(this, tr("Enter mount-point"),
+ tr("Please enter the new mount-point:"), QLineEdit::Normal,
+ "/", &ok);
+ if (!ok || nMount.isEmpty())
+ return;
+
+ // Make sure this mount doesn't already exist
+ QList<QTreeWidgetItem *> mItems = treeMounts->findItems("*", Qt::MatchWildcard);
+ for ( int i = 0; i < mItems.size(); ++i) {
+ if ( mItems.at(i)->text(1) == nMount )
+ 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;
+ int availSize = lineFreeMB->text().toInt(&ok);
+ rFS = new dialogFSSize();
+ rFS->programInit(QString(tr("Specify a size for the mount") + " " + addingMount), 100, availSize, 100);
+ rFS->setWindowModality(Qt::ApplicationModal);
+ connect(rFS, SIGNAL(saved(int)), this, SLOT(slotSaveFSResize(int)));
+ rFS->show();
+ rFS->raise();
+ } else {
+ new QTreeWidgetItem(treeMounts, QStringList() << tmp.setNum(mItems.size() + 1) << nMount );
+ }
+}
+
+void wizardDisk::slotSaveFSResize(int newSize)
+{
+
+ QString tmp, tmp2;
+ bool ok;
+ int oSize, availSize, tSize, newAvailSize;
+
+ // If adding a new mount point
+ if ( ! addingMount.isEmpty() ) {
+ QList<QTreeWidgetItem *> mItems = treeMounts->findItems("*", Qt::MatchWildcard);
+ new QTreeWidgetItem(treeMounts, QStringList() << tmp.setNum(mItems.size() + 1) << addingMount << tmp2.setNum(newSize) << "UFS+SUJ" );
+ addingMount="";
+ availSize = lineFreeMB->text().toInt(&ok);
+ newAvailSize = availSize - newSize;
+ lineFreeMB->setText(tmp.setNum(newAvailSize));
+ return;
+ }
+
+ if ( ! treeMounts->currentItem() )
+ return;
+
+ // Just resizing an existing partition
+ oSize = treeMounts->currentItem()->text(2).toInt(&ok);
+ treeMounts->currentItem()->setText(2, tmp.setNum(newSize));
+
+ // Set the available size
+ if ( oSize > newSize ) {
+ tSize = oSize - newSize;
+ availSize = lineFreeMB->text().toInt(&ok);
+ newAvailSize = availSize + tSize;
+ } else {
+ tSize = newSize - oSize;
+ availSize = lineFreeMB->text().toInt(&ok);
+ newAvailSize = availSize - tSize;
+ }
+ lineFreeMB->setText(tmp.setNum(newAvailSize));
+
+ // Check if we need to enable the add button
+ if ( newAvailSize >= 100 )
+ pushAddMount->setEnabled(true);
+ else
+ pushAddMount->setEnabled(false);
+}
+
+void wizardDisk::slotTreeMountsRightClick()
+{
+ if ( ! treeMounts->currentItem() )
+ return;
+
+ popup = new QMenu();
+ popup->setTitle(tr("Editing:") + " " + treeMounts->currentItem()->text(1));
+ popup->addSeparator();
+
+ if ( radioUFS->isChecked() ) {
+ // No options to change for /swap
+ if ( treeMounts->currentItem()->text(1) == "SWAP" )
+ return;
+ // May eventually add options for UFS file-systems here
+ return;
+ } else {
+ // No options to change for /swap
+ if ( treeMounts->currentItem()->text(1) == "/swap" )
+ return;
+
+ QString zCmp, zNoChk, zNoA, zNoExe;
+ if ( treeMounts->currentItem()->text(2).indexOf("compress") != -1 )
+ zCmp=tr("Disable compression");
+ else
+ zCmp=tr("Enable compression");
+ if ( treeMounts->currentItem()->text(2).indexOf("nochecksum") != -1 )
+ zNoChk=tr("Enable checksum");
+ else
+ zNoChk=tr("Disable checksum");
+ if ( treeMounts->currentItem()->text(2).indexOf("noatime") != -1 )
+ zNoA=tr("Enable atime");
+ else
+ zNoA=tr("Disable atime");
+ if ( treeMounts->currentItem()->text(2).indexOf("noexec") != -1 )
+ zNoExe=tr("Enable exec");
+ else
+ zNoExe=tr("Disable exec");
+
+ popup->addAction( zCmp, this, SLOT(slotZCmp()));
+ popup->addAction( zNoChk, this, SLOT(slotZChk()));
+ popup->addAction( zNoA, this, SLOT(slotZAtime()));
+ popup->addAction( zNoExe, this, SLOT(slotZExec()));
+ }
+ popup->exec( QCursor::pos() );
+
+}
+
+void wizardDisk::slotZCmp()
+{
+ toggleZFSOpt(QString("compress"));
+}
+
+void wizardDisk::slotZChk()
+{
+ toggleZFSOpt(QString("nochecksum"));
+}
+
+void wizardDisk::slotZAtime()
+{
+ toggleZFSOpt(QString("noatime"));
+}
+
+void wizardDisk::slotZExec()
+{
+ toggleZFSOpt(QString("noexec"));
+}
+
+// Toggle an option being on / off for ZFS
+void wizardDisk::toggleZFSOpt(QString option)
+{
+ if ( ! treeMounts->currentItem() )
+ return;
+
+ bool found = false;
+ QStringList newOpts;
+ QStringList curOpts = treeMounts->currentItem()->text(2).split("|");
+ for (int i=0; i < curOpts.count(); ++i) {
+ if ( option == curOpts.at(i) )
+ found = true;
+ else
+ if ( !curOpts.at(i).isEmpty() )
+ newOpts << curOpts.at(i);
+ }
+
+ if ( ! found )
+ newOpts << option;
+
+ if ( newOpts.count() <= 1)
+ treeMounts->currentItem()->setText(2, newOpts.join(""));
+ else
+ treeMounts->currentItem()->setText(2, newOpts.join("|"));
+}
+
+void wizardDisk::generateCustomDiskLayout()
+{
+ QString targetType, tmp;
+ int targetLoc;
+ QString targetDisk, targetSlice, tmpPass, fsType, target;
+
+ // Clear out the original disk layout
+ sysFinalDiskLayout.clear();
+ QStringList fileSystem;
+ qDebug() << "Generating custom disk layout";
+
+ if ( comboPartition->currentIndex() == 0) {
+ targetType = "DRIVE";
+ targetSlice = "ALL";
+ targetDisk = comboDisk->currentText();
+ targetDisk.truncate(targetDisk.indexOf(" -"));
+ target = targetDisk;
+ targetLoc = 1;
+ } else {
+ targetType = "SLICE";
+ targetDisk = comboDisk->currentText();
+ targetDisk.truncate(targetDisk.indexOf(" -"));
+ targetSlice = comboPartition->currentText();
+ targetSlice.truncate(targetSlice.indexOf(":"));
+ targetSlice = targetSlice.remove(0, targetSlice.size() -2);
+ target = targetDisk + targetSlice;
+ targetLoc = 2;
+ }
+
+ if (radioUFS->isChecked() )
+ {
+ // Start building the UFS file-systems
+ QList<QTreeWidgetItem *> mItems = treeMounts->findItems("*", Qt::MatchWildcard);
+ for ( int i = 0; i < mItems.size(); ++i) {
+ fileSystem.clear();
+ fsType=mItems.at(i)->text(3);
+ if ( fsType.indexOf(".eli") != -1 )
+ tmpPass=lineEncPW->text();
+ else
+ tmpPass="";
+
+ fileSystem << targetDisk << targetSlice << mItems.at(i)->text(1) << fsType << mItems.at(i)->text(2) << "" << tmpPass;
+ sysFinalDiskLayout << fileSystem;
+ }
+ } else {
+ // Start building the ZFS file-systems
+ QStringList zMnts;
+ int zpoolSize = getDiskSliceSize();
+
+ // Check if we need a UFS /boot for encryption
+ if ( groupEncryption->isChecked()) {
+ fileSystem << targetDisk << targetSlice << "/boot" << "UFS+SUJ" << "1028" << "" << "";
+ sysFinalDiskLayout << fileSystem;
+ zpoolSize = zpoolSize - 1028;
+ tmpPass=lineEncPW->text();
+ }
+
+ // Get the zfs mounts
+ QList<QTreeWidgetItem *> mItems = treeMounts->findItems("*", Qt::MatchWildcard);
+ for ( int i = 0; i < mItems.size(); ++i) {
+ if ( mItems.at(i)->text(2).isEmpty() )
+ zMnts << mItems.at(i)->text(1);
+ else
+ zMnts << mItems.at(i)->text(1) + "(" + mItems.at(i)->text(2) + ")";
+ }
+ fileSystem.clear();
+ fileSystem << targetDisk << targetSlice << zMnts.join(",") << "ZFS" << tmp.setNum(zpoolSize) << "" << tmpPass;
+ sysFinalDiskLayout << fileSystem;
+ }
+
+ qDebug() <<"AutoLayout:" << sysFinalDiskLayout;
+}
+
+void wizardDisk::generateConfirmationText()
+{
+ // If running in expert mode, we just create a simple config / confirmation
+ if ( radioExpert->isChecked() ) {
+ QStringList filesystem;
+ filesystem << "MANUAL" << "/mnt" ;
+ sysFinalDiskLayout << filesystem;
+ textConfirmation->setText(tr("Installing to file-system mounted at /mnt"));
+ return;
+ }
+
+ QList<QStringList> copyList;
+ QStringList summaryList;
+ QString tmp, workingDisk, workingSlice, tmpSlice, XtraTmp, startPart, sliceSize;
+ int disk = 0;
+
+ // Copy over the list to a new variable we can mangle without modifying the original
+ copyList = sysFinalDiskLayout;
+
+ // Start our summary
+ summaryList << "";
+ summaryList << "<b>" + tr("The disk will be setup with the following configuration:") + "</b>";
+
+ while ( ! copyList.empty() )
+ {
+ workingDisk = copyList.at(0).at(0);
+ workingSlice = copyList.at(0).at(1);
+ tmpSlice = workingSlice;
+
+ // Check if this is an install to "Unused Space"
+ for (int z=0; z < sysDisks.count(); ++z)
+ if ( sysDisks.at(z).at(0) == "SLICE" \
+ && sysDisks.at(z).at(2) == workingDisk + workingSlice \
+ && sysDisks.at(z).at(4) == "Unused Space" )
+ tmpSlice = "free";
+
+ // 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 )
+ {
+ summaryList << tr("Disk:") + copyList.at(i).at(0) + " " + tr("Mirroring:") + workingDisk;
+ copyList.removeAt(i);
+ break;
+ }
+ }
+
+ // If after doing the mirror, our list is empty, break out
+ if ( copyList.empty() )
+ break;
+
+ // If there is a dedicated /boot partition, need to list that first, see what is found
+ for (int i=0; i < copyList.count(); ++i) {
+ QStringList mounts = copyList.at(i).at(2).split(",");
+ for (int z = 0; z < mounts.size(); ++z) {
+ if ( copyList.at(i).at(0) == workingDisk \
+ && copyList.at(i).at(1) == workingSlice \
+ && mounts.at(z) == "/boot" )
+ startPart="/boot";
+ }
+ }
+
+ // If no dedicated /boot partition, then lets list "/" first
+ if(startPart.isEmpty())
+ startPart="/";
+
+ // Start by looking for the root partition
+ for (int i=0; i < copyList.count(); ++i) {
+ QStringList mounts = copyList.at(i).at(2).split(",");
+ for (int z = 0; z < mounts.size(); ++z) {
+ if ( copyList.at(i).at(0) == workingDisk \
+ && copyList.at(i).at(1) == workingSlice \
+ && mounts.at(z) == startPart ) {
+
+ // Check if we have any extra arguments to throw on the end
+ XtraTmp="";
+ if ( ! copyList.at(i).at(5).isEmpty() )
+ XtraTmp=" (" + copyList.at(i).at(5) + ")" ;
+
+ // Write the user summary
+ summaryList << "";
+ summaryList << tr("Partition:") + " " + workingDisk + "(" + workingSlice + "):";
+ summaryList << tr("FileSystem:") + " " + copyList.at(i).at(3);
+ summaryList << tr("Size:") + " " + copyList.at(i).at(4) + "MB ";
+ summaryList << tr("Mount:") + " " + 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" ) {
+
+ // Write the user summary
+ summaryList << "";
+ summaryList << tr("Partition:") + " " + workingDisk + "(" + workingSlice + "):";
+ summaryList << tr("FileSystem:") + " " + copyList.at(i).at(3);
+ summaryList << tr("Size:") + " " + copyList.at(i).at(4) + "MB ";
+
+ // 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 ) {
+
+ // Check if we have any extra arguments to throw on the end
+ XtraTmp="";
+ if ( ! copyList.at(i).at(5).isEmpty() )
+ XtraTmp=" (" + copyList.at(i).at(5) + ")" ;
+
+ // If we are working on the last partition, set the size to 0 to use remaining disk
+ if ( i == (count - 1) )
+ sliceSize = "0";
+ else
+ sliceSize=copyList.at(i).at(4);
+
+ // Write the user summary
+ summaryList << "";
+ summaryList << tr("Partition:") + " " + workingDisk + "(" + workingSlice + "):";
+ summaryList << tr("FileSystem:") + " " + copyList.at(i).at(3);
+ summaryList << tr("Size:") + " " + copyList.at(i).at(4) + "MB ";
+ summaryList << tr("Mount:") + " " + copyList.at(i).at(2);
+
+ // Done with this item, remove it now
+ copyList.removeAt(i);
+ i--;
+ count--;
+ }
+ }
+
+ // Increment our disk counter
+ disk++;
+ }
+
+ textConfirmation->setText(summaryList.join("<br>"));
+}
+
+void wizardDisk::slotTerminal()
+{
+ system("xterm &");
+}
Modified: users/kris/pc-installgui/wizardDisk.h
===================================================================
--- users/kris/pc-installgui/wizardDisk.h 2012-02-10 14:12:58 UTC (rev 15154)
+++ users/kris/pc-installgui/wizardDisk.h 2012-02-10 14:19:35 UTC (rev 15155)
@@ -2,8 +2,11 @@
#ifndef WIZDISK_H
#define WIZDISK_H
+#include <QMenu>
#include "ui_wizardDisk.h"
#include <qstring.h>
+#include "dialogFSSize.h"
+#include "backend.h"
class wizardDisk : public QWizard, private Ui::wizardDisk
{
@@ -16,8 +19,8 @@
}
void programInit();
+ virtual int nextId() const;
-
public slots:
protected:
@@ -26,12 +29,44 @@
virtual void accept();
void slotClose();
void slotCheckComplete();
+ void slotChangedDisk();
+ void slotTreeDiskChanged();
+ void slotResizeFS();
+ void slotRemoveFS();
+ void slotAddFS();
+ void slotSaveFSResize(int);
+ void slotTreeMountsRightClick();
+ void slotTerminal();
+
+ // QMenu slots
+ void slotZCmp();
+ void slotZChk();
+ void slotZAtime();
+ void slotZExec();
private:
+ void populateDiskInfo();
+ void populateDiskTree();
+ void generateDiskLayout();
+ void generateCustomDiskLayout();
+ void generateConfirmationText();
+ void toggleZFSOpt(QString);
bool validatePage();
- enum { Page_Intro, Page_BasicDisk, Page_BasicEnc, Page_FS, Page_Expert, Page_Confirmation };
+ bool checkDiskSpace();
+ int getDiskSliceSize();
+ int prevID;
+ int systemMemory;
+ QList<QStringList> sysDisks; // Our lists which contains disk info
+ QList<QStringList> sysPartitions; // Our lists which contains partition info
+ QList<QStringList> sysFinalDiskLayout; // The final disk layout
+ QString addingMount;
+ QMenu *popup;
+ dialogFSSize *rFS;
+ enum { Page_Intro, Page_BasicDisk, Page_BasicEnc, Page_FS, Page_Mounts, Page_Expert, Page_Confirmation };
+
signals:
+ void saved(QList<QStringList>, bool, bool);
} ;
#endif // WIZDISK_H
Modified: users/kris/pc-installgui/wizardDisk.ui
===================================================================
(Binary files differ)
Modified: users/kris/pc-installgui/wizardFreeBSD.cpp
===================================================================
--- users/kris/pc-installgui/wizardFreeBSD.cpp 2012-02-10 14:12:58 UTC (rev 15154)
+++ users/kris/pc-installgui/wizardFreeBSD.cpp 2012-02-10 14:19:35 UTC (rev 15155)
@@ -11,6 +11,7 @@
*****************************************************************************/
#include "wizardFreeBSD.h"
#include "ui_wizardFreeBSD.h"
+#include "backend.h"
void wizardFreeBSD::programInit()
{
@@ -23,8 +24,73 @@
connect(linePW,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckComplete()));
connect(linePW2,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckComplete()));
connect(lineHostname,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckComplete()));
+
+ // Load any nics
+ QString tmp;
+ comboSelectNic->clear();
+ comboSelectNic->addItem("AUTO-DHCP-SLAAC");
+ comboSelectNic->addItem("AUTO-DHCP");
+ comboSelectNic->addItem("IPv6-SLAAC");
+ QStringList sysNics = Scripts::Backend::networkDevices();
+ for (int i=0; i < sysNics.count(); ++i) {
+ tmp = sysNics.at(i);
+ tmp.truncate(35);
+ comboSelectNic->addItem(tmp);
+ }
+ connect(comboSelectNic,SIGNAL(currentIndexChanged(int)), this, SLOT(slotChangedNic()));
+ slotChangedNic();
}
+void wizardFreeBSD::slotChangedNic()
+{
+
+ /* The labels are always disabled. */
+ textIP->setEnabled(false);
+ textNetmask->setEnabled(false);
+ textDNS->setEnabled(false);
+ textDefaultRouter->setEnabled(false);
+ textIPv6->setEnabled(false);
+ textIPv6DefaultRouter->setEnabled(false);
+ textIPv6DNS->setEnabled(false);
+ if ( comboSelectNic->currentText() == "AUTO-DHCP" )
+ {
+ lineIP->setEnabled(false);
+ lineNetmask->setEnabled(false);
+ lineDNS->setEnabled(false);
+ lineDefaultRouter->setEnabled(false);
+ lineIPv6->setEnabled(false);
+ lineIPv6DefaultRouter->setEnabled(false);
+ lineIPv6DNS->setEnabled(false);
+ } else if ( comboSelectNic->currentText() == "IPv6-SLAAC" || comboSelectNic->currentText() == "AUTO-DHCP-SLAAC" ) {
+ lineIP->setEnabled(false);
+ lineNetmask->setEnabled(false);
+ lineDNS->setEnabled(false);
+ lineDefaultRouter->setEnabled(false);
+ lineIPv6->setEnabled(true);
+ lineIPv6DefaultRouter->setEnabled(true);
+ lineIPv6DNS->setEnabled(true);
+ textIPv6->setEnabled(true);
+ textIPv6DefaultRouter->setEnabled(true);
+ textIPv6DNS->setEnabled(true);
+ } else {
+ lineIP->setEnabled(true);
+ lineNetmask->setEnabled(true);
+ lineDNS->setEnabled(true);
+ lineDefaultRouter->setEnabled(true);
+ lineIPv6->setEnabled(true);
+ lineIPv6DefaultRouter->setEnabled(true);
+ lineIPv6DNS->setEnabled(true);
+ textIP->setEnabled(true);
+ textNetmask->setEnabled(true);
+ textDNS->setEnabled(true);
+ textDefaultRouter->setEnabled(true);
+ textIPv6->setEnabled(true);
+ textIPv6DefaultRouter->setEnabled(true);
+ textIPv6DNS->setEnabled(true);
+ }
+
+}
+
void wizardFreeBSD::slotClose()
{
close();
@@ -32,7 +98,16 @@
void wizardFreeBSD::accept()
{
- emit saved(lineRootPW->text(), lineName->text(), lineUsername->text(), linePW->text(), comboShell->currentText(), lineHostname->text(), checkSSH->isChecked(), checkSrc->isChecked(), checkPorts->isChecked());
+ QStringList netSettings;
+ netSettings << comboSelectNic->currentText() \
+ << lineIP->text() \
+ << lineNetmask->text() \
+ << lineDNS->text() \
+ << lineDefaultRouter->text() \
+ << lineIPv6->text() \
+ << lineIPv6DefaultRouter->text() \
+ << lineIPv6DNS->text();
+ emit saved(lineRootPW->text(), lineName->text(), lineUsername->text(), linePW->text(), comboShell->currentText(), lineHostname->text(), checkSSH->isChecked(), checkSrc->isChecked(), checkPorts->isChecked(), netSettings);
close();
}
Modified: users/kris/pc-installgui/wizardFreeBSD.h
===================================================================
--- users/kris/pc-installgui/wizardFreeBSD.h 2012-02-10 14:12:58 UTC (rev 15154)
+++ users/kris/pc-installgui/wizardFreeBSD.h 2012-02-10 14:19:35 UTC (rev 15155)
@@ -25,13 +25,14 @@
void slotClose();
void slotCheckComplete();
void slotSuggestUsername();
+ void slotChangedNic();
private:
bool validatePage();
enum { Page_Intro, Page_Root, Page_User, Page_Host, Page_Optional };
signals:
- void saved(QString, QString, QString, QString, QString, QString, bool, bool, bool);
+ void saved(QString, QString, QString, QString, QString, QString, bool, bool, bool, QStringList);
} ;
#endif // WIZARDFBSD_H
Modified: users/kris/pc-installgui/wizardFreeBSD.ui
===================================================================
(Binary files differ)
More information about the Commits
mailing list