diff --git a/generaldialog.cpp b/generaldialog.cpp index 5756d4d..913e5cd 100644 --- a/generaldialog.cpp +++ b/generaldialog.cpp @@ -70,8 +70,15 @@ void generalDialog::on_cancelBtn_clicked() void generalDialog::on_okBtn_clicked() { if(resetDialog == true) { - // Reset the device ... some code to come - ; + // Soft-reset the device + // We set a custom boot flag and reboot silently in Diagnostics + string_writeconfig("/external_root/boot/flags/DIAGS_BOOT", "true"); + string_writeconfig("/external_root/boot/flags/DO_SOFT_RESET", "true"); + QString prog ("reboot"); + QStringList args; + QProcess *proc = new QProcess(); + proc->start(prog, args); + proc->waitForFinished(); } if(updateDialog == true) { string_writeconfig("/mnt/onboard/onboard/.inkbox/can_really_update", "true"); diff --git a/mainwindow.cpp b/mainwindow.cpp index 51b24a7..78190c2 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -208,16 +208,6 @@ MainWindow::MainWindow(QWidget *parent) QFile::copy("/mnt/onboard/onboard/.inkbox/rootfs-internal.sh", "/tmp/rootfs-internal.sh"); // First script - QString rootfs_prog ("chroot"); - QStringList rootfs_args; - rootfs_args << "/external_root" << "/tmp/rootfs.sh"; - // Removing script - QFile::remove("/mnt/onboard/onboard/.inkbox/rootfs.sh"); - QProcess *rootfs_proc = new QProcess(); - rootfs_proc->start(rootfs_prog, rootfs_args); - rootfs_proc->waitForFinished(); - - // Second script QString rootfs_internal_prog ("sh"); QStringList rootfs_internal_args; rootfs_internal_args << "/tmp/rootfs-internal.sh"; @@ -227,6 +217,16 @@ MainWindow::MainWindow(QWidget *parent) rootfs_internal_proc->start(rootfs_internal_prog, rootfs_internal_args); rootfs_internal_proc->waitForFinished(); + // Second script + QString rootfs_prog ("chroot"); + QStringList rootfs_args; + rootfs_args << "/external_root" << "/tmp/rootfs.sh"; + // Removing script + QFile::remove("/mnt/onboard/onboard/.inkbox/rootfs.sh"); + QProcess *rootfs_proc = new QProcess(); + rootfs_proc->start(rootfs_prog, rootfs_args); + rootfs_proc->waitForFinished(); + // Rebooting if needed if(reboot_after_update == true) { QString rebootProg("busybox");