permitir logear cosas de debug
This commit is contained in:
parent
92c82d5ad8
commit
bd12d308d0
2 changed files with 15 additions and 8 deletions
20
alpine.ts
20
alpine.ts
|
@ -12,6 +12,7 @@ import { Fstab } from "./fstab.js";
|
|||
import { execFile } from "./helpers/better-api.js";
|
||||
import { PasswdEntry, sudoReadPasswd } from "./helpers/passwd.js";
|
||||
import { sudoWriteExecutable } from "./helpers/sudo.js";
|
||||
import { logDebug } from "./helpers/logger.js";
|
||||
|
||||
export class Alpine {
|
||||
dir: string;
|
||||
|
@ -76,14 +77,17 @@ export class Alpine {
|
|||
}
|
||||
|
||||
async addPackages(packages: string[]): Promise<void> {
|
||||
await execFile("sudo", [
|
||||
"apk",
|
||||
"add",
|
||||
"--clean-protected",
|
||||
"--root",
|
||||
this.dir,
|
||||
...packages,
|
||||
]);
|
||||
logDebug(
|
||||
"addPackages",
|
||||
await execFile("sudo", [
|
||||
"apk",
|
||||
"add",
|
||||
"--clean-protected",
|
||||
"--root",
|
||||
this.dir,
|
||||
...packages,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
static async makeWorld({
|
||||
|
|
3
helpers/logger.ts
Normal file
3
helpers/logger.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export function logDebug(scope: string, message: any) {
|
||||
if (process.argv.includes("-v")) console.debug(`[${scope}]`, message);
|
||||
}
|
Loading…
Reference in a new issue