mirror of
https://github.com/JannisHeydemann/BoredOS.git
synced 2026-05-30 02:16:58 +00:00
legal: Add usage policy for current and future commits.
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "sys/module_manager.h"
|
||||
#include "sys/bootfs_state.h"
|
||||
#include "input/keymap.h"
|
||||
#include "input/keyboard.h"
|
||||
|
||||
extern void sysfs_init_subsystems(void);
|
||||
|
||||
@@ -234,6 +235,48 @@ static void fat32_mkdir_recursive(const char *path) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool usage_policy_prompt(void) {
|
||||
kconsole_set_active(true);
|
||||
serial_write("BoredOS - Please read the Usage Policy provided with this software before continuing.\n");
|
||||
serial_write("Do you agree to the terms? [y/N]\n");
|
||||
|
||||
while (1) {
|
||||
if ((inb(0x64) & 1) == 0) {
|
||||
asm volatile("pause");
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t scancode = inb(0x60);
|
||||
keyboard_event_t ev;
|
||||
if (!keyboard_handle_set1_scancode(scancode, &ev)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ev.pressed) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ev.keycode == KEY_ENTER || ev.keycode == KEY_KP_ENTER) {
|
||||
serial_write("\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ev.is_text) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ev.codepoint == 'y' || ev.codepoint == 'Y') {
|
||||
serial_write("\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ev.codepoint == 'n' || ev.codepoint == 'N') {
|
||||
serial_write("\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void kmain(void) {
|
||||
init_serial();
|
||||
vfs_init();
|
||||
@@ -445,6 +488,11 @@ void kmain(void) {
|
||||
smp_init(NULL);
|
||||
}
|
||||
|
||||
if (!usage_policy_prompt()) {
|
||||
log_fail("Usage policy not accepted, halting");
|
||||
hcf();
|
||||
}
|
||||
|
||||
wm_init();
|
||||
|
||||
asm volatile("sti");
|
||||
|
||||
Reference in New Issue
Block a user