diff --git a/alpine.ts b/alpine.ts index 9d1c1a2..02b7836 100644 --- a/alpine.ts +++ b/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 { - 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({ diff --git a/helpers/logger.ts b/helpers/logger.ts new file mode 100644 index 0000000..66d0dea --- /dev/null +++ b/helpers/logger.ts @@ -0,0 +1,3 @@ +export function logDebug(scope: string, message: any) { + if (process.argv.includes("-v")) console.debug(`[${scope}]`, message); +}