Support for real harddrive and Jmicron usb drives

This commit is contained in:
Marc
2021-12-04 23:02:31 +01:00
parent 1024e96ebc
commit 53441d5b9d
17 changed files with 333 additions and 152 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ async function main() {
//chainload into sheebr
await fHook("/usr/bin/sheebr.js")
reboot.disableCtrlAltSupr()
reboot.powerOff()
//reboot.powerOff()
console.log("End of init reached")
reboot.enableCtrlAltSupr()
+6 -10
View File
@@ -1,14 +1,9 @@
//@ts-check
const { Lexer } = require('../lib/sheebr/lexer')
const { getline } = require('../lib/sheebr/utils')
const fs = require('fs')
let environment = require('../lib/sheebr/environment')
let aliases = require("../lib/sheebr/aliases")
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
const readlineSync = require('../lib/sheebr/readLineSync')
let execSync = require('child_process').execSync
@@ -18,7 +13,7 @@ start()
async function start(){
while(true){
input = await getline("sheebr> ");
const input = await getline("sheebr> ");
if(input == "exit") break;
if(input == "") continue;
else evaluate(input);
@@ -27,7 +22,7 @@ async function start(){
function evaluate(input){
let lexer = new Lexer(input)
args = lexer.scanTokens()
let args = lexer.scanTokens()
args = evaluateAliases(args)
args = evaluateEnvironmentVariables(args);
switch(args[0]){
@@ -56,7 +51,7 @@ function evaluate(input){
default:
evaluateProgram(args)
}
}
@@ -69,7 +64,8 @@ function evaluateProgram(args){
const files = fs.readdirSync(path);
if(files.includes(`${args[0]}.js`)){
found = true;
script = execSync(`node ${path + '/' + args[0]}.js ${args.map(arg => {return arg.includes(' ') ? `"${arg}"` : arg}).join(' ')}`, {cwd: current_dir, env: environment});
//@ts-expect-error
const script = execSync(`${environment.node} ${path + '/' + args[0]}.js ${args.map(arg => {return arg.includes(' ') ? `"${arg}"` : arg}).join(' ')}`, {cwd: current_dir, env: environment, shell: true});
process.stdout.write(script)
tobreak = true;
}
@@ -1,10 +1,11 @@
let environment = {
path: ["/usr/bin", "/usr/lib/sheebr", "/usr/local/bin", "/usr/local/sbin/"],
path: ["/usr/bin", "/usr/sbin", "/usr/lib/sheebr", "/usr/local/bin", "/usr/local/sbin/"],
ls_color: JSON.stringify({
di: [01, 34],
ln: [01, 36],
ex: [01, 32]
})
}),
node: "/usr/local/bin/node"
}
module.exports = environment