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

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

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

11
arch="$(epm print info -a)"
12 13 14 15 16 17 18 19 20 21 22 23 24 25
case "$arch" in
    x86_64)
        arch=x64
        ;;
    armhf)
        ;;
    aarch64)
        arch=arm64
        ;;
    *)
        fatal "$arch arch is not supported"
        ;;
esac

26

27
pkgtype="$(epm print info -p)"
28

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

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

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

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