From 21e715fa23ea1e4da1dbc2568f23abc9ac40defc Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Thu, 29 Aug 2019 06:46:34 -0700 Subject: [PATCH] fix: ensure scripts have the executable bit set (#211) --- src/installer.js | 5 +++-- test/fixtures/debian-scripts/preinst.sh | 0 2 files changed, 3 insertions(+), 2 deletions(-) mode change 100755 => 100644 test/fixtures/debian-scripts/preinst.sh diff --git a/src/installer.js b/src/installer.js index 3894b14..4424d56 100644 --- a/src/installer.js +++ b/src/installer.js @@ -67,12 +67,13 @@ class DebianInstaller extends common.ElectronInstaller { const scriptNames = ['preinst', 'postinst', 'prerm', 'postrm'] return common.wrapError('creating script files', async () => - Promise.all(_.map(this.options.scripts, (item, key) => { + Promise.all(_.map(this.options.scripts, async (item, key) => { if (scriptNames.includes(key)) { const scriptFile = path.join(this.stagingDir, 'DEBIAN', key) this.options.logger(`Creating script file at ${scriptFile}`) - return fs.copy(item, scriptFile) + await fs.copy(item, scriptFile) + return fs.chmod(scriptFile, 0o755) } else { throw new Error(`Wrong executable script name: ${key}`) } diff --git a/test/fixtures/debian-scripts/preinst.sh b/test/fixtures/debian-scripts/preinst.sh old mode 100755 new mode 100644