code.sh 948 Bytes
Newer Older
1
#!/bin/sh
2 3

PKGNAME=code
4
SUPPORTEDARCHES="x86_64 armhf aarch64"
5
DESCRIPTION="Visual Studio Code from the official site"
6
TIPS="Run epm play code <version> to install specific version."
7

8
. $(dirname $0)/common.sh
9

10
VERSION="$2"
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

arch="$($DISTRVENDOR -a)"
case "$arch" in
    x86_64)
        arch=x64
        ;;
    armhf)
        ;;
    aarch64)
        arch=arm64
        ;;
    *)
        fatal "$arch arch is not supported"
        ;;
esac

27 28 29

pkgtype="$($DISTRVENDOR -p)"

30
# we have workaround for their postinstall script, so always repack rpm package
31
[ "$pkgtype" = "deb" ] || repack='--repack'
32

33
if [ -n "$VERSION" ] ; then
34
    URL="https://update.code.visualstudio.com/$VERSION/linux-$pkgtype-$arch/stable"
35
else
36
    URL="https://code.visualstudio.com/sha/download?build=stable&os=linux-$pkgtype-$arch"
37
fi
38

39 40 41 42
epm install $repack "$URL" || exit

echo
echo "NOTE: VS Code is a proprietary build. We recommend to use open source editors: Codium, Atom."