Need native support for VS Code through swupd

Being Optimised for CPU Clear Linux is a great choice for development but come on guys where is VS Code - Its an essential editor for developers, yeah I know it is available in flatpak but it doesn’t run in native terminal and there is a container overhead so please bring VS Code to swupd

5 Likes

not likely to ship this due to license issue.

There is an open source version, but I don’t know if we can call it “VScode” or whether we’d need to call it something else. Having someone try and autospec it would be helpful, too :).

I use GitHub - VSCodium/vscodium: binary releases of VS Code without MS branding/telemetry/licensing , VSCode clone with disabled MS telemetry. Just extract the .tar.gz achieve and run it.

5 Likes

As much as I’d like Intel to offer VSCode, it doesn’t appear to be possible with licensing? Until then, i just download and install. Works fine even though it’s outside of swupd.

Here is a shell script you can use to install the VSCode rpm.

#!/bin/bash

# delete previous version if needed
INSTALL_DIR=/usr/share/code
if [ -d "$INSTALL_DIR" ]; then
	echo "deleting: $INSTALL_DIR"
	sudo rm -rf $INSTALL_DIR
fi

# download the rpm from https://code.visualstudio.com/download

sudo swupd bundle-add cpio package-utils

sudo rpm2cpio code-*.rpm | ( cd /; cpio -idv)

# https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc

sudo echo "fs.inotify.max_user_watches=524288" | sudo tee --append /etc/sysctl.conf
1 Like

How do the solutions by @rana and @paulcarroty compare?
More generally, what should be checked before installing an RPM on CLR? What is the preferred place to get RPMs? Any preferred distro to get RPMs from?

Very dirty solution. After next release & next unpack old files will exists, and you get something like Slackware in your system. RPM provide cleanup and file conflicts resolver.

@EddyValiant maybe try each approach and see what works best for you. I like to get the latest full version from Microsoft. Its got the latest goodies and works fine. I added a delete previous version section to the script. You would have to manually download the latest VSCode version and re-run the script. Am not familiar enough with VSCodium to comment. I also use the rpm2cpio to install Google Chrome which works great too. It is a less than ideal solution until Intel or someone provides a better one. swupd would be the obviously desired choice.

@paulcarroty Thanks for pointing out that a new install would overwrite. I updated the install script to delete previous version. Any thoughts on a cleaner way?

Google Chrome install script.

#!/bin/bash

swupd bundle-add package-utils cpio wget
# wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
rpm2cpio google-chrome*.rpm | ( cd /; sudo cpio -idv)

ENV_FLE=/etc/environment
LN='export FONTCONFIG_PATH=/usr/share/defaults/fonts'
sudo touch $ENV_FLE
if ! grep -q "$LN" $ENV_FLE ; then 
	sudo echo $LN >> $ENV_FLE
fi
# https://github.com/clearlinux/distribution/issues/422

You can have these

[ -f google-chrome-stable_current_x86_64.rpm ] || wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
rpm2cpio google-chrome*.rpm | ( cd /; cpio -idv)

This will download the latest stable rpm if it’s not found.

1 Like

Thanks, nice addition

Here is another script to install using deb package. It will install the target at ~/ and auto-modify and create desktop links. To remove just delete ~/VisualStudioCode

#!/bin/bash

#PS4='$LINENO: '
#set -x

DEST=~/VisualStudioCode
VERSION_FILE=${DEST}/.version
REMOTE_VERSION=

echo Visual Studio Code updater


LOCAL_VERSION="none" && [ -f $VERSION_FILE ] && LOCAL_VERSION=$(cat $VERSION_FILE)
echo -e "Local version\t: $LOCAL_VERSION"

