Last active
October 16, 2019 22:43
-
-
Save maxwellb/463d5946739cf22ae71eed5b29dce3b9 to your computer and use it in GitHub Desktop.
Visual Studio Code - Insiders -- Download and Update scripts for Debian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2019 Maxwell Bloch, MIT license | |
[Desktop Entry] | |
Type=Application | |
Name=Code - Insiders | |
Version=1.1 | |
GenericName=IDE | |
Icon=code-insiders | |
Exec=/usr/bin/code-insiders %F | |
Terminal=false | |
StartupWMClass=Code - Insiders | |
Keywords=code;ide;visual studio; | |
Categories=Development;IDE;WebDevelopment;TextEditor; | |
MimeType=text/plain;text/*;text/css;text/html;text/javascript;text/csv;text/ecmascript;text/markdown;text/sgml;text/xml;text/x-csharp;text/json;application/json;application/xml;application;application/node;application/xml-dtd;application/xml-external-parsed-entity;application/xml-patch+xml;application/sql;application/soap+xml;application/jwt;application/jwk+json;application/jwk-set+json;application/javascript;application/json-seq;application/typescript | |
#https://code.visualstudio.com/docs/editor/command-line#_opening-files-and-folders | |
Actions=Diff;Open-Reuse-Window; | |
[Desktop Action Diff] | |
Exec=/usr/bin/code-insiders --diff %F | |
Name=Diff Two Files | |
[Desktop Action Open-Reuse-Window] | |
Exec=/usr/bin/code-insiders --reuse-window %F | |
Name=Open in Existing Window | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright (c) 2019 Maxwell Bloch, GPLv2+ License | |
get_latest() { | |
update="https://go.microsoft.com/fwlink/?LinkId=723968" | |
latest=$(curl -sIL ${update} | grep -i '^Location: ' | tail -n 1 | cut -d' ' -f2 | tr -dc "[:print:]") | |
outpath=$(dirname $(readlink -f ${0}))/$(basename ${latest} | cut -d. -f1) | |
extension=$(basename ${latest} | awk 'BEGIN { FS="." } { print $(NF) }') | |
mkdir -vp ${outpath} | |
echo GET ${latest} | |
echo $(curl -s ${latest} | tar -C ${outpath} -zxv --no-same-owner --strip-components=1 | wc -l) files extracted to ${outpath} | |
} | |
add_link() { | |
latest=$(find $(dirname $(readlink -f ${0})) | grep 'bin/code-insiders$' | sort -rV | head -n 1) | |
latest=$(readlink -f $(dirname ${latest})/..) | |
desktopfile=$(dirname $(readlink -f ${0}))/code-insiders.desktop | |
if [ -f ${desktopfile} ]; then | |
ln -sfv ${desktopfile} /usr/share/applications/code-insiders.desktop | |
fi | |
update-alternatives --install \ | |
/usr/bin/code-insiders code-insiders \ | |
${latest}/bin/code-insiders 50 \ | |
--slave \ | |
/etc/bash_completion.d/code-insiders code-insiders-completion \ | |
${latest}/resources/completions/bash/code-insiders \ | |
--slave \ | |
/usr/share/icons/hicolor/48x48/apps/code-insiders.png code-insiders_48x48.png \ | |
${latest}/resources/app/resources/linux/code.png \ | |
--slave \ | |
/usr/share/icons/hicolor/512x512/apps/code-insiders.png code-insiders_512x512.png \ | |
${latest}/resources/app/resources/linux/code.png \ | |
--slave \ | |
/usr/share/icons/hicolor/64x64/apps/code-insiders.png code-insiders_64x64.png \ | |
${latest}/resources/app/resources/linux/code.png \ | |
--slave \ | |
/usr/share/icons/hicolor/128x128/apps/code-insiders.png code-insiders_128x128.png \ | |
${latest}/resources/app/resources/linux/code.png | |
} | |
get_latest | |
add_link |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment