SVN: PLDLiveInstaller/trunk: PLDLiveInstaller.cpp PLDLiveInstaller.h
shadzik
shadzik at pld-linux.org
Thu Jan 20 15:13:37 CET 2011
Author: shadzik
Date: Thu Jan 20 15:13:37 2011
New Revision: 12066
Modified:
PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
PLDLiveInstaller/trunk/PLDLiveInstaller.h
Log:
- simplify procedures, no need to pass Solid::Devices and then turn them to QString, we can pass QString all along
- add addition debug info about (u)mounted partitions
Modified: PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
==============================================================================
--- PLDLiveInstaller/trunk/PLDLiveInstaller.cpp (original)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.cpp Thu Jan 20 15:13:37 2011
@@ -1135,20 +1135,20 @@
return 2; // other, maybe it's a swap space?
}
-bool PLDLiveInstaller::mountDev(Solid::Device partition)
+bool PLDLiveInstaller::mountDev(QString partition)
{
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents,-1);
installationText->setText("<html><p align=\"left\">"
"Mounting the device"
"</p></html>");
- qDebug() << "Mounting";
+ qDebug() << "Mounting" << partition;
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents,-1);
QStringList args;
QDir destDir;
destDir.setPath(DESTINATION);
if (!destDir.exists())
destDir.mkdir(destDir.absolutePath());
- args.append(partition.as<Solid::Block>()->device());
+ args.append(partition);
args.append(destDir.absolutePath());
qDebug() << "dest dir" << destDir.absolutePath();
QProcess * proc = new QProcess(this);
@@ -1159,16 +1159,16 @@
return proc->exitCode() == 0;
}
-bool PLDLiveInstaller::umountDev(Solid::Device partition)
+bool PLDLiveInstaller::umountDev(QString partition)
{
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents,-1);
installationText->setText("<html><p align=\"left\">"
"Unmounting the device"
"</p></html>");
- qDebug() << "Umounting";
+ qDebug() << "Umounting" << partition;
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents,-1);
QStringList args;
- args.append(partition.as<Solid::Block>()->device());
+ args.append(partition);
QProcess * proc = new QProcess(this);
proc->start("umount", args);
proc->waitForFinished(-1);
@@ -1177,7 +1177,7 @@
return proc->exitCode() == 0;
}
-bool PLDLiveInstaller::makeFS(Solid::Device partition)
+bool PLDLiveInstaller::makeFS(QString partition)
{
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents,-1);
installationText->setText("<html><p align=\"left\">"
@@ -1187,7 +1187,7 @@
QStringList args;
args.append("-t");
args.append(selFS);
- args.append(partition.as<Solid::Block>()->device());
+ args.append(partition);
QProcess * proc = new QProcess(this);
proc->start("mkfs", args);
/*while(proc->waitForReadyRead())
@@ -1200,7 +1200,7 @@
return proc->exitCode() == 0;
}
-bool PLDLiveInstaller::makeSwap(Solid::Device partition)
+bool PLDLiveInstaller::makeSwap(QString partition)
{
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents,-1);
installationText->setText("<html><p align=\"left\">"
@@ -1208,7 +1208,7 @@
"</p></html>");
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
QStringList args;
- args.append(partition.as<Solid::Block>()->device());
+ args.append(partition);
qDebug() << args;
QProcess * proc = new QProcess(this);
proc->start("mkswap", args);
@@ -1726,24 +1726,23 @@
foreach (Solid::Device partDev, Solid::Device::listFromType(Solid::DeviceInterface::Block, selectedBlockDev.udi() ))
{
if(isMounted(partDev))
- umountDev(partDev);
+ umountDev(partDev.as<Solid::Block>()->device());
}
qDebug() << "starting partitioning";
installBootLoader = false;
selFS="ext4";
doFormat=true;
- Solid::Device partitions[2];
- int i = 0;
+ QStringList partitions;
QString tmpDev = selectedBlockDev.as<Solid::Block>()->device();
destroyPartitionTable(tmpDev);
createPartitionTable(tmpDev);
sleep(3);
foreach (Solid::Device partDev, Solid::Device::listFromType(Solid::DeviceInterface::Block, selectedBlockDev.udi() ))
{
- partitions[i++]=partDev;
+ partitions.append(partDev.as<Solid::Block>()->device());
}
- destPartition=partitions[0];
- destSwap=partitions[1];
+ selRoot=partitions.at(0);
+ selSwap=partitions.at(1);
swapPartPos=1; // set to anything
}
@@ -1751,11 +1750,11 @@
{
qDebug() << "IsMounted:" << isMounted(destPartition);
if(isMounted(destPartition))
- umountDev(destPartition);
+ umountDev(selRoot);
}
if(doFormat) {
- if(cont && !makeFS(destPartition)) {
+ if(cont && !makeFS(selRoot)) {
cont = false;
failText->setText("<html><p align=\"center\">"
"Creating file system failed.<br/><br/>"
@@ -1770,7 +1769,7 @@
if(cont) {
qDebug() << "trying to create swap";
- if(swapPartPos!=0 && !makeSwap(destSwap)) {
+ if(swapPartPos!=0 && !makeSwap(selSwap)) {
cont = false;
failText->setText("<html><p align=\"center\">"
"Creating swap space failed.<br/><br/>"
@@ -1784,7 +1783,7 @@
};
if (cont) {
- mountDev(destPartition);
+ mountDev(selRoot);
getData(SOURCE,DESTINATION);
}
@@ -1954,7 +1953,7 @@
KAssistantDialog::next();
KAssistantDialog::showButtonSeparator(false);
}
- umountDev(destPartition);
+ umountDev(selRoot);
setAppropriate(failedPage,false);
setAppropriate(finishPage,true);
KAssistantDialog::setValid(installingPage,true);
Modified: PLDLiveInstaller/trunk/PLDLiveInstaller.h
==============================================================================
--- PLDLiveInstaller/trunk/PLDLiveInstaller.h (original)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.h Thu Jan 20 15:13:37 2011
@@ -59,10 +59,10 @@
QLabel *defHDDimage, *HDDimage, *partImage, *partDescr;
QString selFS, selUser, selPasswd, selHostname, failReason, selRoot, selSwap, selCred;
int isMounted(Solid::Device partition);
- bool mountDev(Solid::Device partition), umountDev(Solid::Device partition);
+ bool mountDev(QString partition), umountDev(QString partition);
bool copyData(QString src,QString dest);
void getData(QString src, QString dest);
- bool makeFS(Solid::Device partition), makeSwap(Solid::Device partition);
+ bool makeFS(QString partition), makeSwap(QString partition);
void updateProgressBar();
char * genPasswd();
bool makeGrubConfig(), installGrub(), geninitrd(), mountProcSysDev(), umountProcSysDev();
More information about the pld-cvs-commit
mailing list