Skip to content

Commit

Permalink
Merge pull request webosbrew#164 from throwaway96/failsafe-sync-20231229
Browse files Browse the repository at this point in the history
Sync after clearing failsafe flag in startup.sh
  • Loading branch information
Informatic authored Feb 2, 2024
2 parents 8b8a523 + 525edd3 commit 7eef384
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions services/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ function runService() {
'befe927c6f62b87545aaefb4b2648a227b22695fa0f78a228dcacf1fbba11aeb',
'd914b3b444433bf49ff83c3c0ae0b729cf7544c074e72c23ec24e5f86aaaf4ac',
'6215795aed50c11bb7be716cf66326f3657a129143b5edc1b635dab8b8d2fc9f',
'e04a3d61098c6f74d466da6fb457a52fb61a9cc86869059ae32b13bf43cd9d10',
];

// RootMyTV v2
Expand Down
10 changes: 6 additions & 4 deletions services/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ touch "${once}"
# Use default directory if SERVICE_DIR is not provided.
SERVICE_DIR="${SERVICE_DIR-/media/developer/apps/usr/palm/services/org.webosbrew.hbchannel.service}"

if [[ -f /var/luna/preferences/webosbrew_failsafe ]]; then
if [[ -e /var/luna/preferences/webosbrew_failsafe ]]; then
# In case a reboot occured during last startup - open an emergency telnet
# server and nag user to actually fix this. (since further reboots could
# lead to devmode removal, etc...)
Expand All @@ -35,13 +35,14 @@ if [[ -f /var/luna/preferences/webosbrew_failsafe ]]; then

luna-send -a webosbrew -f -n 1 luna://com.webos.notification/createToast '{"sourceId":"webosbrew","message": "<b>Failsafe mode!</b><br/>A crash has occured during startup. Fix any causes and reboot."}'
sleep 15;
rm /var/luna/preferences/webosbrew_failsafe
rm -rf /var/luna/preferences/webosbrew_failsafe
sync -f /var/luna/preferences
luna-send -a com.webos.service.secondscreen.gateway -f -n 1 luna://com.webos.notification/createAlert '{"sourceId":"webosbrew","message":"<b>Homebrew Channel</b> - Failsafe mode<br />A crash has occured during previous startup - root-related system customizations have been temporarily disabled.<br /><br /> System should go back to normal after a reboot.<br />Would you like to reboot now?","buttons":[{"label":"Reboot now","onclick":"luna://com.webos.service.sleep/shutdown/machineReboot","params":{"reason":"remoteKey"}},{"label":"Reboot later"}]}'
else
# Set a failsafe flag and sync filesystem to make sure it actually gets
# tripped...
touch /var/luna/preferences/webosbrew_failsafe
sync
sync -f /var/luna/preferences/webosbrew_failsafe
sleep 2

# Close fds to avoid leaking Luna socket
Expand Down Expand Up @@ -136,5 +137,6 @@ else

# Reset failsafe flag after a while
sleep 10
rm /var/luna/preferences/webosbrew_failsafe
rm -rf /var/luna/preferences/webosbrew_failsafe
sync -f /var/luna/preferences
fi

0 comments on commit 7eef384

Please sign in to comment.