typescript-virtual-container 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +2 -0
- package/README.md +5 -1
- package/benchmark-virtualshell.ts +3 -11
- package/builds/self-standalone.js +230 -346
- package/builds/self-standalone.js.map +3 -3
- package/builds/standalone-wo-sftp.js +156 -272
- package/builds/standalone-wo-sftp.js.map +3 -3
- package/builds/standalone.js +151 -267
- package/builds/standalone.js.map +3 -3
- package/dist/VirtualPackageManager/index.d.ts.map +1 -1
- package/dist/VirtualPackageManager/index.js +29 -1
- package/dist/VirtualShell/shell.d.ts.map +1 -1
- package/dist/VirtualShell/shell.js +6 -10
- package/dist/VirtualUserManager/index.d.ts.map +1 -1
- package/dist/VirtualUserManager/index.js +4 -4
- package/dist/commands/curl.d.ts.map +1 -1
- package/dist/commands/curl.js +2 -1
- package/dist/commands/gzip.d.ts.map +1 -1
- package/dist/commands/gzip.js +6 -0
- package/dist/commands/helpers.js +1 -1
- package/dist/commands/history.js +2 -2
- package/dist/commands/man.d.ts.map +1 -1
- package/dist/commands/man.js +30 -136
- package/dist/commands/neofetch.d.ts.map +1 -1
- package/dist/commands/neofetch.js +6 -0
- package/dist/commands/wget.d.ts.map +1 -1
- package/dist/commands/wget.js +11 -1
- package/dist/modules/linuxRootfs.d.ts +1 -1
- package/dist/modules/linuxRootfs.d.ts.map +1 -1
- package/dist/modules/linuxRootfs.js +5 -5
- package/dist/self-standalone.js +149 -102
- package/package.json +2 -2
- package/src/VirtualPackageManager/index.ts +29 -1
- package/src/VirtualShell/shell.ts +6 -11
- package/src/VirtualUserManager/index.ts +4 -4
- package/src/commands/curl.ts +2 -1
- package/src/commands/gzip.ts +7 -0
- package/src/commands/helpers.ts +1 -1
- package/src/commands/history.ts +2 -2
- package/src/commands/man.ts +38 -143
- package/src/commands/manuals/adduser.txt +11 -0
- package/src/commands/manuals/apt-cache.txt +12 -0
- package/src/commands/manuals/apt.txt +20 -0
- package/src/commands/manuals/awk.txt +13 -0
- package/src/commands/manuals/cat.txt +14 -0
- package/src/commands/manuals/cd.txt +16 -0
- package/src/commands/manuals/chmod.txt +16 -0
- package/src/commands/manuals/clear.txt +10 -0
- package/src/commands/manuals/cp.txt +10 -0
- package/src/commands/manuals/curl.txt +20 -0
- package/src/commands/manuals/date.txt +14 -0
- package/src/commands/manuals/declare.txt +12 -0
- package/src/commands/manuals/deluser.txt +10 -0
- package/src/commands/manuals/df.txt +10 -0
- package/src/commands/manuals/dpkg-query.txt +11 -0
- package/src/commands/manuals/dpkg.txt +14 -0
- package/src/commands/manuals/du.txt +11 -0
- package/src/commands/manuals/echo.txt +11 -0
- package/src/commands/manuals/false.txt +10 -0
- package/src/commands/manuals/find.txt +11 -0
- package/src/commands/manuals/free.txt +12 -0
- package/src/commands/manuals/grep.txt +13 -0
- package/src/commands/manuals/groups.txt +10 -0
- package/src/commands/manuals/gzip.txt +11 -0
- package/src/commands/manuals/head.txt +10 -0
- package/src/commands/manuals/help.txt +11 -0
- package/src/commands/manuals/history.txt +11 -0
- package/src/commands/manuals/hostname.txt +10 -0
- package/src/commands/manuals/id.txt +10 -0
- package/src/commands/manuals/kill.txt +13 -0
- package/src/commands/manuals/ls.txt +20 -0
- package/src/commands/manuals/lsb_release.txt +14 -0
- package/src/commands/manuals/mkdir.txt +10 -0
- package/src/commands/manuals/mv.txt +10 -0
- package/src/commands/manuals/nano.txt +11 -0
- package/src/commands/manuals/neofetch.txt +10 -0
- package/src/commands/manuals/node.txt +13 -0
- package/src/commands/manuals/npm.txt +13 -0
- package/src/commands/manuals/npx.txt +13 -0
- package/src/commands/manuals/passwd.txt +11 -0
- package/src/commands/manuals/ping.txt +10 -0
- package/src/commands/manuals/printf.txt +11 -0
- package/src/commands/manuals/ps.txt +10 -0
- package/src/commands/manuals/pwd.txt +10 -0
- package/src/commands/manuals/python3.txt +13 -0
- package/src/commands/manuals/readlink.txt +10 -0
- package/src/commands/manuals/return.txt +10 -0
- package/src/commands/manuals/rm.txt +10 -0
- package/src/commands/manuals/sed.txt +11 -0
- package/src/commands/manuals/set.txt +11 -0
- package/src/commands/manuals/shift.txt +10 -0
- package/src/commands/manuals/sleep.txt +10 -0
- package/src/commands/manuals/sort.txt +12 -0
- package/src/commands/manuals/source.txt +11 -0
- package/src/commands/manuals/ssh.txt +11 -0
- package/src/commands/manuals/stat.txt +10 -0
- package/src/commands/manuals/su.txt +13 -0
- package/src/commands/manuals/sudo.txt +11 -0
- package/src/commands/manuals/tail.txt +10 -0
- package/src/commands/manuals/tar.txt +19 -0
- package/src/commands/manuals/tee.txt +10 -0
- package/src/commands/manuals/test.txt +11 -0
- package/src/commands/manuals/touch.txt +11 -0
- package/src/commands/manuals/tr.txt +10 -0
- package/src/commands/manuals/trap.txt +10 -0
- package/src/commands/manuals/true.txt +10 -0
- package/src/commands/manuals/type.txt +10 -0
- package/src/commands/manuals/uname.txt +12 -0
- package/src/commands/manuals/uniq.txt +12 -0
- package/src/commands/manuals/unset.txt +10 -0
- package/src/commands/manuals/uptime.txt +11 -0
- package/src/commands/manuals/wc.txt +12 -0
- package/src/commands/manuals/wget.txt +12 -0
- package/src/commands/manuals/which.txt +10 -0
- package/src/commands/manuals/whoami.txt +10 -0
- package/src/commands/manuals/xargs.txt +10 -0
- package/src/commands/neofetch.ts +7 -0
- package/src/commands/wget.ts +12 -1
- package/src/modules/linuxRootfs.ts +6 -6
- package/src/self-standalone.ts +190 -141
- package/tests/helpers.test.ts +3 -3
- package/tests/new-features.test.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/VirtualPackageManager/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAIhE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,6DAA6D;IAC7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Ac,IAAI,MAAM;IAI/B;;;;;;;;;;;;;OAaG;IACI,OAAO,CACb,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO,GAC5B;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAiHvC;;;;;;;;;;;;OAYG;IACI,MAAM,CACZ,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO,GAC7C;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IA4DvC;;;;;;OAMG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,EAAE;IAUhD;;;;;;OAMG;IACI,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAiBxC"}
|
|
@@ -472,7 +472,35 @@ const PACKAGE_REGISTRY = [
|
|
|
472
472
|
mode: 0o755,
|
|
473
473
|
},
|
|
474
474
|
],
|
|
475
|
-
},
|
|
475
|
+
}, {
|
|
476
|
+
name: "gzip",
|
|
477
|
+
version: "1.12-2",
|
|
478
|
+
section: "utils",
|
|
479
|
+
description: "GNU compression utility",
|
|
480
|
+
shortDesc: "compression utility",
|
|
481
|
+
installedSizeKb: 128,
|
|
482
|
+
files: [
|
|
483
|
+
{
|
|
484
|
+
path: "/usr/bin/gzip",
|
|
485
|
+
content: "#!/bin/sh\necho 'gzip: virtual stub'\n",
|
|
486
|
+
mode: 0o755,
|
|
487
|
+
},
|
|
488
|
+
]
|
|
489
|
+
}, {
|
|
490
|
+
name: "neofetch",
|
|
491
|
+
version: "7.1.0-1",
|
|
492
|
+
section: "utils",
|
|
493
|
+
description: "A command-line system information tool written in bash 3.2+",
|
|
494
|
+
shortDesc: "command-line system information tool",
|
|
495
|
+
installedSizeKb: 256,
|
|
496
|
+
files: [
|
|
497
|
+
{
|
|
498
|
+
path: "/usr/bin/neofetch",
|
|
499
|
+
content: "#!/bin/sh\necho 'neofetch: virtual stub'\n",
|
|
500
|
+
mode: 0o755,
|
|
501
|
+
},
|
|
502
|
+
],
|
|
503
|
+
}
|
|
476
504
|
];
|
|
477
505
|
/**
|
|
478
506
|
* Pure-TypeScript APT/dpkg package manager backed by a built-in registry.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/VirtualShell/shell.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;AAMvD,OAAO,EAGN,KAAK,YAAY,EAEjB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAwBpD,wBAAgB,UAAU,CACzB,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,aAAa,oBAAY,EACzB,YAAY,EAAE,YAAY,YAAyB,EACnD,KAAK,EAAE,YAAY,GACjB,IAAI,
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/VirtualShell/shell.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;AAMvD,OAAO,EAGN,KAAK,YAAY,EAEjB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAwBpD,wBAAgB,UAAU,CACzB,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,aAAa,oBAAY,EACzB,YAAY,EAAE,YAAY,YAAyB,EACnD,KAAK,EAAE,YAAY,GACjB,IAAI,CA0nBN"}
|
|
@@ -8,7 +8,7 @@ import { buildPrompt } from "../SSHMimic/prompt";
|
|
|
8
8
|
export function startShell(properties, stream, authUser, hostname, sessionId, remoteAddress = "unknown", terminalSize = { cols: 80, rows: 24 }, shell) {
|
|
9
9
|
let lineBuffer = "";
|
|
10
10
|
let cursorPos = 0;
|
|
11
|
-
let history = loadHistory(shell.vfs);
|
|
11
|
+
let history = loadHistory(shell.vfs, authUser);
|
|
12
12
|
let historyIndex = null;
|
|
13
13
|
let historyDraft = "";
|
|
14
14
|
let cwd = `/home/${authUser}`;
|
|
@@ -252,10 +252,10 @@ export function startShell(properties, stream, authUser, hostname, sessionId, re
|
|
|
252
252
|
history = history.slice(history.length - 500);
|
|
253
253
|
}
|
|
254
254
|
const data = history.length > 0 ? `${history.join("\n")}\n` : "";
|
|
255
|
-
shell.vfs.writeFile(
|
|
255
|
+
shell.vfs.writeFile(`/home/${authUser}/.bash_history`, data);
|
|
256
256
|
}
|
|
257
257
|
function readLastLogin() {
|
|
258
|
-
const lastlogPath = `/
|
|
258
|
+
const lastlogPath = `/home/${authUser}/.lastlog.json`;
|
|
259
259
|
if (!shell.vfs.exists(lastlogPath)) {
|
|
260
260
|
return null;
|
|
261
261
|
}
|
|
@@ -267,11 +267,7 @@ export function startShell(properties, stream, authUser, hostname, sessionId, re
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
function writeLastLogin(nowIso) {
|
|
270
|
-
const
|
|
271
|
-
if (!shell.vfs.exists(dir)) {
|
|
272
|
-
shell.vfs.mkdir(dir, 0o700);
|
|
273
|
-
}
|
|
274
|
-
const lastlogPath = `${dir}/${authUser}.json`;
|
|
270
|
+
const lastlogPath = `/home/${authUser}/.lastlog`;
|
|
275
271
|
shell.vfs.writeFile(lastlogPath, JSON.stringify({ at: nowIso, from: remoteAddress }));
|
|
276
272
|
}
|
|
277
273
|
function renderLoginBanner() {
|
|
@@ -492,8 +488,8 @@ export function startShell(properties, stream, authUser, hostname, sessionId, re
|
|
|
492
488
|
}
|
|
493
489
|
});
|
|
494
490
|
}
|
|
495
|
-
function loadHistory(vfs) {
|
|
496
|
-
const historyPath =
|
|
491
|
+
function loadHistory(vfs, authUser) {
|
|
492
|
+
const historyPath = `/home/${authUser}/.bash_history`;
|
|
497
493
|
if (!vfs.exists(historyPath)) {
|
|
498
494
|
vfs.writeFile(historyPath, "");
|
|
499
495
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/VirtualUserManager/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAE1D,gDAAgD;AAChD,MAAM,WAAW,iBAAiB;IACjC,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,2DAA2D;AAC3D,MAAM,WAAW,oBAAoB;IACpC,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;CAClB;AAYD;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAqBlD,OAAO,CAAC,QAAQ,CAAC,GAAG;IAGpB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IAvBrC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAwC;IAC3E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAA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ACI,iBAAiB,CACvB,QAAQ,EAAE,MAAM,GACd,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAGxC"}
|
|
@@ -18,10 +18,10 @@ export class VirtualUserManager extends EventEmitter {
|
|
|
18
18
|
autoSudoForNewUsers;
|
|
19
19
|
static recordCache = new Map();
|
|
20
20
|
static fastPasswordHash = resolveFastPasswordHash();
|
|
21
|
-
usersPath = "/
|
|
22
|
-
sudoersPath = "/
|
|
23
|
-
quotasPath = "/
|
|
24
|
-
authDirPath = "
|
|
21
|
+
usersPath = "/etc/htpasswd";
|
|
22
|
+
sudoersPath = "/etc/sudoers";
|
|
23
|
+
quotasPath = "/etc/quotas";
|
|
24
|
+
authDirPath = "/.virtual-env-js/.auth";
|
|
25
25
|
users = new Map();
|
|
26
26
|
sudoers = new Set();
|
|
27
27
|
quotas = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../src/commands/curl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../src/commands/curl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAyIzB,CAAC"}
|
package/dist/commands/curl.js
CHANGED
|
@@ -81,7 +81,8 @@ export const curlCommand = {
|
|
|
81
81
|
}
|
|
82
82
|
let response;
|
|
83
83
|
try {
|
|
84
|
-
|
|
84
|
+
const urlWithHttp = url.startsWith("http://") || url.startsWith("https://") ? url : `http://${url}`;
|
|
85
|
+
response = await fetch(urlWithHttp, fetchOpts);
|
|
85
86
|
}
|
|
86
87
|
catch (err) {
|
|
87
88
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../../src/commands/gzip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../../src/commands/gzip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,WAgDzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,WA0B3B,CAAC"}
|
package/dist/commands/gzip.js
CHANGED
|
@@ -9,6 +9,12 @@ export const gzipCommand = {
|
|
|
9
9
|
category: "archive",
|
|
10
10
|
params: ["[-k] [-d] <file>"],
|
|
11
11
|
run: ({ shell, cwd, args }) => {
|
|
12
|
+
if (!shell.packageManager.isInstalled("gzip")) {
|
|
13
|
+
return {
|
|
14
|
+
stderr: "bash: gzip: command not found\nHint: install it with: apt install gzip\n",
|
|
15
|
+
exitCode: 127,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
12
18
|
const keepOrig = args.includes("-k") || args.includes("--keep");
|
|
13
19
|
const decompress = args.includes("-d");
|
|
14
20
|
const file = args.find((a) => !a.startsWith("-"));
|
package/dist/commands/helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
const PROTECTED_PREFIXES = ["
|
|
3
|
+
const PROTECTED_PREFIXES = ["/.virtual-env-js/.auth", "/etc/htpasswd"];
|
|
4
4
|
function normalizeFetchUrl(input) {
|
|
5
5
|
if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(input)) {
|
|
6
6
|
return input;
|
package/dist/commands/history.js
CHANGED
|
@@ -8,9 +8,9 @@ export const historyCommand = {
|
|
|
8
8
|
description: "Display command history",
|
|
9
9
|
category: "shell",
|
|
10
10
|
params: ["[n]"],
|
|
11
|
-
run: ({ args, shell }) => {
|
|
11
|
+
run: ({ args, shell, authUser }) => {
|
|
12
12
|
// History is persisted in the VFS by the interactive shell
|
|
13
|
-
const histPath =
|
|
13
|
+
const histPath = `/home/${authUser}/.bash_history`;
|
|
14
14
|
if (!shell.vfs.exists(histPath)) {
|
|
15
15
|
return { stdout: "", exitCode: 0 };
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"man.d.ts","sourceRoot":"","sources":["../../src/commands/man.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"man.d.ts","sourceRoot":"","sources":["../../src/commands/man.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAwCrD,eAAO,MAAM,UAAU,EAAE,WAoBxB,CAAC"}
|
package/dist/commands/man.js
CHANGED
|
@@ -1,144 +1,38 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
NAME
|
|
5
|
-
ls - list directory contents
|
|
6
|
-
|
|
7
|
-
SYNOPSIS
|
|
8
|
-
ls [OPTION]... [FILE]...
|
|
9
|
-
|
|
10
|
-
DESCRIPTION
|
|
11
|
-
List information about the FILEs (the current directory by default).
|
|
12
|
-
|
|
13
|
-
OPTIONS
|
|
14
|
-
-l use a long listing format
|
|
15
|
-
-a do not ignore entries starting with .
|
|
16
|
-
-h with -l, print human readable sizes
|
|
17
|
-
-r reverse order while sorting
|
|
18
|
-
-t sort by modification time
|
|
19
|
-
|
|
20
|
-
AUTHOR
|
|
21
|
-
Written by Richard M. Stallman and David MacKenzie.`,
|
|
22
|
-
cat: `CAT(1) User Commands CAT(1)
|
|
23
|
-
|
|
24
|
-
NAME
|
|
25
|
-
cat - concatenate files and print on the standard output
|
|
26
|
-
|
|
27
|
-
SYNOPSIS
|
|
28
|
-
cat [OPTION]... [FILE]...
|
|
29
|
-
|
|
30
|
-
DESCRIPTION
|
|
31
|
-
Concatenate FILE(s) to standard output.
|
|
32
|
-
|
|
33
|
-
OPTIONS
|
|
34
|
-
-n, --number number all output lines
|
|
35
|
-
-b, --number-nonblank number nonempty output lines`,
|
|
36
|
-
grep: `GREP(1) User Commands GREP(1)
|
|
37
|
-
|
|
38
|
-
NAME
|
|
39
|
-
grep, egrep, fgrep - print lines that match patterns
|
|
40
|
-
|
|
41
|
-
SYNOPSIS
|
|
42
|
-
grep [OPTION]... PATTERNS [FILE]...
|
|
43
|
-
|
|
44
|
-
OPTIONS
|
|
45
|
-
-i, --ignore-case ignore case distinctions in patterns and data
|
|
46
|
-
-v, --invert-match select non-matching lines
|
|
47
|
-
-n, --line-number print line number with output lines
|
|
48
|
-
-r, --recursive read all files under each directory, recursively`,
|
|
49
|
-
apt: `APT(8) APT APT(8)
|
|
50
|
-
|
|
51
|
-
NAME
|
|
52
|
-
apt - command-line interface
|
|
53
|
-
|
|
54
|
-
SYNOPSIS
|
|
55
|
-
apt [options] command
|
|
56
|
-
|
|
57
|
-
DESCRIPTION
|
|
58
|
-
apt provides a high-level commandline interface for the package
|
|
59
|
-
management system.
|
|
60
|
-
|
|
61
|
-
COMMANDS
|
|
62
|
-
install pkg... Install packages
|
|
63
|
-
remove pkg... Remove packages
|
|
64
|
-
update Download package information
|
|
65
|
-
upgrade Upgrade installed packages
|
|
66
|
-
search term Search in package descriptions
|
|
67
|
-
show pkg Show package information
|
|
68
|
-
list List packages`,
|
|
69
|
-
ssh: `SSH(1) OpenSSH SSH(1)
|
|
70
|
-
|
|
71
|
-
NAME
|
|
72
|
-
ssh - OpenSSH remote login client
|
|
73
|
-
|
|
74
|
-
SYNOPSIS
|
|
75
|
-
ssh [-p port] [user@]hostname [command]
|
|
76
|
-
|
|
77
|
-
DESCRIPTION
|
|
78
|
-
ssh (SSH client) is a program for logging into a remote machine and
|
|
79
|
-
for executing commands on a remote machine.`,
|
|
80
|
-
curl: `CURL(1) User Commands CURL(1)
|
|
81
|
-
|
|
82
|
-
NAME
|
|
83
|
-
curl - transfer a URL
|
|
84
|
-
|
|
85
|
-
SYNOPSIS
|
|
86
|
-
curl [options / URLs]
|
|
87
|
-
|
|
88
|
-
DESCRIPTION
|
|
89
|
-
curl is a tool for transferring data with URL syntax.
|
|
90
|
-
|
|
91
|
-
OPTIONS
|
|
92
|
-
-o, --output <file> Write output to <file>
|
|
93
|
-
-X, --request <method> Specify request method
|
|
94
|
-
-d, --data <data> HTTP POST data
|
|
95
|
-
-H, --header <header> Pass custom header
|
|
96
|
-
-s, --silent Silent mode
|
|
97
|
-
-I, --head Show document info only
|
|
98
|
-
-L, --location Follow redirects
|
|
99
|
-
-v, --verbose Make the operation more talkative`,
|
|
100
|
-
chmod: `CHMOD(1) User Commands CHMOD(1)
|
|
101
|
-
|
|
102
|
-
NAME
|
|
103
|
-
chmod - change file mode bits
|
|
104
|
-
|
|
105
|
-
SYNOPSIS
|
|
106
|
-
chmod [OPTION]... MODE[,MODE]... FILE...
|
|
107
|
-
chmod [OPTION]... OCTAL-MODE FILE...
|
|
108
|
-
|
|
109
|
-
DESCRIPTION
|
|
110
|
-
Change the file mode bits of each given file according to MODE.
|
|
111
|
-
|
|
112
|
-
EXAMPLES
|
|
113
|
-
chmod 755 script.sh rwxr-xr-x
|
|
114
|
-
chmod 644 file.txt rw-r--r--
|
|
115
|
-
chmod +x script.sh add execute permission`,
|
|
116
|
-
tar: `TAR(1) GNU tar Manual TAR(1)
|
|
117
|
-
|
|
118
|
-
NAME
|
|
119
|
-
tar - an archiving utility
|
|
120
|
-
|
|
121
|
-
SYNOPSIS
|
|
122
|
-
tar [OPTION...] [FILE]...
|
|
123
|
-
|
|
124
|
-
DESCRIPTION
|
|
125
|
-
tar saves many files together into a single tape or disk archive,
|
|
126
|
-
and can restore individual files from the archive.
|
|
127
|
-
|
|
128
|
-
OPTIONS
|
|
129
|
-
-c, --create create a new archive
|
|
130
|
-
-x, --extract extract files from an archive
|
|
131
|
-
-z, --gzip filter the archive through gzip
|
|
132
|
-
-f, --file=ARCHIVE use archive file or device ARCHIVE
|
|
133
|
-
-v, --verbose verbosely list files processed
|
|
134
|
-
-t, --list list the contents of an archive`,
|
|
1
|
+
const MANUAL_ALIASES = {
|
|
2
|
+
gunzip: "gzip",
|
|
135
3
|
};
|
|
4
|
+
const manualCache = new Map();
|
|
5
|
+
const manualsBaseUrl = new URL("./manuals/", import.meta.url);
|
|
6
|
+
async function dynamicImport(specifier) {
|
|
7
|
+
const importer = new Function("moduleName", "return import(moduleName)");
|
|
8
|
+
return importer(specifier);
|
|
9
|
+
}
|
|
10
|
+
async function loadBundledManual(commandName) {
|
|
11
|
+
const normalized = commandName.toLowerCase();
|
|
12
|
+
const lookupName = MANUAL_ALIASES[normalized] ?? normalized;
|
|
13
|
+
const cacheKey = `builtin:${lookupName}`;
|
|
14
|
+
if (manualCache.has(cacheKey)) {
|
|
15
|
+
return manualCache.get(cacheKey) ?? null;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const fsModule = (await dynamicImport("node:fs/promises"));
|
|
19
|
+
const manualUrl = new URL(`${lookupName}.txt`, manualsBaseUrl);
|
|
20
|
+
const content = await fsModule.readFile(manualUrl, "utf8");
|
|
21
|
+
const page = content.replace(/\n$/, "");
|
|
22
|
+
manualCache.set(cacheKey, page);
|
|
23
|
+
return page;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
manualCache.set(cacheKey, null);
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
136
30
|
export const manCommand = {
|
|
137
31
|
name: "man",
|
|
138
32
|
description: "Interface to the system reference manuals",
|
|
139
33
|
category: "shell",
|
|
140
34
|
params: ["<command>"],
|
|
141
|
-
run: ({ args, shell }) => {
|
|
35
|
+
run: async ({ args, shell }) => {
|
|
142
36
|
const name = args[0];
|
|
143
37
|
if (!name)
|
|
144
38
|
return { stderr: "What manual page do you want?", exitCode: 1 };
|
|
@@ -147,7 +41,7 @@ export const manCommand = {
|
|
|
147
41
|
if (shell.vfs.exists(manPath)) {
|
|
148
42
|
return { stdout: shell.vfs.readFile(manPath), exitCode: 0 };
|
|
149
43
|
}
|
|
150
|
-
const page =
|
|
44
|
+
const page = await loadBundledManual(name);
|
|
151
45
|
if (page)
|
|
152
46
|
return { stdout: page, exitCode: 0 };
|
|
153
47
|
return { stderr: `No manual entry for ${name}`, exitCode: 16 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"neofetch.d.ts","sourceRoot":"","sources":["../../src/commands/neofetch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"neofetch.d.ts","sourceRoot":"","sources":["../../src/commands/neofetch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,WA2C7B,CAAC"}
|
|
@@ -11,6 +11,12 @@ export const neofetchCommand = {
|
|
|
11
11
|
category: "system",
|
|
12
12
|
params: ["[--off]"],
|
|
13
13
|
run: ({ args, authUser, hostname, shell, env }) => {
|
|
14
|
+
if (!shell.packageManager.isInstalled("neofetch")) {
|
|
15
|
+
return {
|
|
16
|
+
stderr: "bash: neofetch: command not found\nHint: install it with: apt install neofetch\n",
|
|
17
|
+
exitCode: 127,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
14
20
|
if (ifFlag(args, "--help")) {
|
|
15
21
|
return {
|
|
16
22
|
stdout: "Usage: neofetch [--off]",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wget.d.ts","sourceRoot":"","sources":["../../src/commands/wget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"wget.d.ts","sourceRoot":"","sources":["../../src/commands/wget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WA0IzB,CAAC"}
|
package/dist/commands/wget.js
CHANGED
|
@@ -44,7 +44,17 @@ export const wgetCommand = {
|
|
|
44
44
|
exitCode: 0,
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const urlWithoutProtocol = positionals[0];
|
|
48
|
+
if (!urlWithoutProtocol) {
|
|
49
|
+
return {
|
|
50
|
+
stderr: "wget: missing URL\nUsage: wget [OPTION]... [URL]...",
|
|
51
|
+
exitCode: 1,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const url = urlWithoutProtocol.startsWith("http://") ||
|
|
55
|
+
urlWithoutProtocol.startsWith("https://")
|
|
56
|
+
? urlWithoutProtocol
|
|
57
|
+
: `http://${urlWithoutProtocol}`;
|
|
48
58
|
if (!url)
|
|
49
59
|
return {
|
|
50
60
|
stderr: "wget: missing URL\nUsage: wget [OPTION]... [URL]...",
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* Called once during VirtualShell initialization. Idempotent — skips
|
|
7
7
|
* paths that already exist so FS-mode snapshots survive restarts.
|
|
8
8
|
*/
|
|
9
|
-
import type { ShellProperties } from "../VirtualShell";
|
|
10
9
|
import type VirtualFileSystem from "../VirtualFileSystem";
|
|
10
|
+
import type { ShellProperties } from "../VirtualShell";
|
|
11
11
|
import type { VirtualUserManager } from "../VirtualUserManager";
|
|
12
12
|
/**
|
|
13
13
|
* Sync `/etc/passwd`, `/etc/group`, and `/etc/shadow` from the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linuxRootfs.d.ts","sourceRoot":"","sources":["../../src/modules/linuxRootfs.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE;;;;;;GAMG;AAGH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"linuxRootfs.d.ts","sourceRoot":"","sources":["../../src/modules/linuxRootfs.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE;;;;;;GAMG;AAGH,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAgHhE;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,kBAAkB,GACvB,IAAI,CAsCN;AAgED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAC1B,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,QAAQ,CAAC,EAAE,OAAO,uBAAuB,EAAE,oBAAoB,EAAE,GAC/D,IAAI,CAmJN;AAuND;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,eAAe,EACtB,cAAc,EAAE,MAAM,GACpB,IAAI,CAYN"}
|
|
@@ -394,18 +394,18 @@ function bootstrapTmp(vfs) {
|
|
|
394
394
|
// ─── /root ────────────────────────────────────────────────────────────────────
|
|
395
395
|
function bootstrapRoot(vfs) {
|
|
396
396
|
ensureDir(vfs, "/root", 0o700);
|
|
397
|
-
ensureFile(vfs, "/root/.bashrc", `${[
|
|
397
|
+
ensureFile(vfs, "/home/root/.bashrc", `${[
|
|
398
398
|
"# root .bashrc",
|
|
399
399
|
"export PS1='\\[\\033[0;31m\\]\\u@\\h\\[\\033[0m\\]:\\[\\033[0;34m\\]\\w\\[\\033[0m\\]# '",
|
|
400
400
|
"export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
|
401
401
|
"alias ll='ls -la'",
|
|
402
402
|
"alias la='ls -A'",
|
|
403
403
|
].join("\n")}\n`);
|
|
404
|
-
ensureFile(vfs, "/root/.profile", "[ -f ~/.bashrc ] && . ~/.bashrc\n");
|
|
404
|
+
ensureFile(vfs, "/home/root/.profile", "[ -f ~/.bashrc ] && . ~/.bashrc\n");
|
|
405
405
|
// Fix: /home/root should map to /root for root user
|
|
406
|
-
if (!vfs.exists("/home/root")) {
|
|
407
|
-
|
|
408
|
-
}
|
|
406
|
+
// if (!vfs.exists("/home/root")) {
|
|
407
|
+
// vfs.symlink("/root", "/home/root");
|
|
408
|
+
// }
|
|
409
409
|
}
|
|
410
410
|
// ─── /opt + /srv + /mnt + /media ─────────────────────────────────────────────
|
|
411
411
|
function bootstrapMisc(vfs) {
|