From be92517b1687f28f1e72fbd5178a0ca6b9b9aa72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kelemen=20=28vudiq=29?= Date: Wed, 17 Nov 2021 20:30:17 +0100 Subject: [PATCH] Lakka: use different shutdown/reboot system commands To avoid any filesystem corruption during shutdown/reboot a sleep is added before shutdown/reboot is called. Also no quit is called, as the RetroArch process will be killed by systemd. Quitting RetroArch may result in unwanted restart of RetroArch by systemd. Upstream of patch used by Lakka at build time https://github.com/libretro/Lakka-LibreELEC/blob/1943ad296eaf7c01040f02aa8f5dff3d2f37309f/packages/libretro/retroarch/patches/retroarch-02-graceful-shutdown-reboot-hack.patch --- retroarch.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/retroarch.c b/retroarch.c index 18ba465cf8..6773ccf923 100644 --- a/retroarch.c +++ b/retroarch.c @@ -4727,8 +4727,12 @@ bool command_event(enum event_command cmd, void *data) runloop_msg_queue_push(msg_hash_to_str(MSG_VALUE_SHUTTING_DOWN), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL); } +#ifdef HAVE_LAKKA + system("(sleep 1 && shutdown -P now) & disown"); +#else command_event(CMD_EVENT_QUIT, NULL); system("shutdown -P now"); +#endif /* HAVE_LAKKA */ #endif break; case CMD_EVENT_REBOOT: @@ -4738,8 +4742,12 @@ bool command_event(enum event_command cmd, void *data) runloop_msg_queue_push(msg_hash_to_str(MSG_VALUE_REBOOTING), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL); } +#ifdef HAVE_LAKKA + system("(sleep 1 && shutdown -r now) & disown"); +#else command_event(CMD_EVENT_QUIT, NULL); system("shutdown -r now"); +#endif /* HAVE_LAKKA */ #endif break; case CMD_EVENT_RESUME: