Include the Linux bin command in the main dir

This also changes the behavior of the bin command to find cli.js relatively,
meaning the CLI now supports non-standard install locations.
This commit is contained in:
Daniel Imms 2016-04-05 14:50:59 -07:00
parent 117b3eba24
commit cd12a7e389
3 changed files with 20 additions and 15 deletions

View file

@ -238,6 +238,10 @@ function packageTask(platform, arch, opts) {
result = es.merge(result, gulp.src('resources/win32/bin/code.sh', { base: 'resources/win32' })
.pipe(replace('@@NAME@@', product.nameShort))
.pipe(rename(function (f) { f.basename = product.applicationName; f.extname = ''; })));
} else if (platform === 'linux') {
result = es.merge(result, gulp.src('resources/linux/bin/code.sh', { base: '.' })
.pipe(replace('@@NAME@@', product.applicationName))
.pipe(rename('bin/' + product.applicationName)));
}
return result.pipe(symdest(destination));
@ -259,10 +263,6 @@ function prepareDebPackage(arch) {
var packageRevision = getEpochTime();
return function () {
var shortcut = gulp.src('resources/linux/bin/code.sh', { base: '.' })
.pipe(replace('@@NAME@@', product.applicationName))
.pipe(rename('usr/share/' + product.applicationName + '/bin/' + product.applicationName));
var desktop = gulp.src('resources/linux/code.desktop', { base: '.' })
.pipe(replace('@@NAME_LONG@@', product.nameLong))
.pipe(replace('@@NAME@@', product.applicationName))
@ -299,7 +299,7 @@ function prepareDebPackage(arch) {
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
.pipe(rename('DEBIAN/postinst'))
var all = es.merge(control, postinst, prerm, desktop, icon, shortcut, code);
var all = es.merge(control, postinst, prerm, desktop, icon, code);
return all.pipe(symdest(destination));
};
@ -335,10 +335,6 @@ function prepareRpmPackage(arch) {
var packageRevision = getEpochTime();
return function () {
var shortcut = gulp.src('resources/linux/bin/code.sh', { base: '.' })
.pipe(replace('@@NAME@@', product.applicationName))
.pipe(rename('BUILD/usr/share/' + product.applicationName + '/bin/' + product.applicationName));
var desktop = gulp.src('resources/linux/code.desktop', { base: '.' })
.pipe(replace('@@NAME_LONG@@', product.nameLong))
.pipe(replace('@@NAME@@', product.applicationName))
@ -363,7 +359,7 @@ function prepareRpmPackage(arch) {
var specIcon = gulp.src('resources/linux/rpm/code.xpm', { base: '.' })
.pipe(rename('SOURCES/' + product.applicationName + '.xpm'));
var all = es.merge(code, desktop, icon, shortcut, spec, specIcon);
var all = es.merge(code, desktop, icon, spec, specIcon);
return all.pipe(symdest(destination));
}

View file

@ -3,9 +3,19 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
NAME="@@NAME@@"
VSCODE_PATH="/usr/share/$NAME"
ELECTRON="$VSCODE_PATH/$NAME"
if [ ! -L $0 ]; then
# if path is not a symlink, find relatively
VSCODE_PATH="$(dirname $0)/.."
else
if which readlink >/dev/null; then
# if readlink exists, follow the symlink and find relatively
VSCODE_PATH="$(dirname $(readlink $0))/.."
else
# else use the standard install location
VSCODE_PATH="/usr/share/@@NAME@@"
fi
fi
ELECTRON="$VSCODE_PATH/@@NAME@@"
CLI="$VSCODE_PATH/resources/app/out/cli.js"
ATOM_SHELL_INTERNAL_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?
exit $?

View file

@ -46,6 +46,5 @@ ln -s /usr/share/@@NAME@@/bin/@@NAME@@ /usr/bin/@@NAME@@
%defattr(-,root,root)
/usr/share/@@NAME@@/
/usr/share/@@NAME@@/bin/@@NAME@@
/usr/share/applications/@@NAME@@.desktop
/usr/share/pixmaps/@@NAME@@.png