721c919c7b
Changes: - kernel 6.0.2 - Broken init scripts - Switch to bun for better peroformance an easier ffi - Removed grup - Efi support without graphics (at least graphics werent tested) - Suppression de toutes les dépendance non libc - new splash - broken audio - typescript support - ls rewritten to be more reliable
62 lines
1.1 KiB
JavaScript
62 lines
1.1 KiB
JavaScript
//@ts-check
|
|
import { dlopen, FFIType } from 'bun:ffi';
|
|
|
|
/* Perform a hard reset now. */
|
|
const RB_AUTOBOOT = 0x01234567
|
|
|
|
/* Halt the system. */
|
|
const RB_HALT_SYSTEM = 0xcdef0123
|
|
|
|
/* Enable reboot using Ctrl-Alt-Delete keystroke. */
|
|
const RB_ENABLE_CAD = 0x89abcdef
|
|
|
|
/* Disable reboot using Ctrl-Alt-Delete keystroke. */
|
|
const RB_DISABLE_CAD = 0
|
|
|
|
/* Stop system and switch power off if possible. */
|
|
const RB_POWER_OFF = 0x4321fedc
|
|
|
|
/* Suspend system using software suspend. */
|
|
const RB_SW_SUSPEND = 0xd000fce2
|
|
|
|
/* Reboot system into new kernel. */ //no idea how to use that but hey
|
|
const RB_KEXEC = 0x45584543
|
|
|
|
|
|
const {
|
|
symbols: {
|
|
reboot,
|
|
},
|
|
} = dlopen('/usr/lib/libc.so.6', {
|
|
reboot: {
|
|
args: [ FFIType.int ],
|
|
returns: FFIType.int,
|
|
},
|
|
});
|
|
|
|
|
|
|
|
export function disableCtrlAltSupr() {
|
|
reboot(RB_DISABLE_CAD)
|
|
}
|
|
|
|
export function enableCtrlAltSupr() {
|
|
reboot(RB_ENABLE_CAD)
|
|
}
|
|
|
|
export function halt() {
|
|
reboot(RB_HALT_SYSTEM)
|
|
}
|
|
|
|
export function classicReboot() {
|
|
reboot(RB_AUTOBOOT)
|
|
}
|
|
|
|
export function powerOff() {
|
|
reboot(RB_POWER_OFF)
|
|
}
|
|
|
|
export function suspend() {
|
|
reboot(RB_SW_SUSPEND)
|
|
}
|