[PC-BSD Commits] r5599 - pcbsd/trunk/SysInstaller

svn at pcbsd.org svn at pcbsd.org
Mon Dec 14 11:30:32 PST 2009


Author: kris
Date: 2009-12-14 11:30:31 -0800 (Mon, 14 Dec 2009)
New Revision: 5599

Modified:
   pcbsd/trunk/SysInstaller/backend.cpp
   pcbsd/trunk/SysInstaller/backend.h
   pcbsd/trunk/SysInstaller/sys-installwidget.cpp
   pcbsd/trunk/SysInstaller/sysinstaller.h
Log:

Added feature to the SysInstaller, now when a failure occurs, show the logfile, also prompt if we should
e-mail this logfile someplace offsite for review later



Modified: pcbsd/trunk/SysInstaller/backend.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/backend.cpp	2009-12-14 19:23:43 UTC (rev 5598)
+++ pcbsd/trunk/SysInstaller/backend.cpp	2009-12-14 19:30:31 UTC (rev 5599)
@@ -2,6 +2,19 @@
 
 using namespace Scripts;
 
+void Backend::createErrorReport()
+{
+  QString line;
+
+  QProcess p;
+  QString prog = "xterm";
+  QStringList args;
+  args << "-e" << PCSYSINSTALL << "send-logs" << "interactive";
+  p.start(prog, args);
+  if (p.waitForFinished()) {
+  }
+}
+
 void Backend::setupSSHKeys(QString Host, QString User, QString Port)
 {
   QString line;

Modified: pcbsd/trunk/SysInstaller/backend.h
===================================================================
--- pcbsd/trunk/SysInstaller/backend.h	2009-12-14 19:23:43 UTC (rev 5598)
+++ pcbsd/trunk/SysInstaller/backend.h	2009-12-14 19:30:31 UTC (rev 5599)
@@ -40,6 +40,7 @@
 class Backend {
 public:
     static void enableNic(QString Nic, QString IP, QString NetMask, QString DNS, QString Gate, bool fetchMirrors);
+    static void createErrorReport();
     static void setupSSHKeys(QString Host, QString User, QString Port);
     static QStringList upgradePartitions();
     static QStringList listRsyncBackups(QString Host, QString User, QString Port);

Modified: pcbsd/trunk/SysInstaller/sys-installwidget.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sys-installwidget.cpp	2009-12-14 19:23:43 UTC (rev 5598)
+++ pcbsd/trunk/SysInstaller/sys-installwidget.cpp	2009-12-14 19:30:31 UTC (rev 5599)
@@ -24,24 +24,66 @@
 
 }
 
+// Function run when the install failed to prompt user for course of action
+void SysInstaller::installFailed()
+{
+   QString sysLog;
+
+   QMessageBox msgBox;
+   msgBox.setWindowTitle(tr("PC-BSD Installer"));
+   msgBox.setIcon(QMessageBox::Critical);
+   msgBox.setText(tr("The installer has encountered an error and has been halted."));
+   msgBox.setInformativeText(tr("Do you want to generate an error report?"));
+   msgBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
+   msgBox.setDefaultButton(QMessageBox::Yes);
+
+   // If we have a log, show it in the detailed view button
+   if ( QFile::exists("/tmp/.pc-sysinstall/pc-sysinstall.log") )
+   {
+     QFile logFile("/tmp/.pc-sysinstall/pc-sysinstall.log");
+     if (logFile.open(QIODevice::ReadOnly | QIODevice::Text))
+         while (!logFile.atEnd())
+           sysLog = sysLog + logFile.readLine() + "\n";
+     msgBox.setDetailedText(sysLog);
+   }
+   int ret = msgBox.exec();
+
+   switch (ret) {
+   case QMessageBox::Yes:
+       // Generate the error report
+       Scripts::Backend::createErrorReport();
+       break;
+   case QMessageBox::No: // :)
+       break;
+   }
+
+   QMessageBox msgBox2;
+   msgBox2.setWindowTitle(tr("PC-BSD Installer"));
+   msgBox2.setIcon(QMessageBox::Critical);
+   msgBox2.setText(tr("Restart the system now?") );
+   msgBox2.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
+   msgBox2.setDefaultButton(QMessageBox::Yes);
+
+   ret = msgBox2.exec();
+
+   switch (ret) {
+   case QMessageBox::Yes:
+       close();
+       break;
+   case QMessageBox::No: // :)
+       break;
+   }
+
+
+}
+
 // Slot which is called when the installation has finished
 void SysInstaller::slotInstallProcFinished( int exitCode, QProcess::ExitStatus status)
 {
   QString tmp;
   if ( status != QProcess::NormalExit || exitCode != 0 )
   {
-     int ret = QMessageBox::critical(this, tr("PC-BSD Installer"),
-                                tr("The install failed with error:") + tmp.setNum(exitCode) + " " +  tr("Reboot the system now?"),
-                                QMessageBox::No | QMessageBox::Yes,
-                                QMessageBox::No);
-     switch (ret) {
-     case QMessageBox::Yes:
-         //exit the installer :(
-         close();
-         break;
-     case QMessageBox::No: // :)
-         break;
-     }
+     installFailed();
   } else {
     // Move to the final page, and show a finish button
     proceed(true);

Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h	2009-12-14 19:23:43 UTC (rev 5598)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h	2009-12-14 19:30:31 UTC (rev 5599)
@@ -139,6 +139,7 @@
     void connectComponentSlots();
 
     void startInstall(); // Function which begins the install process
+    void installFailed(); // Function which does post-install failure stuff
 
     void refreshComponents(); // Function which re-draws components list widgets
 



More information about the Commits mailing list