Skip to content

Commit

Permalink
Register the apt repository as a source for official .deb builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Feb 26, 2016
1 parent 8b7f21e commit d624636
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
15 changes: 14 additions & 1 deletion build/gulpfile.vscode.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,20 @@ function prepareDebPackage(arch) {
.pipe(es.through(function (f) { that.emit('data', f); }, function () { that.emit('end'); }));
}));

return es.merge(control, desktop, icon, shortcut, code)
var all = es.merge(control, desktop, icon, shortcut, code);

// Register an apt repository if this is an official build
if (product.updateUrl && product.quality) {
var postinst = gulp.src('resources/linux/debian/postinst.template', { base: '.' })
.pipe(replace('@@NAME@@', product.applicationName))
.pipe(replace('@@UPDATEURL@@', product.updateUrl))
.pipe(replace('@@QUALITY@@', product.quality))
.pipe(replace('@@ARCHITECTURE@@', debArch))
.pipe(rename('DEBIAN/postinst'))
all = es.merge(all, postinst);
}

return all
.pipe(symdest(destination));
};
}
Expand Down
16 changes: 16 additions & 0 deletions resources/linux/debian/postinst.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.

get_apt_config_value() {
echo $(apt-config dump | grep "$1 " | sed -e "s/$1 \"//" -e "s/\";$//")
}

APT_DIR=$(get_apt_config_value Dir)
APT_ETC=$APT_DIR$(get_apt_config_value Dir::Etc)
APT_SOURCE_PARTS=$APT_ETC$(get_apt_config_value Dir::Etc::sourceparts)
CODE_SOURCE_LIST=$APT_SOURCE_PARTS/visual-studio-@@NAME@@.list

rm -f $CODE_SOURCE_LIST
echo "deb @@UPDATEURL@@/api/deb/@@QUALITY@@/ @@ARCHITECTURE@@/" > $CODE_SOURCE_LIST

0 comments on commit d624636

Please sign in to comment.