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);
global::encfs::unlockTime = QDateTime::fromTime_t(currentEpoch).toString();
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;
setupMessageBoxRan = true;

View file

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

View file

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

View file

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

View file

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

View file

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