Index: sources/update/VSwUpdate.cpp =================================================================== diff -u -rd87d797c11e7a6f4c0b2559bb8fd50fc33643cbc -r8ed1ad9f8c2de2ea19dd455cf59b648061c0a998 --- sources/update/VSwUpdate.cpp (.../VSwUpdate.cpp) (revision d87d797c11e7a6f4c0b2559bb8fd50fc33643cbc) +++ sources/update/VSwUpdate.cpp (.../VSwUpdate.cpp) (revision 8ed1ad9f8c2de2ea19dd455cf59b648061c0a998) @@ -34,7 +34,7 @@ // Enables (1) or disables (!1) reboot to allow for better testing. // Default is to reboot when this is finished. #ifndef REBOOT_ENABLED -#define REBOOT_ENABLED (0) +#define REBOOT_ENABLED (1) #endif #define MSG_ID_ENTER_BOOTLOADER_NOW (0x8093) ///< HD Jump to the bootloader application @@ -481,17 +481,29 @@ // For now just log. writeLog("We are rebooting!", false); #if (REBOOT_ENABLED == 1) + QProcess* pd = new QProcess(); - pd->start(QString::fromStdString("systemctl --message=\"Software upgrade\" reboot; sleep 1s"), QStringList()); + pd->start(QString::fromStdString("./bin/systemctl --message=\"Software upgrade\" reboot; sleep 1s"), QStringList()); // We want the process we spawned to finish causing the reboot even if the CPU was busy. // Sleep 1 second (just in case) then spin wait for finished. There is a sleep of 1s in the command line. QThread::currentThread()->msleep(1000); pd->waitForFinished(); + QString output = QString::fromLocal8Bit(pd->readAllStandardOutput()) + " : " + + QString::fromLocal8Bit(pd->readAllStandardError()); + QProcess* pd2 = new QProcess(); + pd2->start(QString::fromStdString("./sbin/reboot"), QStringList()); + + // We want the process we spawned to finish causing the reboot even if the CPU was busy. + // Sleep 1 second (just in case) then spin wait for finished. There is a sleep of 1s in the command line. + pd2->waitForFinished(); + output += "2" + QString::fromLocal8Bit(pd2->readAllStandardOutput()) + " : " + + QString::fromLocal8Bit(pd2->readAllStandardError()); + // If we got here, we are likely failing at rebooting for some reason and should log it. // User can always manually reboot. - writeLog("We failed to reboot???", false); + writeLog("We failed to reboot ??? " + output, false); setState(_stateMsg + "\nFailed to update, please power cycle!"); #endif } @@ -596,7 +608,7 @@ pch->start(QString::fromStdString("chmod 755 " + script), QStringList()); pch->waitForFinished(); QProcess* pd = new QProcess(); - pd->start(QString::fromStdString("." + script), QStringList()); + pd->start(QString::fromStdString("./" + script), QStringList()); pd->waitForFinished(); } // Signal done. @@ -624,7 +636,6 @@ bool hadUi = false; for (SwUpdate::UiUpdateStatus s : stats) { hadUi |= s.targetName == "Files"; - allCompleted &= (s.stepName == "Completed"); } if (allCompleted && hadUi) { emit aboutToReboot();