Boot flags: Write newlines

This is to prepare for the new init binary, which is less tolerant than ash.
This commit is contained in:
Nicolas Mailloux 2022-09-27 07:05:09 -04:00
parent 94bb7a5192
commit b744778bd5
6 changed files with 21 additions and 21 deletions

View file

@ -261,7 +261,7 @@ void encryptionManager::unlockEncryptedStorage() {
std::string unlockTime_str = to_string(currentEpoch); std::string unlockTime_str = to_string(currentEpoch);
global::encfs::unlockTime = QDateTime::fromTime_t(currentEpoch).toString(); global::encfs::unlockTime = QDateTime::fromTime_t(currentEpoch).toString();
global::encfs::lockdownMessage = "FATAL: 4 invalid passphrase tries, locking down device until " + global::encfs::unlockTime; global::encfs::lockdownMessage = "FATAL: 4 invalid passphrase tries, locking down device until " + global::encfs::unlockTime;
string_writeconfig("/external_root/boot/flags/ENCRYPT_LOCK", unlockTime_str); writeFile("/external_root/boot/flags/ENCRYPT_LOCK", unlockTime_str + "\n");
global::encfs::lockdown = true; global::encfs::lockdown = true;
setupMessageBoxRan = true; setupMessageBoxRan = true;

View file

@ -826,9 +826,9 @@ namespace {
} }
void installUpdate() { void installUpdate() {
log("Installing update package", "functions"); log("Installing update package", "functions");
string_writeconfig("/mnt/onboard/onboard/.inkbox/can_really_update", "true"); writeFile("/mnt/onboard/onboard/.inkbox/can_really_update", "true\n");
string_writeconfig("/external_root/opt/update/will_update", "true"); writeFile("/external_root/opt/update/will_update", "true\n");
string_writeconfig("/external_root/boot/flags/WILL_UPDATE", "true"); writeFile("/external_root/boot/flags/WILL_UPDATE", "true\n");
reboot(true); reboot(true);
} }
bool getEncFSStatus() { bool getEncFSStatus() {

View file

@ -81,7 +81,7 @@ void koboxSettings::on_checkBox_toggled(bool checked)
if(checked == true) { if(checked == true) {
if(not_user_change != true) { if(not_user_change != true) {
log("Enabling KoBox subsystem", className); log("Enabling KoBox subsystem", className);
string_writeconfig("/external_root/boot/flags/X11_START", "true"); writeFile("/external_root/boot/flags/X11_START", "true\n");
openSettingsRebootDialog(); openSettingsRebootDialog();
} }
else { else {
@ -90,7 +90,7 @@ void koboxSettings::on_checkBox_toggled(bool checked)
} }
else { else {
log("Disabling KoBox subsystem", className); log("Disabling KoBox subsystem", className);
string_writeconfig("/external_root/boot/flags/X11_START", "false"); writeFile("/external_root/boot/flags/X11_START", "false\n");
openSettingsRebootDialog(); openSettingsRebootDialog();
} }
} }

View file

@ -586,9 +586,9 @@ void settings::on_nextBtn_clicked()
void settings::on_updateBtn_clicked() void settings::on_updateBtn_clicked()
{ {
log("'Update' button clicked", className); log("'Update' button clicked", className);
string_writeconfig("/mnt/onboard/onboard/.inkbox/can_really_update", "true"); writeFile("/mnt/onboard/onboard/.inkbox/can_really_update", "true\n");
string_writeconfig("/external_root/opt/update/will_update", "true"); writeFile("/external_root/opt/update/will_update", "true\n");
string_writeconfig("/external_root/boot/flags/WILL_UPDATE", "true"); writeFile("/external_root/boot/flags/WILL_UPDATE", "true\n");
QString prog ("/sbin/reboot"); QString prog ("/sbin/reboot");
QStringList args; QStringList args;
QProcess *proc = new QProcess(); QProcess *proc = new QProcess();

View file

@ -113,8 +113,8 @@ alert::~alert()
void alert::on_continueBtn_clicked() void alert::on_continueBtn_clicked()
{ {
// We continue anyway and re-set the ALERT flag // We continue anyway and re-set the ALERT flag
string_writeconfig("/external_root/boot/flags/ALERT", "false"); writeFile("/external_root/boot/flags/ALERT", "false\n");
string_writeconfig("/external_root/boot/flags/ALERT_SIGN", "false"); writeFile("/external_root/boot/flags/ALERT_SIGN", "false\n");
updateReset(); updateReset();
QProcess process; QProcess process;
process.startDetached("inkbox", QStringList()); process.startDetached("inkbox", QStringList());
@ -123,10 +123,10 @@ void alert::on_continueBtn_clicked()
void alert::on_resetBtn_clicked() void alert::on_resetBtn_clicked()
{ {
// We set the DO_FACTORY_RESET flag and we restart the Kobo // We set the DO_FACTORY_RESET flag and we restart the device
log("Factory reset requested; setting required flags", className); log("Factory reset requested; setting required flags", className);
string_writeconfig("/external_root/boot/flags/DO_FACTORY_RESET", "true"); writeFile("/external_root/boot/flags/DO_FACTORY_RESET", "true\n");
string_writeconfig("/external_root/boot/flags/DIAGS_BOOT", "true"); writeFile("/external_root/boot/flags/DIAGS_BOOT", "true\n");
QString reboot_prog ("/sbin/reboot"); QString reboot_prog ("/sbin/reboot");
QStringList reboot_args; QStringList reboot_args;
reboot_args << "no_splash"; reboot_args << "no_splash";
@ -139,18 +139,18 @@ void alert::on_resetBtn_clicked()
void alert::on_continue2Btn_clicked() void alert::on_continue2Btn_clicked()
{ {
// We continue anyway and re-set the ALERT flag // We continue anyway and re-set the ALERT flag
string_writeconfig("/external_root/boot/flags/ALERT", "false"); writeFile("/external_root/boot/flags/ALERT", "false\n");
updateReset(); updateReset();
log("Restarting InkBox", className); log("Restarting InkBox", className);
if(signatureError == true) { if(signatureError == true) {
string_writeconfig("/external_root/boot/flags/ALERT_SIGN", "false"); writeFile("/external_root/boot/flags/ALERT_SIGN", "false\n");
QProcess process; QProcess process;
process.startDetached("inkbox", QStringList()); process.startDetached("inkbox", QStringList());
qApp->quit(); qApp->quit();
} }
if(downgradeError == true) { if(downgradeError == true) {
string_writeconfig("/external_root/boot/flags/ALERT_DOWNGRADE", "false"); writeFile("/external_root/boot/flags/ALERT_DOWNGRADE", "false\n");
QProcess process; QProcess process;
process.startDetached("inkbox", QStringList()); process.startDetached("inkbox", QStringList());
qApp->quit(); qApp->quit();
@ -158,8 +158,8 @@ void alert::on_continue2Btn_clicked()
} }
void alert::updateReset() { void alert::updateReset() {
string_writeconfig("/mnt/onboard/onboard/.inkbox/can_really_update", "false"); writeFile("/mnt/onboard/onboard/.inkbox/can_really_update", "false\n");
string_writeconfig("/mnt/onboard/onboard/.inkbox/can_update", "false"); writeFile("/mnt/onboard/onboard/.inkbox/can_update", "false\n");
} }
void alert::quit() { void alert::quit() {

View file

@ -292,8 +292,8 @@ void generalDialog::on_okBtn_clicked()
// Soft-reset the device // Soft-reset the device
// We set a custom boot flag and reboot silently in Diagnostics // We set a custom boot flag and reboot silently in Diagnostics
log("Setting up the device for soft-reset", className); log("Setting up the device for soft-reset", className);
string_writeconfig("/external_root/boot/flags/DIAGS_BOOT", "true"); writeFile("/external_root/boot/flags/DIAGS_BOOT", "true\n");
string_writeconfig("/external_root/boot/flags/DO_SOFT_RESET", "true"); writeFile("/external_root/boot/flags/DO_SOFT_RESET", "true\n");
reboot(false); reboot(false);
qApp->quit(); qApp->quit();
} }