/** Shared helpers for drive-resident /bin scripts (prepended before each command). */ function bareStdin(ctx) { return typeof ctx.shellStdin === 'string' ? ctx.shellStdin : '' } async function run(ctx, argv) { const e = ctx.vfs.env const u = e.USER || e.LOGNAME || 'guest' const uid = e.UID || (e.BARE_OS_IDENTITY === 'guest' ? '65534' : '1000') const gid = e.GID || (e.BARE_OS_IDENTITY === 'guest' ? '65534' : '1000') const g = e.GROUP || u const rest = argv.slice(1) const wantG = rest.includes('-g') || rest.includes('--group') const wantU = rest.includes('-u') || rest.includes('--user') const wantN = rest.includes('-n') || rest.includes('--name') if (wantU && wantN) { ctx.console.log(u) return } if (wantG && wantN) { ctx.console.log(g) return } if (wantU) { ctx.console.log(uid) return } if (wantG) { ctx.console.log(gid) return } ctx.console.log( 'uid=' + uid + '(' + u + ') gid=' + gid + '(' + g + ') groups=' + gid + '(' + g + ')' ) }