ajout de Sheebr + support de shutdown + auto install kernel
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
//@ts-check
|
||||
const { exec, fork } = require('child_process');
|
||||
/**
|
||||
* @param {string} path
|
||||
* @deprecated
|
||||
*/
|
||||
function hookTo(path) {
|
||||
exec(`node ${path}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
*/
|
||||
async function fHook(path) {
|
||||
const child = fork(path)
|
||||
return new Promise((res, rej) => {
|
||||
child.on('exit', () => {
|
||||
res()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function rHook(path) {
|
||||
|
||||
}
|
||||
|
||||
module.exports = { hookTo, fHook }
|
||||
@@ -1,29 +1,53 @@
|
||||
const audio = require('./audio.js')
|
||||
//@ts-check
|
||||
function panic() {
|
||||
console.log("/!\\ INIT PANIK /!\\ LOSE CHIBRE")
|
||||
while(1) {}
|
||||
}
|
||||
|
||||
console.log("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
|
||||
console.log(`
|
||||
async function main() {
|
||||
try {
|
||||
const audio = require('./audio.js')
|
||||
//@ts-expect-error
|
||||
const { poweroff, halt } = require('./shutdown.js')
|
||||
const input = require('./input.js')
|
||||
const { fHook } = require("./hook.js")
|
||||
|
||||
console.log("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
|
||||
console.log(`
|
||||
|
||||
|
||||
_______ _________ ______ _______ _______
|
||||
( ____ \\|\\ /|\\__ __/( ___ \\ ( ____ )( ___ )|\\ /|
|
||||
| ( \\/| ) ( | ) ( | ( ) )| ( )|| ( ) |( \\ / )
|
||||
| | | (___) | | | | (__/ / | (____)|| (___) | \\ (_) /
|
||||
| | | ___ | | | | __ ( | __)| ___ | ) _ (
|
||||
| | | ( ) | | | | ( \\ \\ | (\\ ( | ( ) | / ( ) \\
|
||||
| (____/\\| ) ( |___) (___| )___) )| ) \\ \\__| ) ( |( / \\ )
|
||||
(_______/|/ \\|\\_______/|/ \\___/ |/ \\__/|/ \\||/ \\|
|
||||
_______ _________ ______ _______ _______
|
||||
( ____ \\|\\ /|\\__ __/( ___ \\ ( ____ )( ___ )|\\ /|
|
||||
| ( \\/| ) ( | ) ( | ( ) )| ( )|| ( ) |( \\ / )
|
||||
| | | (___) | | | | (__/ / | (____)|| (___) | \\ (_) /
|
||||
| | | ___ | | | | __ ( | __)| ___ | ) _ (
|
||||
| | | ( ) | | | | ( \\ \\ | (\\ ( | ( ) | / ( ) \\
|
||||
| (____/\\| ) ( |___) (___| )___) )| ) \\ \\__| ) ( |( / \\ )
|
||||
(_______/|/ \\|\\_______/|/ \\___/ |/ \\__/|/ \\||/ \\|
|
||||
|
||||
_______ _______
|
||||
( ___ )( ____ \\
|
||||
| ( ) || ( \\/
|
||||
| | | || (_____
|
||||
| | | |(_____ )
|
||||
| | | | ) |
|
||||
| (___) |/\\____) |
|
||||
(_______)\\_______)
|
||||
_______ _______
|
||||
( ___ )( ____ \\
|
||||
| ( ) || ( \\/
|
||||
| | | || (_____
|
||||
| | | |(_____ )
|
||||
| | | | ) |
|
||||
| (___) |/\\____) |
|
||||
(_______)\\_______)
|
||||
|
||||
`)
|
||||
`)
|
||||
|
||||
audio('/chibrax/sheeebr.wav')
|
||||
audio('/chibrax/sheeebr.wav')
|
||||
|
||||
while(1) {}
|
||||
//chainload into sheebr
|
||||
await fHook("/usr/bin/sheebr.js")
|
||||
poweroff()
|
||||
|
||||
/*while(1){}
|
||||
console.log("End of init reached")
|
||||
panic()*/
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
panic()
|
||||
}
|
||||
}
|
||||
main()
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//@ts-check
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} str
|
||||
* @returns
|
||||
*/
|
||||
async function input(str) {
|
||||
console.log(str)
|
||||
process.stdin.resume();
|
||||
process.stdin.setEncoding('utf8');
|
||||
let line = "";
|
||||
return new Promise((res, rej) => {
|
||||
process.stdin.on('data', function(chunk) {
|
||||
line += chunk
|
||||
if (chunk.toString('utf-8').endsWith('\n')) {
|
||||
process.stdin.pause()
|
||||
res(line.substring(0, line.length -1))
|
||||
}
|
||||
});
|
||||
process.stdin.on('error', function(err) {
|
||||
rej(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = input
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.11.10"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
syscalls = require('./syscall.node')
|
||||
module.exports = syscalls
|
||||
@@ -0,0 +1,9 @@
|
||||
async function mSleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
async function sleep(s) {
|
||||
return mSleep(s * 1000)
|
||||
}
|
||||
|
||||
module.exports = { mSleep, sleep }
|
||||
Executable
BIN
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"include": ["./**/*"],
|
||||
"compilerOptions": {
|
||||
// Tells TypeScript to read JS files, as
|
||||
// normally they are ignored as source files
|
||||
"allowJs": true,
|
||||
// Generate d.ts files
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": false,
|
||||
"noEmit": true,
|
||||
"lib": [ "ES2016" ],
|
||||
"target": "es2016",
|
||||
"moduleResolution":"Node",
|
||||
"noImplicitAny": true,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user