Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: post-install reboot — wait for TTS, use sysrq, hide W on internal boot

1. Wait for TTS to finish before reboot (no audio glitch)
2. Use sysrq 'b' for reliable reboot after install
3. Only show "W: install" when removable media is present
(not when booted from internal NVMe post-install)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+34 -9
+34 -9
fedac/native/src/ac-native.c
··· 1313 1313 ac_log("[boot-anim] boot_dev=%s parent=%s removable=%d show_install=%d\n", 1314 1314 log_dev, boot_blk, is_removable(boot_blk), show_install); 1315 1315 } else { 1316 - // No log_dev yet — always show install option (user can update or fresh install) 1317 - show_install = 1; 1318 - ac_log("[boot-anim] no log_dev, show_install=1 (always offer)\n"); 1316 + // No log_dev — check if any removable block device has our EFI boot file 1317 + // If not, we're booted from internal disk (post-install) — don't show install 1318 + show_install = 0; 1319 + DIR *blkdir = opendir("/sys/block"); 1320 + if (blkdir) { 1321 + struct dirent *bent; 1322 + while ((bent = readdir(blkdir)) != NULL) { 1323 + if (bent->d_name[0] == '.') continue; 1324 + if (is_removable(bent->d_name) == 1) { 1325 + show_install = 1; 1326 + ac_log("[boot-anim] removable device %s found, show_install=1\n", bent->d_name); 1327 + break; 1328 + } 1329 + } 1330 + closedir(blkdir); 1331 + } 1332 + if (!show_install) 1333 + ac_log("[boot-anim] no removable media, show_install=0\n"); 1319 1334 } 1320 1335 1321 1336 // Open evdev fds for key checking — retry until devices appear ··· 1995 2010 int install_ok = auto_install_to_hd(&graph, screen, display, pixel_scale); 1996 2011 if (display) { 1997 2012 int should_reboot = draw_install_reboot_prompt(&graph, screen, display, input, tts, audio, install_ok, pixel_scale); 1998 - if (should_reboot) { system("reboot -f"); _exit(0); } 2013 + if (should_reboot) { 2014 + if (tts) tts_wait(tts); // let TTS finish before reboot 2015 + sync(); 2016 + usleep(500000); // 0.5s grace 2017 + // sysrq reboot (most reliable under initramfs) 2018 + FILE *sr = fopen("/proc/sysrq-trigger", "w"); 2019 + if (sr) { fputs("b", sr); fclose(sr); } 2020 + system("reboot -f"); 2021 + _exit(0); 2022 + } 1999 2023 } 2000 2024 } 2001 2025 ··· 2057 2081 should_reboot = draw_install_reboot_prompt(&graph, screen, display, input, tts, audio, install_ok, pixel_scale); 2058 2082 if (install_ok) should_reboot = 1; 2059 2083 if (should_reboot) { 2060 - if (tts) { tts_speak(tts, "powering off"); tts_wait(tts); } 2084 + if (tts) { tts_speak(tts, "rebooting"); tts_wait(tts); } 2061 2085 audio_shutdown_sound(audio); 2062 - usleep(600000); 2086 + usleep(500000); 2063 2087 sync(); 2064 - // Cold power-off instead of warm reboot — HDA codec doesn't 2065 - // reinitialize properly on warm reboot, causing ALSA failure. 2066 - reboot(LINUX_REBOOT_CMD_POWER_OFF); 2088 + // sysrq reboot (reliable under initramfs) 2089 + FILE *sr = fopen("/proc/sysrq-trigger", "w"); 2090 + if (sr) { fputs("b", sr); fclose(sr); } 2091 + reboot(LINUX_REBOOT_CMD_RESTART); 2067 2092 while (running) sleep(1); 2068 2093 } 2069 2094 }