#Check version on remote
#REMOTE_VERSION=1.36.0
REMOTE_VERSION=$(curl -s -L https://code.visualstudio.com/updates | grep -Po '(?<=strong\>Update )[^:]+' | grep -oP '[^</strong>]+')
echo -e "Remote version\t: $REMOTE_VERSION"

if [ "$REMOTE_VERSION" == "$LOCAL_VERSION" ]; then
  echo "No update available"
  exit
fi

read -sp "Enter to update, Ctrl-C to abort... " && echo

echo Downloading ...
TMPWORK=$(mktemp -d)
cd $TMPWORK
wget -q --show-progress https://update.code.visualstudio.com/${REMOTE_VERSION}/linux-deb-x64/stable -O code_${REMOTE_VERSION}_amd64.deb

echo Extracting ...
ar x code_${REMOTE_VERSION}_amd64.deb data.tar.xz

rm -rf $DEST
mkdir $DEST
bsdtar -xf data.tar.xz -C $DEST

#adjust path
sed -e "s%/usr/share/code/code%${DEST}/usr/share/code/code%" -e "s%Icon=com.visualstudio.code%Icon=${DEST}/usr/share/pixmaps/com.visualstudio.code.png%" ${DEST}/usr/share/applications/code.desktop ~/.local/share/applications/code.desktop

#create a link at Desktop for easy access
ln -sf ~/.local/share/applications/code.desktop ~/Desktop/code.desktop

#Store version
echo $REMOTE_VERSION > $VERSION_FILE

cd
rm -rf $TMPWORK
echo Done.

[ $(pgrep -c -f ${DEST}/usr/share/code/code) -gt 0 ] && echo "Restart Visual Studio Code to use the latest version."
2 Likes

swupd repair --picky will remove any files not shipped by Clear Linux

Please use /usr/local for any non-distro packages.

swupd won’t touch /usr/local.

4 Likes

I suggest to add sudo sysctl-p after modifying fs.inotify.max_user_watches value. So the new value is reloaded in current session.

1 Like

@doct0rHu @miguelinux @hong.wei.phang Thank you for the script improvements; much appreciated

Unable to debug JS code as the flatpak VS code version cannot access my system PATH. Would appreciate native support soon :slightly_smiling_face:

What’s the medium/long-term vision for dealing with the licensing issue preventing access to critical software? Software moves too fast for scripts offered in forum posts to be a practical ongoing solution. Of course we can always write and maintain our own, but then we could also create our own distributions if sysadmin were a hobby for its own sake.

I confess I am finding missing software to be a persistent irritant. I repeatedly find myself either doing without or consuming time, which I’d really rather use for other things, seeking or creating solutions. This isn’t even slightly a knock on Clear Linux, which isn’t pretending to be other than what it is, and is great at what it does do . But it would be useful for users to know whether this is always going to be an issue or whether there are plans afoot to make this aspect of CL’s use easier.

You can download many proprietary IDE/editors from their official website, including VScode and IntellijIdea, etc.

Plan on supporting 3rd-party repo for swupd has been proposed for a while but it won’t be materialised at least in this year.

Personally, I shift my development workflow to Emacs. I use spacemacs and use LSP, i.e. language server protocol initially released by VSCode. The end result is I have a coherent tool for various programming languages. The learning curve is not insanely difficult because spacemacs by default use vim and mnemonic keybindings.

@doct0rHu My point was really the more general one, rather than about vscode specifically (which I only use in passing here & there). I’m not clear enough on the implications of the latest roadmap remarks on clr-user-bundles to know whether or not this addresses my concerns. Despite being a developer, from an OS perspective I’m very much an end-user and only skate the surface of package management.

On the editor side-issue: FWIW, I use a combination of vi (for single file edits) and IntelliJ Idea & CLion for projects. Emacs is wonderful, & I’ve used it in the past, but, well, everyone has their preferences.

[ if you read my earlier now deleted remark - please do ignore. It was unnecessarily ill-tempered for which my apologies ]

According to the survey they conducted during this summer, VSCode is the most popular editor in respondents. If they’re able to add it, they should already have done that.

Well, but I guess Intel have strict policy not to ship ANY proprietary softwares, to avoid any lawsuits. This includes proprietary drivers, firmwares, programs, that are not clearly open sourced.

I think this is not likely to change in forseable future, not until this distro became popular enough that vendors submit their proprietary softwares to us.

So I think it’s better to cope with this.

(BTW I use both VI and Emacs)

2 Likes

Yes I guess so. It’s a bit of a pest with a lot of small utilities (byobu, nnn autojump etc) each of which is easy enough to compile & install by hand once, but then that leaves you with a need to check for updates and go through the whole rigmarole again when one’s available.

I’m almost temped to write a small utility to automate that … but I think it would end up turning into a package manager. Bad idea.