mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Replace runas with fs-admin in install-application script
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
@echo off
|
||||
|
||||
set USAGE=Usage: %0 source destination
|
||||
|
||||
if [%1] == [] (
|
||||
echo %USAGE%
|
||||
exit 1
|
||||
)
|
||||
if [%2] == [] (
|
||||
echo %USAGE%
|
||||
exit 2
|
||||
)
|
||||
|
||||
:: rm -rf %2
|
||||
if exist %2 rmdir %2 /s /q
|
||||
|
||||
:: cp -rf %1 %2
|
||||
(robocopy %1 %2 /e) ^& IF %ERRORLEVEL% LEQ 1 exit 0
|
||||
@@ -3,7 +3,6 @@
|
||||
const fs = require('fs-extra')
|
||||
const handleTilde = require('./handle-tilde')
|
||||
const path = require('path')
|
||||
const runas = require('runas')
|
||||
const template = require('lodash.template')
|
||||
|
||||
const CONFIG = require('../config')
|
||||
@@ -31,11 +30,12 @@ module.exports = function (packagedAppPath, installDir) {
|
||||
fs.copySync(packagedAppPath, installationDirPath)
|
||||
} catch (e) {
|
||||
console.log(`Administrator elevation required to install into "${installationDirPath}"`)
|
||||
const copyScriptPath = path.join(CONFIG.repositoryRootPath, 'script', 'copy-folder.cmd')
|
||||
const exitCode = runas('cmd', ['/c', copyScriptPath, packagedAppPath, installationDirPath], {admin: true})
|
||||
if (exitCode !== 0) {
|
||||
throw new Error(`Installation failed. "${copyScriptPath}" exited with status: ${exitCode}`)
|
||||
}
|
||||
const fsAdmin = require('fs-admin')
|
||||
return new Promise((resolve, reject) => {
|
||||
fsAdmin.recursiveCopy(packagedAppPath, installationDirPath, (error) => {
|
||||
error ? reject(error) : resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
const atomExecutableName = CONFIG.channel === 'beta' ? 'atom-beta' : 'atom'
|
||||
@@ -95,4 +95,6 @@ module.exports = function (packagedAppPath, installDir) {
|
||||
console.log(`Changing permissions to 755 for "${installationDirPath}"`)
|
||||
fs.chmodSync(installationDirPath, '755')
|
||||
}
|
||||
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"electron-mksnapshot": "~1.6",
|
||||
"electron-packager": "7.3.0",
|
||||
"electron-winstaller": "2.6.2",
|
||||
"fs-admin": "^0.1.5",
|
||||
"fs-extra": "0.30.0",
|
||||
"glob": "7.0.3",
|
||||
"joanna": "0.0.9",
|
||||
@@ -25,7 +26,6 @@
|
||||
"npm": "5.3.0",
|
||||
"passwd-user": "2.1.0",
|
||||
"pegjs": "0.9.0",
|
||||
"runas": "3.1.1",
|
||||
"season": "5.3.0",
|
||||
"semver": "5.3.0",
|
||||
"standard": "8.4.0",
|
||||
|
||||
Reference in New Issue
Block a user