Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support VSCode's RPM/tarball installation as well #26

Open
5 tasks
lbssousa opened this issue Mar 14, 2022 · 1 comment
Open
5 tasks

Support VSCode's RPM/tarball installation as well #26

lbssousa opened this issue Mar 14, 2022 · 1 comment

Comments

@lbssousa
Copy link
Contributor

lbssousa commented Mar 14, 2022

Current toolbox-vscode implementation is primarily focused on Flatpak installation of VSCode, but I believe that it could support RPM/tar.xz installation of VSCode as well. The main reason one may prefer this approach rather than the Flatpak one is the fact that VSCode updates from Microsoft repository usually come faster than from Flathub (at the time I'm writting, the Flathub latest version is 3 releases behind the official RPM/tar.xz one).

An eventual RPM support needs to take the following details into account (I will edit the list as needed):

  • Support VSCode config location at ${HOME}/.config/Code/User/globalStorage as well as ${HOME}/.var/app/com.visualstudio.code/config/Code/User/globalStorage
  • The podman-host.sh script needs to be adapted to spawn podman directly rather than flatpak-spawn --host podman, but settings the same environment variables.
  • The ~/.local/bin/code symlink may conflict with default code binary path, depending on how user's PATH variable is set.
  • Maybe provide a way to automatically download VSCode RPM from official repository and install it with dnf / rpm-ostree / whatever.
  • Maybe support VSCode's tar.xz automatic download and uncompress at /usr/local or /opt folder as well (for ones worried about polluting their Fedora Silverblue/Kinoite installations with layered RPMs). In this case, toolbox-vscode could also check for updates for the tar.xz case.
@owtaylor
Copy link
Owner

I think it's better to keep the Flatpak up-to-date then dodge around the issue. So on Silverblue/Kinoite systems - I'd like to keep recommending the Flatpak.

But if you already have a working VSCode setup on a non-rpm-ostree system, it would be very nice if you could just start using Toolbox and have the integration work properly. Also see: https://pagure.io/fedora-workstation/issue/283 - we're planning to add the RPM repository to Fedora as a 3rd party repository.

I've been holding off on doing anything in this area waiting for requested changes on #20

Some further notes.

  • I'd rather not prompt for tarball installation. If the user already has it installed via tarball and in the path, that should work.
  • Sorting out all the possibilities is hard. I think it's something like:
  1. If the Flatpak is installed, use that
  2. Otherwise, if 'code' is in the path ignoring $0, run that
  3. If 'pkcon' is present, and pkcon -p resolve vscode | grep -q '^Available' prompt to install via pkcon
  4. Otherwise, prompt to install via Flatpak
  • podman-host.sh can check if it's in a flatpak by looking for /.flatpak-info
  • Finding the next 'code' in the path can be done with something like:
read -d '' -ra path_entries < <(which -a code)
next_code=
for (( i=0; i < ${#path_entries[@]}; i++ )) ; do
    if ! [ "${path_entries[$i]}" -ef "$0" ] ; then
        next_code=${path_entries[$i]}
        break
    fi
done

(For installation, I'd actually prefer to be able to ask GNOME Software to prompt to install vscode by the best option for the system, but 'gnome-software --install' doesn't come close to being usable for that. The argument to it is specific to the backend and it either installs without prompting or fails without useful feedback.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants