Skip to content

Commit 79b7930

Browse files
committed
Call a script on update
1 parent dc51479 commit 79b7930

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

build/gulpfile.vscode.linux.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,21 @@ function prepareSnapPackage(arch) {
199199
.pipe(rename(`usr/share/pixmaps/${product.applicationName}.png`));
200200

201201
const code = gulp.src(binaryDir + '/**/*', { base: binaryDir })
202-
.pipe(rename(function (p) { p.dirname = 'usr/share/' + product.applicationName + '/' + p.dirname; }));
202+
.pipe(rename(function (p) { p.dirname = `usr/share/${product.applicationName}/${p.dirname}`; }));
203203

204204
const snapcraft = gulp.src('resources/linux/snap/snapcraft.yaml', { base: '.' })
205205
.pipe(replace('@@NAME@@', product.applicationName))
206206
.pipe(replace('@@VERSION@@', `${packageJson.version}-${linuxPackageRevision}`))
207207
.pipe(rename('snap/snapcraft.yaml'));
208208

209+
const snapUpdate = gulp.src('resources/linux/snap/snapUpdate.sh', { base: '.' })
210+
.pipe(replace('@@NAME@@', product.applicationName))
211+
.pipe(rename(`usr/share/${product.applicationName}/snapUpdate.sh`));
212+
209213
const electronLaunch = gulp.src('resources/linux/snap/electron-launch', { base: '.' })
210214
.pipe(rename('electron-launch'));
211215

212-
const all = es.merge(desktop, icon, code, snapcraft, electronLaunch);
216+
const all = es.merge(desktop, icon, code, snapcraft, electronLaunch, snapUpdate);
213217

214218
return all.pipe(vfs.dest(destination));
215219
};
@@ -219,7 +223,7 @@ function buildSnapPackage(arch) {
219223
const snapBuildPath = getSnapBuildPath(arch);
220224
const snapFilename = `${product.applicationName}-${packageJson.version}-${linuxPackageRevision}-${arch}.snap`;
221225
return shell.task([
222-
`chmod a+x ${snapBuildPath}/electron-launch`,
226+
`chmod a+x ${snapBuildPath}/electron-launch ${snapBuildPath}/usr/share/${product.applicationName}/snapUpdate.sh`,
223227
`snapcraft --version`,
224228
`cd ${snapBuildPath} && snapcraft snap --output ../${snapFilename}`
225229
]);

resources/linux/snap/snapUpdate.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sleep 5
2+
code-insiders /Users/daimms/dev/Microsoft/vscode/OSSREADME.json

src/vs/platform/update/electron-main/updateService.linux.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class LinuxUpdateService extends AbstractUpdateService {
108108
this.logService.trace('update#quitAndInstall(): running raw#quitAndInstall()');
109109

110110
// Allow 3 seconds for VS Code to close
111-
spawn('bash', ['-c', `'sleep 10; /snap/${product.applicationName}/current'`], {
111+
spawn('bash', ['-c', path.join(process.env.SNAP, `usr/share/${product.applicationName}/snapUpdate.sh`)], {
112112
detached: true,
113113
stdio: ['ignore', 'ignore', 'ignore']
114114
});

0 commit comments

Comments
 (0)