|
|
@ -8,6 +8,8 @@
|
|
|
|
#include <QTextEdit>
|
|
|
|
#include <QTextEdit>
|
|
|
|
#include <QProgressBar>
|
|
|
|
#include <QProgressBar>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "calculateconfig.h"
|
|
|
|
|
|
|
|
|
|
|
|
PageInstall::PageInstall() :
|
|
|
|
PageInstall::PageInstall() :
|
|
|
|
InstallerPage(),
|
|
|
|
InstallerPage(),
|
|
|
|
m_clProc(0)
|
|
|
|
m_clProc(0)
|
|
|
@ -56,36 +58,22 @@ void PageInstall::show()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_clProc = new QProcess(this);
|
|
|
|
m_clProc = new QProcess(this);
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef NO_INSTALL
|
|
|
|
|
|
|
|
connect( m_clProc, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onError(QProcess::ProcessError)) );
|
|
|
|
connect( m_clProc, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onError(QProcess::ProcessError)) );
|
|
|
|
connect( m_clProc, SIGNAL(readyReadStandardOutput()), this, SLOT(showStdOut()) );
|
|
|
|
connect( m_clProc, SIGNAL(readyReadStandardOutput()), this, SLOT(showStdOut()) );
|
|
|
|
connect( m_clProc, SIGNAL(readyReadStandardError()), this, SLOT(showStdErr()) );
|
|
|
|
connect( m_clProc, SIGNAL(readyReadStandardError()), this, SLOT(showStdErr()) );
|
|
|
|
connect( m_clProc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(onFinish(int,QProcess::ExitStatus)) );
|
|
|
|
connect( m_clProc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(onFinish(int,QProcess::ExitStatus)) );
|
|
|
|
|
|
|
|
|
|
|
|
QStringList args;
|
|
|
|
QStringList args = CalculateConfig::instance()->getInstallParameters();
|
|
|
|
|
|
|
|
|
|
|
|
args << "--force";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_Settings->builder)
|
|
|
|
|
|
|
|
args << "--build";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
args << QString("--disk=%1").arg(m_Settings->disk);
|
|
|
|
qDebug() << "Start: cl-install ";
|
|
|
|
args << QString("--set-hostname=%1").arg(m_Settings->host);
|
|
|
|
|
|
|
|
args << QString("--set-format=%1").arg(m_Settings->fs);
|
|
|
|
|
|
|
|
args << QString("--set-lang=%1").arg(m_Settings->language);
|
|
|
|
|
|
|
|
args << QString("--set-timezone=%1").arg(m_Settings->timezone);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
args << QString("--set-erase=%1").arg( m_Settings->erase ? "yes" : "no" );
|
|
|
|
foreach(const QString& arg, args)
|
|
|
|
args << QString("--set-mbr=%1").arg( m_Settings->mbr ? "yes" : "no" );
|
|
|
|
qDebug() << arg;
|
|
|
|
args << QString("--set-uuid=%1").arg( m_Settings->uuid ? "yes" : "no" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
args << QString("--set-type=%1").arg( m_Settings->disktype );
|
|
|
|
m_clProc->setStandardErrorFile("/home/guest/cl-install-gui-err.log");
|
|
|
|
args << QString("--set-video_drv=%1").arg( m_Settings->videodrv );
|
|
|
|
//m_clProc->setStandardOutputFile("/home/guest/cl-install-gui-out.log");
|
|
|
|
|
|
|
|
|
|
|
|
m_clProc->start("calculate", args);
|
|
|
|
m_clProc->start( "cl-install -f --color never " + args.join(" ") );
|
|
|
|
#else
|
|
|
|
|
|
|
|
onFinish(0, QProcess::NormalExit);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -101,11 +89,11 @@ void PageInstall::showStdOut()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// debug
|
|
|
|
// debug
|
|
|
|
QString str = m_clProc->readAllStandardOutput();
|
|
|
|
QString str = m_clProc->readAllStandardOutput();
|
|
|
|
/*
|
|
|
|
|
|
|
|
QFile debug("/tmp/cl-install-gui_stdout.txt");
|
|
|
|
QFile debug("/tmp/cl-install-gui_stdout.txt");
|
|
|
|
if ( debug.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Unbuffered) )
|
|
|
|
if ( debug.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Unbuffered | QIODevice::Text) )
|
|
|
|
debug.write(str.toLocal8Bit());
|
|
|
|
debug.write(str.toLocal8Bit());
|
|
|
|
*/
|
|
|
|
|
|
|
|
m_Output->insertPlainText( str );
|
|
|
|
m_Output->insertPlainText( str );
|
|
|
|
m_Output->moveCursor(QTextCursor::EndOfBlock);
|
|
|
|
m_Output->moveCursor(QTextCursor::EndOfBlock);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -119,11 +107,11 @@ void PageInstall::showStdErr()
|
|
|
|
if (m_clProc)
|
|
|
|
if (m_clProc)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QString str = m_clProc->readAllStandardError();
|
|
|
|
QString str = m_clProc->readAllStandardError();
|
|
|
|
/*
|
|
|
|
|
|
|
|
QFile debug("/tmp/cl-install-gui_stderr.txt");
|
|
|
|
QFile debug("/tmp/cl-install-gui_stderr.txt");
|
|
|
|
if ( debug.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Unbuffered) )
|
|
|
|
if ( debug.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Unbuffered | QIODevice::Text) )
|
|
|
|
debug.write(str.toLocal8Bit());
|
|
|
|
debug.write(str.toLocal8Bit());
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
if ( str.contains("eta:") )
|
|
|
|
if ( str.contains("eta:") )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QRegExp eta_regexp("\\b(\\d{1,2}:\\d{1,2}:\\d{1,2})\\b");
|
|
|
|
QRegExp eta_regexp("\\b(\\d{1,2}:\\d{1,2}:\\d{1,2})\\b");
|
|
|
@ -141,13 +129,14 @@ void PageInstall::showStdErr()
|
|
|
|
if ( !progress.isEmpty() )
|
|
|
|
if ( !progress.isEmpty() )
|
|
|
|
m_Progress->setValue( progress.toInt() );
|
|
|
|
m_Progress->setValue( progress.toInt() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PageInstall::onFinish(int exitCode, QProcess::ExitStatus exitStatus)
|
|
|
|
void PageInstall::onFinish(int exitCode, QProcess::ExitStatus exitStatus)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
qDebug() << "install onFinish()";
|
|
|
|
qDebug() << "install onFinish() " << exitCode;
|
|
|
|
|
|
|
|
|
|
|
|
emit changeNext(true);
|
|
|
|
emit changeNext(true);
|
|
|
|
emit changePrev(true);
|
|
|
|
emit changePrev(true);
|
|
|
@ -157,6 +146,18 @@ void PageInstall::onFinish(int exitCode, QProcess::ExitStatus exitStatus)
|
|
|
|
// instalation complete
|
|
|
|
// instalation complete
|
|
|
|
emit changePrev(false);
|
|
|
|
emit changePrev(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_Output->insertPlainText("Error: ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString str = m_clProc->readAllStandardOutput();
|
|
|
|
|
|
|
|
QString strErr = m_clProc->readAllStandardError();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_Output->insertPlainText( str );
|
|
|
|
|
|
|
|
m_Output->moveCursor(QTextCursor::EndOfBlock);
|
|
|
|
|
|
|
|
m_Output->insertPlainText( strErr );
|
|
|
|
|
|
|
|
m_Output->moveCursor(QTextCursor::EndOfBlock);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_Progress->setValue(100);
|
|
|
|
m_Progress->setValue(100);
|
|
|
|
m_LabelEta->setText( tr("Eta: 0:00:00") );
|
|
|
|
m_LabelEta->setText( tr("Eta: 0:00:00") );
|
|
|
|