Commit 2f631b4a authored by Vitaly Lipatov's avatar Vitaly Lipatov

prescription: add Visual Studio Code install

parent b51391ef
#!/bin/sh -x
# TODO: common place
fatal()
{
echo "FATAL: $*" >&2
exit 1
}
PKGNAME=code
if [ "$1" = "--remove" ] ; then
epm remove $PKGNAME
exit
fi
[ "$1" != "--run" ] && echo "Install Visual Studio Code from the official site" && exit
arch="$($DISTRVENDOR -a)"
case "$arch" in
x86_64)
arch=x64
;;
armhf)
;;
aarch64)
arch=arm64
;;
*)
fatal "$arch arch is not supported"
;;
esac
pkgtype="$($DISTRVENDOR -p)"
repack=''
case "$pkgtype" in
deb)
repack='--repack'
;;
rpm)
;;
*)
fatal "Package format $pkgtype is not supported yet"
esac
# we have workaround for their postinstall script, so always repack rpm package
[ "$($DISTRVENDOR -p)" = "deb" ] || repack='--repack'
PKG=/tmp/$PKGNAME.$pkgtype
# TODO: wget does not support: Content-Disposition: attachment; filename="code-1.52.1-1608137084.el7.x86_64.rpm"
$EGET -O $PKG "https://code.visualstudio.com/sha/download?build=stable&os=linux-$pkgtype-$arch" || fatal
epm install $repack "$PKG" || exit
rm -fv $PKG
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
PRODUCT=code
subst '1iAutoReq:yes,nomonolib,nomono' $SPEC
subst '1iAutoProv:no' $SPEC
subst 's|\(.*/usr/share/code/code.*\)|"/usr/bin/code"\n"/usr/bin/vscode"\n\1|' $SPEC
mkdir -p $BUILDROOT/usr/bin/
ln -rs $BUILDROOT/usr/share/code/code $BUILDROOT/usr/bin/code
ln -rs $BUILDROOT/usr/share/code/code $BUILDROOT/usr/bin/vscode
# install all requires packages before packing (the list have got with rpmreqs package | xargs echo)
epm install --skip-installed at-spi2-atk coreutils findutils firefox gawk glib2 libalsa libatk libat-spi2-core libcairo libdbus libdrm libexpat libgbm libgdk-pixbuf libgio libgtk+3 libnspr libnss libpango libsecret libX11 libxcb libXcomposite libXcursor libXdamage libXext libXfixes libXi libxkbfile libXrandr libXrender libXScrnSaver libXtst sed
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment