restringir permisos cuando se hace alpine.writeFile
This commit is contained in:
parent
a90539fcd7
commit
b382e31374
1 changed files with 6 additions and 6 deletions
12
alpine.ts
12
alpine.ts
|
@ -37,13 +37,13 @@ export class Alpine {
|
|||
content: string,
|
||||
permissions?: { uid: number; gid: number }
|
||||
): Promise<void> {
|
||||
const p = path.join(this.dir, filePath);
|
||||
await this.mkdirP(path.dirname(filePath));
|
||||
await sudoWriteFile(path.join(this.dir, filePath), content);
|
||||
if (permissions)
|
||||
await sudoChown(
|
||||
path.join(this.dir, filePath),
|
||||
`${permissions.uid}:${permissions.gid}`
|
||||
);
|
||||
await sudoWriteFile(p, content);
|
||||
if (permissions) {
|
||||
await sudoChown(p, `${permissions.uid}:${permissions.gid}`);
|
||||
await sudoChmod(p, "600");
|
||||
}
|
||||
}
|
||||
async writeExecutable(filePath: string, content: string): Promise<void> {
|
||||
await this.writeFile(filePath, content);
|
||||
|
|
Loading…
Reference in a new issue