ChibraxOS 2
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
This commit is contained in:
+19
-8
@@ -1,25 +1,36 @@
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <sys/mount.h>
|
||||
//Chemin exacte de node (a changer aprés la creation d'un gestionnaire de packets)
|
||||
#define NODE "/usr/local/bin/node"
|
||||
#define BUN "/usr/bin/bun"
|
||||
#define INIT "/core/index.js"
|
||||
|
||||
int main() {
|
||||
printf("Booting \n");
|
||||
if(access(NODE, F_OK) == 0) {
|
||||
printf("Starting Nodejs\n");
|
||||
sleep(2);
|
||||
execl(NODE, NODE, INIT, NULL);
|
||||
|
||||
if(access(INIT, F_OK) != 0) {
|
||||
printf("/!\\ Core is missing \n");
|
||||
sleep(INT_MAX);
|
||||
} else {
|
||||
printf("Core is present\n");
|
||||
}
|
||||
else if(access(BUN, F_OK) == 0) {
|
||||
|
||||
printf("Mounting /proc:");
|
||||
if(mount("dummy", "/proc", "proc", MS_NODEV | MS_RDONLY | MS_NOSUID | MS_RELATIME | MS_NOEXEC, NULL) == 0) {
|
||||
printf(": Success\n");
|
||||
} else {
|
||||
printf(": Failure\n");
|
||||
}
|
||||
|
||||
if(access(BUN, F_OK) == 0) {
|
||||
printf("Starting bun\n");
|
||||
sleep(2);
|
||||
sleep(1);
|
||||
execl(BUN, BUN, "run", INIT, NULL);
|
||||
}
|
||||
else {
|
||||
printf("JS binary not found\n");
|
||||
while(1);
|
||||
sleep(INT_MAX);
|
||||
}
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user