Browse files

Update installer GUI

* Allow user to specify a SWAP size
* Allow user to enable / disable stamping GRUB
  • Loading branch information...
1 parent b482789 commit 0ece806f2f6096b2c6bdb28dc106714db16c7032 @kmoore134 kmoore134 committed Aug 13, 2013
View
30 src-qt4/pc-installgui/installer.cpp
@@ -192,7 +192,7 @@ void Installer::loadDiskInfo()
bool Installer::autoGenPartitionLayout(QString target, bool isDisk)
{
QString targetType, tmp;
- int targetLoc, totalSize = 0, mntsize;
+ int targetLoc, totalSize = 0, mntsize, swapsize;
QString targetDisk, targetSlice, tmpPass, fsType;
bool ok;
ok = false;
@@ -227,6 +227,15 @@ bool Installer::autoGenPartitionLayout(QString target, bool isDisk)
// Give us a small buffer for rounding errors
totalSize = totalSize - 10;
+ // Setup some swap space
+ if ( totalSize > 30000 ) {
+ // 2GB if over 30GB of disk space, 512MB otherwise
+ swapsize = 2048;
+ } else {
+ swapsize = 512;
+ }
+ totalSize = totalSize - swapsize;
+
// We got a valid size for this disk / slice, lets generate the layout now
if( !ok )
return false;
@@ -237,9 +246,15 @@ bool Installer::autoGenPartitionLayout(QString target, bool isDisk)
// Add the main zfs pool with standard partitions
fsType= "ZFS";
fileSystem << targetDisk << targetSlice << "/,/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();
+
+ // Now add swap space
+ fileSystem << targetDisk << targetSlice << "SWAP" << "SWAP" << tmp.setNum(swapsize) << "" << "";
+ sysFinalDiskLayout << fileSystem;
+ fileSystem.clear();
+
+ //qDebug() << "Auto-Gen FS:" << fileSystem;
return true;
}
@@ -261,16 +276,7 @@ bool Installer::autoGenPartitionLayout(QString target, bool isDisk)
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) << "" << "";
+ fileSystem << targetDisk << targetSlice << "SWAP" << "SWAP" << tmp.setNum(swapsize) << "" << "";
totalSize = totalSize - mntsize;
//qDebug() << "Auto-Gen FS:" << fileSystem;
sysFinalDiskLayout << fileSystem;
View
62 src-qt4/pc-installgui/wizardDisk.cpp
@@ -22,7 +22,7 @@ void wizardDisk::programInit()
populateDiskInfo();
//connect(pushClose, SIGNAL(clicked()), this, SLOT(slotClose()));
- connect(pushSizeMount, SIGNAL(clicked()), this, SLOT(slotResizeFS()));
+ connect(pushSwapSize, SIGNAL(clicked()), this, SLOT(slotSwapSize()));
connect(pushRemoveMount, SIGNAL(clicked()), this, SLOT(slotRemoveFS()));
connect(pushAddMount, SIGNAL(clicked()), this, SLOT(slotAddFS()));
connect(this,SIGNAL(currentIdChanged(int)),this,SLOT(slotCheckComplete()));
@@ -95,12 +95,16 @@ void wizardDisk::slotClose()
void wizardDisk::accept()
{
+ bool useGRUB = true;
bool useGPT = false;
bool force4K = false;
QString zpoolName;
if (comboPartition->currentIndex() == 0 )
useGPT = checkGPT->isChecked();
+ // Are we installing GRUB?
+ useGRUB = checkGRUB->isChecked();
+
// When doing advanced ZFS setups, make sure to use GPT
if ( radioAdvanced->isChecked() && groupZFSOpts->isChecked() )
useGPT = true;
@@ -115,7 +119,7 @@ void wizardDisk::accept()
if ( radioExpert->isChecked() )
emit saved(sysFinalDiskLayout, false, false, zpoolName, force4K);
else
- emit saved(sysFinalDiskLayout, true, useGPT, zpoolName, force4K);
+ emit saved(sysFinalDiskLayout, useGRUB, useGPT, zpoolName, force4K);
close();
}
@@ -127,11 +131,13 @@ int wizardDisk::nextId() const
return Page_Expert;
if (radioBasic->isChecked()) {
checkGPT->setVisible(false);
+ checkGRUB->setVisible(false);
checkForce4K->setVisible(false);
groupZFSPool->setVisible(false);
}
if (radioAdvanced->isChecked()) {
checkGPT->setVisible(true);
+ checkGRUB->setVisible(true);
checkForce4K->setVisible(true);
groupZFSPool->setVisible(true);
}
@@ -374,18 +380,35 @@ void wizardDisk::generateDiskLayout()
target = targetDisk + targetSlice;
targetLoc = 2;
}
-
+ // Get the size of the slice we are working on
totalSize = getDiskSliceSize();
+
+ // Setup some swap space
+ if ( totalSize > 30000 ) {
+ // 2GB if over 30GB of disk space, 512MB otherwise
+ swapsize = 2000;
+ } else {
+ swapsize = 512;
+ }
+ totalSize = totalSize - swapsize;
+
+
if ( totalSize != -1 )
{
fsType= "ZFS";
// This lets the user do nifty stuff like a mirror/raid post-install with a single zpool command
fileSystem << targetDisk << targetSlice << "/,/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) << "" << tmpPass;
- //qDebug() << "Auto-Gen FS:" << fileSystem;
- sysFinalDiskLayout << fileSystem;
- fileSystem.clear();
+ sysFinalDiskLayout << fileSystem;
+ fileSystem.clear();
+
+ // Now add swap space
+ fileSystem << targetDisk << targetSlice << "SWAP" << "SWAP" << tmp.setNum(swapsize) << "" << "";
+ sysFinalDiskLayout << fileSystem;
+ fileSystem.clear();
+
+ //qDebug() << "Auto-Gen FS:" << fileSystem;
}
qDebug() << "AutoLayout:" << sysFinalDiskLayout;
@@ -401,7 +424,6 @@ void wizardDisk::populateDiskTree()
treeMounts->setColumnCount(3);
labelFreeSpace->setVisible(false);
lineFreeMB->setVisible(false);
- pushSizeMount->setVisible(false);
treeMounts->header()->setSectionHidden(0, true);
treeMounts->header()->setDefaultSectionSize(150);
@@ -471,7 +493,6 @@ void wizardDisk::slotTreeDiskChanged()
pushRemoveMount->setEnabled(true);
pushAddMount->setEnabled(true);
- pushSizeMount->setEnabled(true);
if ( treeMounts->currentItem()->text(1) == "/boot" || treeMounts->currentItem()->text(1) == "/")
pushRemoveMount->setEnabled(false);
@@ -614,13 +635,6 @@ void wizardDisk::slotTreeMountsRightClick()
popup->setTitle(tr("Editing:") + " " + treeMounts->currentItem()->text(1));
popup->addSeparator();
- // No options to change for /swap
- if ( treeMounts->currentItem()->text(1) == "/swap" ) {
- popup->addAction( "Change size", this, SLOT(slotZSwapSize()));
- popup->exec( QCursor::pos() );
- return;
- }
-
// Create atime sub-menu
popupAT = popup->addMenu("atime");
popupAT->addAction( "on", this, SLOT(slotZATON()));
@@ -737,19 +751,14 @@ void wizardDisk::slotZATON()
toggleZFSOpt(QString("atime=on"));
}
-void wizardDisk::slotZSwapSize()
+void wizardDisk::slotSwapSize()
{
bool ok;
QString tmp;
int size = QInputDialog::getInt(this, tr("Enter SWAP size"),
- tr("Size (MB)"), 2048, 0, 1000000, 1, &ok);
+ tr("Size (MB)"), swapsize, 0, 1000000, 1, &ok);
if ( ok )
- {
- tmp.setNum(size);
- QString optString = "volsize=" + tmp + "M|org.freebsd:swap=on|checksum=off";
- treeMounts->currentItem()->setText(2, optString);
- treeMounts->currentItem()->setToolTip(2, optString);
- }
+ swapsize = size;
}
void wizardDisk::slotZATOFF()
@@ -838,6 +847,9 @@ void wizardDisk::generateCustomDiskLayout()
fsType = "ZFS";
int zpoolSize = getDiskSliceSize();
+ // Deduct any swap space
+ zpoolSize = zpoolSize - swapsize;
+
// Get the zfs mounts
QList<QTreeWidgetItem *> mItems = treeMounts->findItems("*", Qt::MatchWildcard);
for ( int i = 0; i < mItems.size(); ++i) {
@@ -864,6 +876,10 @@ void wizardDisk::generateCustomDiskLayout()
fileSystem << targetDisk << targetSlice << zMnts.join(",") << fsType << tmp.setNum(zpoolSize) << zOpts << tmpPass;
sysFinalDiskLayout << fileSystem;
+ fileSystem.clear();
+ fileSystem << targetDisk << targetSlice << "SWAP" << "SWAP" << tmp.setNum(swapsize) << "" << "";
+ sysFinalDiskLayout << fileSystem;
+
qDebug() <<"AutoLayout:" << sysFinalDiskLayout;
}
View
3 src-qt4/pc-installgui/wizardDisk.h
@@ -37,6 +37,7 @@ private slots:
void slotSaveFSResize(int);
void slotTreeMountsRightClick();
void slotTerminal();
+ void slotSwapSize();
// QMenu slots
void slotZCMON();
@@ -57,7 +58,6 @@ private slots:
void slotZATOFF();
void slotZEXON();
void slotZEXOFF();
- void slotZSwapSize();
private:
void populateDiskInfo();
@@ -72,6 +72,7 @@ private slots:
int getDiskSliceSize();
int prevID;
int systemMemory;
+ int swapsize;
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
View
280 src-qt4/pc-installgui/wizardDisk.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>608</width>
- <height>359</height>
+ <width>628</width>
+ <height>385</height>
</rect>
</property>
<property name="windowTitle">
@@ -190,70 +190,74 @@
</widget>
<widget class="QWizardPage" name="Page_BasicDisk">
<layout class="QGridLayout" name="gridLayout_11">
- <item row="1" column="2" rowspan="8">
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>17</width>
- <height>256</height>
- </size>
- </property>
- </spacer>
+ <item row="3" column="1">
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QComboBox" name="comboDisk">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="label_5">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Selected Disk</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QComboBox" name="comboPartition">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_6">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Selected Partition</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="2" column="1">
- <spacer name="verticalSpacer_4">
+ <item row="10" column="1">
+ <spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
<property name="sizeHint" stdset="0">
<size>
<width>387</width>
- <height>18</height>
+ <height>43</height>
</size>
</property>
</spacer>
</item>
- <item row="7" column="1">
- <widget class="QGroupBox" name="groupZFSPool">
- <property name="font">
- <font>
- <weight>50</weight>
- <bold>false</bold>
- </font>
- </property>
- <property name="title">
- <string>ZFS pool name</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
+ <item row="6" column="1">
+ <widget class="QCheckBox" name="checkForce4K">
+ <property name="text">
+ <string>Force ZFS 4K block size</string>
</property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <widget class="QLineEdit" name="lineZpoolName">
- <property name="inputMask">
- <string/>
- </property>
- <property name="maxLength">
- <number>32767</number>
- </property>
- <property name="placeholderText">
- <string notr="true">tank</string>
- </property>
- </widget>
- </item>
- </layout>
</widget>
</item>
<item row="1" column="1">
@@ -288,7 +292,20 @@
</property>
</spacer>
</item>
- <item row="0" column="0" rowspan="9">
+ <item row="4" column="1">
+ <spacer name="verticalSpacer_17">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="0" rowspan="11">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label_3">
@@ -333,93 +350,86 @@
</item>
</layout>
</item>
- <item row="4" column="1">
- <spacer name="verticalSpacer_17">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
<item row="5" column="1">
<widget class="QCheckBox" name="checkGPT">
<property name="text">
<string>Partition disk with GPT</string>
</property>
</widget>
</item>
- <item row="3" column="1">
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <widget class="QComboBox" name="comboDisk">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_5">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Selected Disk</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QComboBox" name="comboPartition">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="label_6">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Selected Partition</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
<item row="8" column="1">
- <spacer name="verticalSpacer_6">
+ <widget class="QGroupBox" name="groupZFSPool">
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="title">
+ <string>ZFS pool name</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0">
+ <widget class="QLineEdit" name="lineZpoolName">
+ <property name="inputMask">
+ <string/>
+ </property>
+ <property name="maxLength">
+ <number>32767</number>
+ </property>
+ <property name="placeholderText">
+ <string notr="true">tank</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
<property name="sizeHint" stdset="0">
<size>
<width>387</width>
- <height>43</height>
+ <height>18</height>
</size>
</property>
</spacer>
</item>
- <item row="6" column="1">
- <widget class="QCheckBox" name="checkForce4K">
+ <item row="1" column="2" rowspan="10">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>17</width>
+ <height>256</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="7" column="1">
+ <widget class="QCheckBox" name="checkGRUB">
<property name="text">
- <string>Force ZFS 4K block size</string>
+ <string>Install GRUB boot-loader (Required for Boot-Environment support)</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
@@ -730,7 +740,18 @@
<item>
<widget class="QLabel" name="labelFreeSpace">
<property name="text">
- <string>Free Space (MB)</string>
+ <string>(MB)</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushSwapSize">
+ <property name="text">
+ <string>Swap Size</string>
+ </property>
+ <property name="icon">
+ <iconset resource="sysinstaller.qrc">
+ <normaloff>:/modules/images/slices.png</normaloff>:/modules/images/slices.png</iconset>
</property>
</widget>
</item>
@@ -759,17 +780,6 @@
</widget>
</item>
<item>
- <widget class="QPushButton" name="pushSizeMount">
- <property name="text">
- <string>Resize</string>
- </property>
- <property name="icon">
- <iconset resource="sysinstaller.qrc">
- <normaloff>:/modules/images/disk.png</normaloff>:/modules/images/disk.png</iconset>
- </property>
- </widget>
- </item>
- <item>
<widget class="QPushButton" name="pushRemoveMount">
<property name="text">
<string>&amp;Remove</string>

0 comments on commit 0ece806

Please sign in to comment.