26 lines
549 B
C
26 lines
549 B
C
#include <unistd.h>
|
|
#include <stdio.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);
|
|
}
|
|
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);
|
|
}
|