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,
|
content: string,
|
||||||
permissions?: { uid: number; gid: number }
|
permissions?: { uid: number; gid: number }
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
const p = path.join(this.dir, filePath);
|
||||||
await this.mkdirP(path.dirname(filePath));
|
await this.mkdirP(path.dirname(filePath));
|
||||||
await sudoWriteFile(path.join(this.dir, filePath), content);
|
await sudoWriteFile(p, content);
|
||||||
if (permissions)
|
if (permissions) {
|
||||||
await sudoChown(
|
await sudoChown(p, `${permissions.uid}:${permissions.gid}`);
|
||||||
path.join(this.dir, filePath),
|
await sudoChmod(p, "600");
|
||||||
`${permissions.uid}:${permissions.gid}`
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
async writeExecutable(filePath: string, content: string): Promise<void> {
|
async writeExecutable(filePath: string, content: string): Promise<void> {
|
||||||
await this.writeFile(filePath, content);
|
await this.writeFile(filePath, content);
|
||||||
|
|
Loading…
Reference in a new issue