mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Allow specifying installation directory
This commit is contained in:
@@ -29,7 +29,7 @@ To also install the newly built application, use `--create-debian-package` or `-
|
||||
* `--compress-artifacts`: zips the generated application as `out/atom-{arch}.tar.gz`.
|
||||
* `--create-debian-package`: creates a .deb package as `out/atom-{arch}.deb`
|
||||
* `--create-rpm-package`: creates a .rpm package as `out/atom-{arch}.rpm`
|
||||
* `--install`: installs the application in `/usr/local/`.
|
||||
* `--install[=dir]`: installs the application in `${dir}`; `${dir}` defaults to `/usr/local`.
|
||||
|
||||
### Ubuntu / Debian
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ To also install the newly built application, use `script/build --install`.
|
||||
|
||||
* `--code-sign`: signs the application with the GitHub certificate specified in `$ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL`.
|
||||
* `--compress-artifacts`: zips the generated application as `out/atom-mac.zip`.
|
||||
* `--install`: installs the application at `/Applications/Atom.app` for dev and stable versions or at `/Applications/Atom-Beta.app` for beta versions.
|
||||
* `--install[=dir]`: installs the application at `${dir}/Atom.app` for dev and stable versions or at `${dir}/Atom-Beta.app` for beta versions; `${dir}` defaults to `/Applications`.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ To also install the newly built application, use `script\build --create-windows-
|
||||
* `--code-sign`: signs the application with the GitHub certificate specified in `$WIN_P12KEY_URL`.
|
||||
* `--compress-artifacts`: zips the generated application as `out\atom-windows.zip` (requires [7-Zip](http://www.7-zip.org)).
|
||||
* `--create-windows-installer`: creates an `.msi`, an `.exe` and two `.nupkg` packages in the `out` directory.
|
||||
* `--install`: installs the application in `%LOCALAPPDATA%\Atom\app-dev\`.
|
||||
* `--install[=dir]`: installs the application in `${dir}\Atom\app-dev`; `${dir}` defaults to `%LOCALAPPDATA%`.
|
||||
|
||||
### Running tests
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ const argv = yargs
|
||||
.describe('create-rpm-package', 'Create .rpm package (Linux only)')
|
||||
.describe('compress-artifacts', 'Compress Atom binaries (and symbols on macOS)')
|
||||
.describe('install', 'Install Atom')
|
||||
.string('install')
|
||||
.wrap(yargs.terminalWidth())
|
||||
.argv
|
||||
|
||||
@@ -99,8 +100,8 @@ dumpSymbols()
|
||||
console.log('Skipping artifacts compression. Specify the --compress-artifacts option to compress Atom binaries (and symbols on macOS)'.gray)
|
||||
}
|
||||
|
||||
if (argv.install) {
|
||||
installApplication(packagedAppPath)
|
||||
if (argv.install != null) {
|
||||
installApplication(packagedAppPath, argv.install)
|
||||
} else {
|
||||
console.log('Skipping installation. Specify the --install option to install Atom'.gray)
|
||||
}
|
||||
|
||||
@@ -7,10 +7,11 @@ const template = require('lodash.template')
|
||||
|
||||
const CONFIG = require('../config')
|
||||
|
||||
module.exports = function (packagedAppPath) {
|
||||
module.exports = function (packagedAppPath, installDir) {
|
||||
const packagedAppFileName = path.basename(packagedAppPath)
|
||||
if (process.platform === 'darwin') {
|
||||
const installationDirPath = path.join(path.sep, 'Applications', packagedAppFileName)
|
||||
const installPrefix = installDir !== '' ? installDir : path.join(path.sep, 'Applications')
|
||||
const installationDirPath = path.join(installPrefix, packagedAppFileName)
|
||||
if (fs.existsSync(installationDirPath)) {
|
||||
console.log(`Removing previously installed "${packagedAppFileName}" at "${installationDirPath}"`)
|
||||
fs.removeSync(installationDirPath)
|
||||
@@ -18,7 +19,8 @@ module.exports = function (packagedAppPath) {
|
||||
console.log(`Installing "${packagedAppPath}" at "${installationDirPath}"`)
|
||||
fs.copySync(packagedAppPath, installationDirPath)
|
||||
} else if (process.platform === 'win32') {
|
||||
const installationDirPath = path.join(process.env.LOCALAPPDATA, packagedAppFileName, 'app-dev')
|
||||
const installPrefix = installDir !== '' ? installDir : process.env.LOCALAPPDATA
|
||||
const installationDirPath = path.join(installPrefix, packagedAppFileName, 'app-dev')
|
||||
try {
|
||||
if (fs.existsSync(installationDirPath)) {
|
||||
console.log(`Removing previously installed "${packagedAppFileName}" at "${installationDirPath}"`)
|
||||
@@ -39,12 +41,12 @@ module.exports = function (packagedAppPath) {
|
||||
const apmExecutableName = CONFIG.channel === 'beta' ? 'apm-beta' : 'apm'
|
||||
const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom'
|
||||
const appDescription = CONFIG.appMetadata.description
|
||||
const userLocalDirPath = path.join('/usr', 'local')
|
||||
const shareDirPath = path.join(userLocalDirPath, 'share')
|
||||
const prefixDirPath = installDir !== '' ? installDir : path.join('/usr', 'local')
|
||||
const shareDirPath = path.join(prefixDirPath, 'share')
|
||||
const installationDirPath = path.join(shareDirPath, atomExecutableName)
|
||||
const applicationsDirPath = path.join(shareDirPath, 'applications')
|
||||
const desktopEntryPath = path.join(applicationsDirPath, `${atomExecutableName}.desktop`)
|
||||
const binDirPath = path.join(userLocalDirPath, 'bin')
|
||||
const binDirPath = path.join(prefixDirPath, 'bin')
|
||||
const atomBinDestinationPath = path.join(binDirPath, atomExecutableName)
|
||||
const apmBinDestinationPath = path.join(binDirPath, apmExecutableName)
|
||||
|
||||
@@ -67,7 +69,7 @@ module.exports = function (packagedAppPath) {
|
||||
const desktopEntryTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.desktop.in'))
|
||||
const desktopEntryContents = template(desktopEntryTemplate)({
|
||||
appName, appFileName: atomExecutableName, description: appDescription,
|
||||
installDir: '/usr', iconPath
|
||||
installDir: prefixDirPath, iconPath
|
||||
})
|
||||
fs.writeFileSync(desktopEntryPath, desktopEntryContents)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user