|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
#include "pagemountpoints.h"
|
|
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QTreeWidget>
|
|
|
|
|
#include <QToolButton>
|
|
|
|
|
#include <QTableWidget>
|
|
|
|
|
#include <QHeaderView>
|
|
|
|
|
#include <QBoxLayout>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
|
|
|
@ -14,27 +16,55 @@ PageMountPoints::PageMountPoints()
|
|
|
|
|
: InstallerPage()
|
|
|
|
|
{
|
|
|
|
|
setupUi();
|
|
|
|
|
|
|
|
|
|
initMountPoints();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageMountPoints::setupUi()
|
|
|
|
|
{
|
|
|
|
|
m_labMountPoints = new QLabel;
|
|
|
|
|
m_trwMountPoints = new QTreeWidget;
|
|
|
|
|
m_labMountPointHelp = new QLabel;
|
|
|
|
|
m_labMountPointHelp->setWordWrap(true);
|
|
|
|
|
|
|
|
|
|
m_butAddMountPoint = new QToolButton;
|
|
|
|
|
m_butDelMountPoint = new QToolButton;
|
|
|
|
|
QHBoxLayout* hbox_but = new QHBoxLayout;
|
|
|
|
|
hbox_but->addWidget(m_butAddMountPoint);
|
|
|
|
|
hbox_but->addWidget(m_butDelMountPoint);
|
|
|
|
|
hbox_but->addStretch();
|
|
|
|
|
|
|
|
|
|
m_tabMountPoints = new QTableWidget;
|
|
|
|
|
|
|
|
|
|
QVBoxLayout* vbox_0 = new QVBoxLayout;
|
|
|
|
|
vbox_0->addWidget(m_labMountPoints);
|
|
|
|
|
vbox_0->addWidget(m_trwMountPoints);
|
|
|
|
|
vbox_0->addWidget(m_labMountPointHelp);
|
|
|
|
|
vbox_0->addLayout(hbox_but);
|
|
|
|
|
vbox_0->addWidget(m_tabMountPoints);
|
|
|
|
|
|
|
|
|
|
setLayout(vbox_0);
|
|
|
|
|
|
|
|
|
|
connect( m_trwMountPoints, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
|
|
|
|
|
this, SLOT(partitionDoubleClicked(QTreeWidgetItem*,int))
|
|
|
|
|
m_tabMountPoints->setColumnCount(6);
|
|
|
|
|
QTableWidgetItem* tabMpItem0 = new QTableWidgetItem();
|
|
|
|
|
m_tabMountPoints->setHorizontalHeaderItem(0, tabMpItem0);
|
|
|
|
|
QTableWidgetItem* tabMpItem1 = new QTableWidgetItem();
|
|
|
|
|
m_tabMountPoints->setHorizontalHeaderItem(1, tabMpItem1);
|
|
|
|
|
QTableWidgetItem* tabMpItem2 = new QTableWidgetItem();
|
|
|
|
|
m_tabMountPoints->setHorizontalHeaderItem(2, tabMpItem2);
|
|
|
|
|
QTableWidgetItem* tabMpItem3 = new QTableWidgetItem();
|
|
|
|
|
m_tabMountPoints->setHorizontalHeaderItem(3, tabMpItem3);
|
|
|
|
|
QTableWidgetItem* tabMpItem4 = new QTableWidgetItem();
|
|
|
|
|
m_tabMountPoints->setHorizontalHeaderItem(4, tabMpItem4);
|
|
|
|
|
QTableWidgetItem* tabMpItem5 = new QTableWidgetItem();
|
|
|
|
|
m_tabMountPoints->setHorizontalHeaderItem(5, tabMpItem5);
|
|
|
|
|
|
|
|
|
|
m_tabMountPoints->horizontalHeader()->setStretchLastSection(true);
|
|
|
|
|
m_tabMountPoints->verticalHeader()->setVisible(false);
|
|
|
|
|
|
|
|
|
|
connect( m_tabMountPoints, SIGNAL(itemDoubleClicked(QTableWidgetItem*)),
|
|
|
|
|
this, SLOT(modifyMountPoint())
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
connect( m_butAddMountPoint, SIGNAL(clicked(bool)), this, SLOT(addMountPoint()) );
|
|
|
|
|
connect( m_butDelMountPoint, SIGNAL(clicked(bool)), this, SLOT(delMountPoint()) );
|
|
|
|
|
|
|
|
|
|
retranslateUi();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -42,35 +72,43 @@ void PageMountPoints::retranslateUi()
|
|
|
|
|
{
|
|
|
|
|
setTitle( tr("Mount points") );
|
|
|
|
|
|
|
|
|
|
QTreeWidgetItem* trwHeader = m_trwMountPoints->headerItem();
|
|
|
|
|
trwHeader->setText(0, tr("Partition") );
|
|
|
|
|
trwHeader->setText(1, tr("Label") );
|
|
|
|
|
trwHeader->setText(2, tr("Size") );
|
|
|
|
|
trwHeader->setText(3, tr("Mount point") );
|
|
|
|
|
trwHeader->setText(4, tr("File system") );
|
|
|
|
|
trwHeader->setText(5, tr("Format") );
|
|
|
|
|
|
|
|
|
|
m_labMountPoints->setText( tr("Select mount points:") );
|
|
|
|
|
m_butAddMountPoint->setText("+");
|
|
|
|
|
m_butDelMountPoint->setText("-");
|
|
|
|
|
|
|
|
|
|
QTableWidgetItem* tab0 = m_tabMountPoints->horizontalHeaderItem(0);
|
|
|
|
|
tab0->setText( tr("Mount point") );
|
|
|
|
|
QTableWidgetItem* tab1 = m_tabMountPoints->horizontalHeaderItem(1);
|
|
|
|
|
tab1->setText( tr("Partition") );
|
|
|
|
|
QTableWidgetItem* tab2 = m_tabMountPoints->horizontalHeaderItem(2);
|
|
|
|
|
tab2->setText( tr("Format") );
|
|
|
|
|
QTableWidgetItem* tab3 = m_tabMountPoints->horizontalHeaderItem(3);
|
|
|
|
|
tab3->setText( tr("File system") );
|
|
|
|
|
QTableWidgetItem* tab4 = m_tabMountPoints->horizontalHeaderItem(4);
|
|
|
|
|
tab4->setText( tr("Label") );
|
|
|
|
|
QTableWidgetItem* tab5 = m_tabMountPoints->horizontalHeaderItem(5);
|
|
|
|
|
tab5->setText( tr("Size") );
|
|
|
|
|
|
|
|
|
|
m_tabMountPoints->setSelectionMode(QTableWidget::SingleSelection);
|
|
|
|
|
m_tabMountPoints->setSelectionBehavior(QTableWidget::SelectRows);
|
|
|
|
|
|
|
|
|
|
m_labMountPointHelp->setText(
|
|
|
|
|
tr("Select the mount points use double click to partitions. "
|
|
|
|
|
"For continue must be set mount point for /")
|
|
|
|
|
tr("Choose mount points for the installation. "
|
|
|
|
|
"You need at least a root / partition.")
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageMountPoints::show()
|
|
|
|
|
{
|
|
|
|
|
// get tree from CalculateConfig
|
|
|
|
|
getTree();
|
|
|
|
|
showTree();
|
|
|
|
|
// get from CalculateConfig
|
|
|
|
|
showMountPoints();
|
|
|
|
|
|
|
|
|
|
m_trwMountPoints->setColumnWidth(0, 120);
|
|
|
|
|
m_trwMountPoints->setColumnWidth(1, 100);
|
|
|
|
|
m_trwMountPoints->setColumnWidth(2, 80);
|
|
|
|
|
m_trwMountPoints->setColumnWidth(3, 110);
|
|
|
|
|
m_trwMountPoints->setColumnWidth(4, 80);
|
|
|
|
|
m_tabMountPoints->setColumnWidth(0, 110);
|
|
|
|
|
m_tabMountPoints->setColumnWidth(1, 110);
|
|
|
|
|
m_tabMountPoints->setColumnWidth(2, 90);
|
|
|
|
|
m_tabMountPoints->setColumnWidth(3, 90);
|
|
|
|
|
m_tabMountPoints->setColumnWidth(4, 110);
|
|
|
|
|
|
|
|
|
|
m_trwMountPoints->setEnabled(true);
|
|
|
|
|
m_tabMountPoints->setEnabled(true);
|
|
|
|
|
CalculateConfig::instance()->showInstallParameters();
|
|
|
|
|
if ( CalculateConfig::instance()->getValue("gui_partitioning") == "auto" )
|
|
|
|
|
{
|
|
|
|
@ -79,7 +117,7 @@ void PageMountPoints::show()
|
|
|
|
|
tr("Information"),
|
|
|
|
|
tr("You select auto partitioning. Press \"Next\" to continue.")
|
|
|
|
|
);
|
|
|
|
|
m_trwMountPoints->setEnabled(false);
|
|
|
|
|
m_tabMountPoints->setEnabled(false);
|
|
|
|
|
emit changeNext(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -88,40 +126,327 @@ bool PageMountPoints::validate()
|
|
|
|
|
{
|
|
|
|
|
if ( CalculateConfig::instance()->getValue("gui_partitioning") != "auto" )
|
|
|
|
|
{
|
|
|
|
|
QStringList mountpoints;
|
|
|
|
|
// check parameters
|
|
|
|
|
MountPointsTree::ConstIterator it = m_treeMountPoints.constBegin();
|
|
|
|
|
foreach( const MountPoint& mp, m_MountPointsList )
|
|
|
|
|
{
|
|
|
|
|
if ( mp.dev.isEmpty() || mp.mountpoint.isEmpty() )
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while( it != m_treeMountPoints.constEnd() )
|
|
|
|
|
void PageMountPoints::addMountPoint()
|
|
|
|
|
{
|
|
|
|
|
// all partitions except selected
|
|
|
|
|
MountPointsMap partitions(m_Partitions);
|
|
|
|
|
foreach(const MountPoint& mp, m_MountPointsList)
|
|
|
|
|
{
|
|
|
|
|
if ( !mp.mountpoint.isEmpty() && !mp.dev.isEmpty() )
|
|
|
|
|
{
|
|
|
|
|
foreach(const MountPoint& mp, it.value())
|
|
|
|
|
partitions.remove(mp.dev);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QScopedPointer<MountPointDialog> mpDlg( new MountPointDialog(this, m_MountPointsList, partitions) );
|
|
|
|
|
|
|
|
|
|
if ( mpDlg->exec() == QDialog::Accepted )
|
|
|
|
|
{
|
|
|
|
|
MountPoint mp = mpDlg->getMountPoint();
|
|
|
|
|
m_MountPointsList.append(mp);
|
|
|
|
|
|
|
|
|
|
showMountPoints();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageMountPoints::delMountPoint()
|
|
|
|
|
{
|
|
|
|
|
int index = m_tabMountPoints->currentRow();
|
|
|
|
|
if (index != -1)
|
|
|
|
|
{
|
|
|
|
|
if (m_MountPointsList.at(index).mountpoint == "/" )
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::warning(this, tr("Warning"), tr("Root partition can't be deleted") );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_MountPointsList.at(index).migrated )
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::warning(
|
|
|
|
|
this,
|
|
|
|
|
tr("Warning"),
|
|
|
|
|
tr("Migrated mount point can't be deleted. Use 'none' for disabling migration.")
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_MountPointsList.removeAt(index);
|
|
|
|
|
showMountPoints();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageMountPoints::modifyMountPoint()
|
|
|
|
|
{
|
|
|
|
|
int index = m_tabMountPoints->currentRow();
|
|
|
|
|
if (index != -1)
|
|
|
|
|
{
|
|
|
|
|
MountPoint modMp = m_MountPointsList.at(index);
|
|
|
|
|
|
|
|
|
|
MountPointsMap partitions(m_Partitions);
|
|
|
|
|
foreach(const MountPoint& mp, m_MountPointsList)
|
|
|
|
|
{
|
|
|
|
|
if ( !mp.mountpoint.isEmpty() && !mp.dev.isEmpty() && (mp.dev != modMp.dev) )
|
|
|
|
|
{
|
|
|
|
|
if ( !mp.mountpoint.isEmpty() )
|
|
|
|
|
partitions.remove(mp.dev);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QScopedPointer<MountPointDialog> mpDlg(
|
|
|
|
|
new MountPointDialog(this, m_MountPointsList, partitions, modMp)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if ( mpDlg->exec() == QDialog::Accepted )
|
|
|
|
|
{
|
|
|
|
|
MountPoint mp = mpDlg->getMountPoint();
|
|
|
|
|
m_MountPointsList.removeAt(index);
|
|
|
|
|
m_MountPointsList.insert(index, mp);
|
|
|
|
|
|
|
|
|
|
showMountPoints();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageMountPoints::correctMountPoints()
|
|
|
|
|
{
|
|
|
|
|
// check use cl-install
|
|
|
|
|
CalculateConfig* clConf = CalculateConfig::instance();
|
|
|
|
|
|
|
|
|
|
clConf->getNewMountpoints();
|
|
|
|
|
QStringList os_disk_dev = clConf->getValue("os_disk_dev").toStringList();
|
|
|
|
|
|
|
|
|
|
QStringList os_install_disk_format = clConf->getValue("os_install_disk_format").toStringList();
|
|
|
|
|
QStringList perform_format = clConf->getValue("os_install_disk_perform_format").toStringList();
|
|
|
|
|
|
|
|
|
|
for (int i(0); i < os_disk_dev.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (perform_format.at(i) == "yes")
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "Format: " << os_disk_dev.at(i);
|
|
|
|
|
int index = -1;
|
|
|
|
|
for ( int j = 0; j != m_MountPointsList.size(); ++j)
|
|
|
|
|
{
|
|
|
|
|
if ( m_MountPointsList.at(j).dev == os_disk_dev.at(i) )
|
|
|
|
|
{
|
|
|
|
|
// check duplicates
|
|
|
|
|
if ( mountpoints.contains(mp.mountpoint) )
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::warning(this, tr("Warning"), tr("Duplicate mount point %1").arg(mp.mountpoint) );
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
mountpoints << mp.mountpoint;
|
|
|
|
|
index = j;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
++it;
|
|
|
|
|
if (index == -1)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
qDebug() << "Index: " << index;
|
|
|
|
|
|
|
|
|
|
MountPoint mp( m_MountPointsList.at(index) );
|
|
|
|
|
|
|
|
|
|
mp.format = true;
|
|
|
|
|
mp.fs_new = os_install_disk_format.at(i);
|
|
|
|
|
|
|
|
|
|
m_MountPointsList.removeAt(index);
|
|
|
|
|
m_MountPointsList.insert(index, mp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageMountPoints::showMountPoints()
|
|
|
|
|
{
|
|
|
|
|
// clear table
|
|
|
|
|
while( m_tabMountPoints->rowCount() )
|
|
|
|
|
m_tabMountPoints->removeRow(0);
|
|
|
|
|
m_tabMountPoints->repaint();
|
|
|
|
|
|
|
|
|
|
generateCmdDisk();
|
|
|
|
|
correctMountPoints();
|
|
|
|
|
|
|
|
|
|
foreach(const MountPoint& mp, m_MountPointsList)
|
|
|
|
|
{
|
|
|
|
|
int row = m_tabMountPoints->rowCount();
|
|
|
|
|
m_tabMountPoints->insertRow( row );
|
|
|
|
|
QTableWidgetItem* mpItem = new QTableWidgetItem(mp.mountpoint);
|
|
|
|
|
mpItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
|
|
|
m_tabMountPoints->setItem(row, 0, mpItem);
|
|
|
|
|
|
|
|
|
|
QTableWidgetItem* partItem = new QTableWidgetItem(mp.dev);
|
|
|
|
|
partItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
|
|
|
m_tabMountPoints->setItem(row, 1, partItem);
|
|
|
|
|
|
|
|
|
|
QTableWidgetItem* formatItem = new QTableWidgetItem(mp.format ? tr("YES") : tr("no") );
|
|
|
|
|
formatItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
|
|
|
m_tabMountPoints->setItem(row, 2, formatItem);
|
|
|
|
|
|
|
|
|
|
QTableWidgetItem* fsItem = new QTableWidgetItem(mp.format ? mp.fs_new : mp.fs);
|
|
|
|
|
fsItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
|
|
|
m_tabMountPoints->setItem(row, 3, fsItem);
|
|
|
|
|
|
|
|
|
|
QTableWidgetItem* labItem = new QTableWidgetItem(mp.label);
|
|
|
|
|
labItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
|
|
|
m_tabMountPoints->setItem(row, 4, labItem);
|
|
|
|
|
|
|
|
|
|
QTableWidgetItem* sizeItem = new QTableWidgetItem(mp.size);
|
|
|
|
|
sizeItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
|
|
|
m_tabMountPoints->setItem(row, 5, sizeItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
generateCmdDisk();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageMountPoints::getPartitions()
|
|
|
|
|
{
|
|
|
|
|
m_Partitions.clear();
|
|
|
|
|
|
|
|
|
|
CalculateConfig* clConf = CalculateConfig::instance();
|
|
|
|
|
|
|
|
|
|
QStringList os_disk_dev = clConf->getValue("os_disk_dev").toStringList();
|
|
|
|
|
QStringList os_disk_format = clConf->getValue("os_disk_format").toStringList();
|
|
|
|
|
QStringList os_disk_name = clConf->getValue("os_disk_name").toStringList();
|
|
|
|
|
QStringList os_disk_part = clConf->getValue("os_disk_part").toStringList();
|
|
|
|
|
QStringList os_disk_size = clConf->getValue("os_disk_size").toStringList();
|
|
|
|
|
|
|
|
|
|
QStringList os_disk_mount = clConf->getValue("os_disk_mount").toStringList();
|
|
|
|
|
|
|
|
|
|
QStringList perform_format = clConf->getValue("os_install_disk_perform_format").toStringList();
|
|
|
|
|
|
|
|
|
|
for (int i(0); i < os_disk_dev.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (
|
|
|
|
|
(os_disk_part.at(i) == "extended") || // skip extended partition
|
|
|
|
|
(os_disk_mount.at(i) == "/") // skip root
|
|
|
|
|
)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
MountPoint mp;
|
|
|
|
|
|
|
|
|
|
mp.dev = os_disk_dev.at(i);
|
|
|
|
|
mp.fs = os_disk_format.at(i);
|
|
|
|
|
mp.format = perform_format.at(i) == "yes";
|
|
|
|
|
mp.label = os_disk_name.at(i);
|
|
|
|
|
mp.size = os_disk_size.at(i);
|
|
|
|
|
|
|
|
|
|
m_Partitions[ os_disk_dev.at(i) ] = mp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageMountPoints::initMountPoints()
|
|
|
|
|
{
|
|
|
|
|
// create default mount point for root partition and migrated mount points
|
|
|
|
|
MountPoint root;
|
|
|
|
|
root.mountpoint = "/";
|
|
|
|
|
|
|
|
|
|
m_MountPointsList.append( root );
|
|
|
|
|
|
|
|
|
|
CalculateConfig* clConf = CalculateConfig::instance();
|
|
|
|
|
|
|
|
|
|
// check new format parameters
|
|
|
|
|
clConf->getNewMountpoints();
|
|
|
|
|
|
|
|
|
|
QStringList os_disk_dev = clConf->getValue("os_disk_dev").toStringList();
|
|
|
|
|
QStringList os_disk_format = clConf->getValue("os_disk_format").toStringList();
|
|
|
|
|
QStringList os_disk_name = clConf->getValue("os_disk_name").toStringList();
|
|
|
|
|
QStringList os_disk_part = clConf->getValue("os_disk_part").toStringList();
|
|
|
|
|
QStringList os_disk_size = clConf->getValue("os_disk_size").toStringList();
|
|
|
|
|
|
|
|
|
|
QStringList os_disk_mount = clConf->getValue("os_disk_mount").toStringList();
|
|
|
|
|
|
|
|
|
|
QStringList def_os_install_disk_mount = clConf->getValue("def_os_install_disk_mount").toStringList();
|
|
|
|
|
QStringList os_install_disk_format = clConf->getValue("os_install_disk_format").toStringList();
|
|
|
|
|
QStringList perform_format = clConf->getValue("os_install_disk_perform_format").toStringList();
|
|
|
|
|
|
|
|
|
|
for (int i(0); i < os_disk_dev.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (
|
|
|
|
|
(os_disk_part.at(i) == "extended") || // skip extended partition
|
|
|
|
|
(os_disk_mount.at(i) == "/") // skip root
|
|
|
|
|
)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if ( !def_os_install_disk_mount.at(i).isEmpty() )
|
|
|
|
|
{
|
|
|
|
|
MountPoint mp;
|
|
|
|
|
mp.mountpoint = def_os_install_disk_mount.at(i);
|
|
|
|
|
mp.dev = os_disk_dev.at(i);
|
|
|
|
|
mp.fs = os_disk_format.at(i);
|
|
|
|
|
mp.size = os_disk_size.at(i);
|
|
|
|
|
mp.label = os_disk_name.at(i);
|
|
|
|
|
mp.format = (perform_format.at(i) == "yes");
|
|
|
|
|
mp.fs_new = os_install_disk_format.at(i);
|
|
|
|
|
mp.migrated = true;
|
|
|
|
|
mp.migrated_dev = mp.dev;
|
|
|
|
|
|
|
|
|
|
m_MountPointsList.append(mp);
|
|
|
|
|
}
|
|
|
|
|
// check root-partition
|
|
|
|
|
if ( !mountpoints.contains("/") )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPartitions();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageMountPoints::generateCmdDisk()
|
|
|
|
|
{
|
|
|
|
|
if ( CalculateConfig::instance()->getValue("gui_partitioning") != "auto" )
|
|
|
|
|
{
|
|
|
|
|
QStringList diskCfg = parseMountPoint();
|
|
|
|
|
CalculateConfig::instance()->setValue( "--disk", diskCfg );
|
|
|
|
|
|
|
|
|
|
QString swapCfg = parseSwap();
|
|
|
|
|
CalculateConfig::instance()->setValue( "--swap", swapCfg );
|
|
|
|
|
}
|
|
|
|
|
CalculateConfig::instance()->showInstallParameters();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList PageMountPoints::parseMountPoint()
|
|
|
|
|
{
|
|
|
|
|
QStringList result;
|
|
|
|
|
|
|
|
|
|
foreach(const MountPoint& mp, m_MountPointsList)
|
|
|
|
|
{
|
|
|
|
|
if (mp.mountpoint.isEmpty() || mp.dev.isEmpty() || mp.mountpoint == "swap")
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (mp.migrated && (mp.dev == "none") )
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::warning(this, tr("Warning"), tr("Select mount point for /") );
|
|
|
|
|
return false;
|
|
|
|
|
result << mp.migrated_dev + ":none";
|
|
|
|
|
}
|
|
|
|
|
else if (mp.dev != mp.migrated_dev)
|
|
|
|
|
{
|
|
|
|
|
result << mp.dev + ":" + mp.mountpoint + (mp.format ? (":" + mp.fs_new) : "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString PageMountPoints::parseSwap()
|
|
|
|
|
{
|
|
|
|
|
QString result;
|
|
|
|
|
|
|
|
|
|
foreach(const MountPoint& mp, m_MountPointsList)
|
|
|
|
|
{
|
|
|
|
|
if (mp.mountpoint != "swap")
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (mp.migrated && (mp.dev == "none") )
|
|
|
|
|
{
|
|
|
|
|
return "none";
|
|
|
|
|
}
|
|
|
|
|
else if (mp.dev != mp.migrated_dev)
|
|
|
|
|
{
|
|
|
|
|
return mp.dev;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
void PageMountPoints::partitionDoubleClicked ( QTreeWidgetItem* item, int index )
|
|
|
|
|
{
|
|
|
|
|
// skip disks
|
|
|
|
@ -153,7 +478,7 @@ void PageMountPoints::partitionDoubleClicked ( QTreeWidgetItem* item, int index
|
|
|
|
|
{
|
|
|
|
|
MountPoint mp( mpList.at(mpIndex) );
|
|
|
|
|
|
|
|
|
|
QScopedPointer<MountPointDialog> mpDlg( new MountPointDialog(this, &mp) );
|
|
|
|
|
QScopedPointer<MountPointDialog> mpDlg( new MountPointDialog(this, getAllDefinedMountPoints(), &mp) );
|
|
|
|
|
|
|
|
|
|
if ( mpDlg->exec() == QDialog::Accepted )
|
|
|
|
|
{
|
|
|
|
@ -162,24 +487,64 @@ void PageMountPoints::partitionDoubleClicked ( QTreeWidgetItem* item, int index
|
|
|
|
|
m_treeMountPoints.remove(dev);
|
|
|
|
|
m_treeMountPoints[dev] = mpList;
|
|
|
|
|
|
|
|
|
|
//qDebug() << "All mountpoints:" << getAllDefinedMountPoints();
|
|
|
|
|
|
|
|
|
|
showTree();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList PageMountPoints::getAllDefinedMountPoints()
|
|
|
|
|
{
|
|
|
|
|
QStringList allMps;
|
|
|
|
|
|
|
|
|
|
MountPointsTree::ConstIterator it = m_treeMountPoints.constBegin();
|
|
|
|
|
while( it != m_treeMountPoints.constEnd() )
|
|
|
|
|
{
|
|
|
|
|
foreach(const MountPoint& mp, it.value() )
|
|
|
|
|
allMps << mp.mountpoint;
|
|
|
|
|
++it;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return allMps;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PageMountPoints::getTree()
|
|
|
|
|
{
|
|
|
|
|
CalculateConfig* clConf = CalculateConfig::instance();
|
|
|
|
|
|
|
|
|
|
// check new format parameters
|
|
|
|
|
clConf->getNewMountpoints();
|
|
|
|
|
|
|
|
|
|
// copy mountpoints
|
|
|
|
|
MountPointsTree copyTree(m_treeMountPoints);
|
|
|
|
|
|
|
|
|
|
m_treeMountPoints.clear();
|
|
|
|
|
|
|
|
|
|
QStringList os_disk_dev = CalculateConfig::instance()->getValue("os_disk_dev").toStringList();
|
|
|
|
|
QStringList os_disk_format = CalculateConfig::instance()->getValue("os_disk_format").toStringList();
|
|
|
|
|
QStringList os_disk_name = CalculateConfig::instance()->getValue("os_disk_name").toStringList();
|
|
|
|
|
QStringList os_disk_part = CalculateConfig::instance()->getValue("os_disk_part").toStringList();
|
|
|
|
|
QStringList os_disk_size = CalculateConfig::instance()->getValue("os_disk_size").toStringList();
|
|
|
|
|
QStringList os_disk_dev = clConf->getValue("os_disk_dev").toStringList();
|
|
|
|
|
QStringList os_disk_format = clConf->getValue("os_disk_format").toStringList();
|
|
|
|
|
QStringList os_disk_name = clConf->getValue("os_disk_name").toStringList();
|
|
|
|
|
QStringList os_disk_part = clConf->getValue("os_disk_part").toStringList();
|
|
|
|
|
QStringList os_disk_size = clConf->getValue("os_disk_size").toStringList();
|
|
|
|
|
|
|
|
|
|
QStringList os_disk_mount = clConf->getValue("os_disk_mount").toStringList();
|
|
|
|
|
|
|
|
|
|
QStringList def_os_install_disk_mount = clConf->getValue("def_os_install_disk_mount").toStringList();
|
|
|
|
|
QStringList os_install_disk_mount = clConf->getValue("os_install_disk_mount").toStringList();
|
|
|
|
|
QStringList os_install_disk_format = clConf->getValue("os_install_disk_format").toStringList();
|
|
|
|
|
QStringList os_install_disk_perform_format = clConf->getValue("os_install_disk_perform_format").toStringList();
|
|
|
|
|
|
|
|
|
|
qDebug() << "os_install_disk_mount = " << os_install_disk_mount.join(", ");
|
|
|
|
|
|
|
|
|
|
QStringList os_dev_dev = clConf->getValue("os_device_dev").toStringList();
|
|
|
|
|
|
|
|
|
|
qDebug() << "";
|
|
|
|
|
qDebug() << "Get three";
|
|
|
|
|
// qDebug() << "def_os_install_disk_mount: " << def_os_install_disk_mount.join(", ");
|
|
|
|
|
// qDebug() << "os_install_disk_mount" << os_install_disk_mount.join(", ");
|
|
|
|
|
// qDebug() << "os_install_disk_format" << os_install_disk_format.join(", ");
|
|
|
|
|
// qDebug() << "os_install_disk_perform_format" << os_install_disk_perform_format.join(", ");
|
|
|
|
|
|
|
|
|
|
QStringList os_dev_dev = CalculateConfig::instance()->getValue("os_device_dev").toStringList();
|
|
|
|
|
|
|
|
|
|
foreach(const QString& dev, os_dev_dev)
|
|
|
|
|
{
|
|
|
|
@ -188,8 +553,9 @@ void PageMountPoints::getTree()
|
|
|
|
|
MountPoint mountpoint;
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
(os_disk_part.at(i) != "extended") &&
|
|
|
|
|
(os_disk_dev.at(i).contains(dev, Qt::CaseInsensitive))
|
|
|
|
|
(os_disk_dev.at(i).contains(dev, Qt::CaseInsensitive)) &&
|
|
|
|
|
(os_disk_part.at(i) != "extended") && // skip extended partition
|
|
|
|
|
(os_disk_mount.at(i) != "/") // skip root
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
mountpoint.dev = os_disk_dev.at(i);
|
|
|
|
@ -199,8 +565,16 @@ void PageMountPoints::getTree()
|
|
|
|
|
|
|
|
|
|
if ( m_treeMountPoints.contains(dev) )
|
|
|
|
|
{
|
|
|
|
|
// migrated mp
|
|
|
|
|
if ( !def_os_install_disk_mount.at(i).isEmpty() )
|
|
|
|
|
{
|
|
|
|
|
mountpoint.migrated_mountpoint = def_os_install_disk_mount.at(i);
|
|
|
|
|
mountpoint.skipped = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (copyTree.contains(dev))
|
|
|
|
|
{
|
|
|
|
|
// check
|
|
|
|
|
foreach(MountPoint mp, copyTree[dev])
|
|
|
|
|
{
|
|
|
|
|
if (mp.dev == mountpoint.dev)
|
|
|
|
@ -212,6 +586,18 @@ void PageMountPoints::getTree()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mountpoint.mountpoint.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
if ( !mountpoint.migrated_mountpoint.isEmpty() && !mountpoint.skipped )
|
|
|
|
|
mountpoint.mountpoint = mountpoint.migrated_mountpoint;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (os_install_disk_perform_format.at(i) == "yes")
|
|
|
|
|
{
|
|
|
|
|
mountpoint.format = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_treeMountPoints[dev] << mountpoint;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -226,6 +612,10 @@ void PageMountPoints::getTree()
|
|
|
|
|
|
|
|
|
|
void PageMountPoints::showTree()
|
|
|
|
|
{
|
|
|
|
|
generateCmdDisk();
|
|
|
|
|
|
|
|
|
|
getTree();
|
|
|
|
|
|
|
|
|
|
m_trwMountPoints->clear();
|
|
|
|
|
|
|
|
|
|
MountPointsTree::ConstIterator it = m_treeMountPoints.constBegin();
|
|
|
|
@ -283,12 +673,11 @@ QStringList PageMountPoints::parseMountPoint()
|
|
|
|
|
QStringList result;
|
|
|
|
|
|
|
|
|
|
MountPointsTree::ConstIterator it = m_treeMountPoints.constBegin();
|
|
|
|
|
|
|
|
|
|
while( it != m_treeMountPoints.constEnd() )
|
|
|
|
|
{
|
|
|
|
|
foreach(const MountPoint& mp, it.value())
|
|
|
|
|
{
|
|
|
|
|
if ( !mp.mountpoint.isEmpty() && (mp.fs_new != "swap") )
|
|
|
|
|
if ( !mp.mountpoint.isEmpty() && (mp.mountpoint != mp.migrated_mountpoint) && (mp.mountpoint != "swap") )
|
|
|
|
|
{
|
|
|
|
|
QString resultStr = mp.dev + ":" + mp.mountpoint;
|
|
|
|
|
if (mp.format && !mp.fs_new.isEmpty())
|
|
|
|
@ -297,6 +686,10 @@ QStringList PageMountPoints::parseMountPoint()
|
|
|
|
|
|
|
|
|
|
result << resultStr;
|
|
|
|
|
}
|
|
|
|
|
else if ( mp.mountpoint.isEmpty() && !mp.migrated_mountpoint.isEmpty() && !mp.skipped )
|
|
|
|
|
{
|
|
|
|
|
result << (mp.dev + ":none");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
++it;
|
|
|
|
|
}
|
|
|
|
@ -314,7 +707,10 @@ QString PageMountPoints::parseSwap()
|
|
|
|
|
{
|
|
|
|
|
foreach(const MountPoint& mp, it.value())
|
|
|
|
|
{
|
|
|
|
|
if ( mp.fs_new == "swap" )
|
|
|
|
|
if ( isMigratedMountPoint(mp.dev, mp.mountpoint) )
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if ( mp.mountpoint == "swap" )
|
|
|
|
|
return mp.dev;
|
|
|
|
|
}
|
|
|
|
|
++it;
|
|
|
|
@ -322,3 +718,18 @@ QString PageMountPoints::parseSwap()
|
|
|
|
|
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PageMountPoints::isMigratedMountPoint ( const QString& dev, const QString& mp )
|
|
|
|
|
{
|
|
|
|
|
CalculateConfig* clConf = CalculateConfig::instance();
|
|
|
|
|
QStringList os_disk_dev = clConf->getValue ( "os_disk_dev" ).toStringList();
|
|
|
|
|
QStringList os_install_disk_mount = clConf->getValue ( "os_install_disk_mount" ).toStringList();
|
|
|
|
|
|
|
|
|
|
int partIndx = os_disk_dev.indexOf ( dev );
|
|
|
|
|
|
|
|
|
|
if ( ( partIndx != -1 ) && ( os_install_disk_mount.at ( partIndx ) == mp ) )
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|