Merge branch 'main' of ssh.marcbarbier.fr:Marc/chibraxos

This commit is contained in:
Marc
2022-09-08 19:21:22 +02:00
2 changed files with 18 additions and 2 deletions
+1 -1
View File
@@ -6,4 +6,4 @@ fi
CFLAGS="" CFLAGS=""
gcc osLoader.c -o init gcc osLoader.c -o init --static
+16
View File
@@ -2,8 +2,24 @@
#include <stdio.h> #include <stdio.h>
//Chemin exacte de node (a changer aprés la creation d'un gestionnaire de packets) //Chemin exacte de node (a changer aprés la creation d'un gestionnaire de packets)
#define NODE "/usr/local/bin/node" #define NODE "/usr/local/bin/node"
#define BUN "/usr/bin/bun"
#define INIT "/core/index.js" #define INIT "/core/index.js"
int main() { int main() {
printf("Booting \n");
if(access(NODE, F_OK) == 0) {
printf("Starting Nodejs\n");
sleep(2);
execl(NODE, NODE, INIT, NULL); execl(NODE, NODE, INIT, NULL);
} }
else if(access(BUN, F_OK) == 0) {
printf("Starting bun\n");
sleep(2);
execl(BUN, BUN, "run", INIT, NULL);
}
else {
printf("JS binary not found\n");
while(1);
}
sleep(5);
}