raspberrypi / pico-setup

92 stars 42 forks source link

Don't install VS Code by default, and definitely not under Raspberry Pi OS Lite #7

Open pxeger opened 3 years ago

pxeger commented 3 years ago

When installing, one of the dependencies is VS Code. I can understand why one might want to include and set up VS Code for some users, but I think the overlap between that group of users, with people who want to use C++ over MicroPython, is very small. I think this definitely should not be the default behaviour.

This is particularly infuriating under Raspberry Pi OS Lite because it installs the entire desktop environment which I categorically did not ask for. Ideally I would be able to develop entirely on my proper desktop, but I can't find any cross-compile instructions so it seemed a lot easier to set up using this script on a Pi (which I am already using for something else and definitely don't want a desktop environment on).

It certainly ought to be explained more clearly on the Getting Started page that this script sets up an entire development system, not just a "toolchain". Currently that just plonks you on a GitHub repo with no README or even instructions on how to download and run it. I had to read the script to learn about SKIP_VSCODE=1 (by which point it was too late), something which some might not be able to (or want to) do.

I think the best solution would be to present an interactive menu at the start of the script where the user can decide that they don't want to have VS Code set up for them.

scratch-er commented 3 years ago

This script is targeted for newbies so it is designed to set up everything and make them work just out of box. However, it should NOT install all the stuff without user's confirmation. It should ask the user to make a choice first.

lurch commented 3 years ago

I think giving the newbie user lots of questions to confirm/deny would take away a lot of the ease-of-use that pico_setup was written to provide. If you want to submit a PR that adds an "advanced mode" which is off by default (e.g. you need to explicitly enable it with pico_setup.sh --interactive or something), then feel free :slightly_smiling_face:

(and of course you can refer to https://datasheets.raspberrypi.org/pico/getting-started-with-pico.pdf if you want to do things "manually" and not rely on the automated nature of pico_setup)

I agree that it probably makes sense to not install VSCode on Raspberry Pi OS Lite though. @XECDesign Is there an easy way (e.g. looking for the absence of some package) that pico_setup could tell the difference between normal "Raspberry Pi OS" and "Raspberry Pi OS Lite"?

XECDesign commented 3 years ago

You can check /etc/rpi-issue whether it's a 'stage 2' (lite) image or for the presence of x11 libraries, but you can't assume that if a user started with the lite image that they haven't or aren't going to install a desktop environment or that they won't use X forwarding over SSH.

lurch commented 3 years ago

Would checking the return-code of dpkg-query -s xserver-xorg be a sensible option?

aallan commented 3 years ago

Ideally I would be able to develop entirely on my proper desktop, but I can't find any cross-compile instructions…

Please see the Getting Started guide which gives full instructions on how to set up the toolchain under Linux, macOS, or Windows. I'm not sure what you mean by cross-compile instructions though?

XECDesign commented 3 years ago

Would checking the return-code of dpkg-query -s xserver-xorg be a sensible option?

libx11-6 would probably be the safer option. I don't know what the goals of the scripts are, but if it doesn't have to be non-interactive, then it should probably just ask.

lurch commented 3 years ago

Thanks @XECDesign , I'll give that a go next week :+1:

michaelstoops commented 3 years ago

Would checking the return-code of dpkg-query -s xserver-xorg be a sensible option?

libx11-6 would probably be the safer option.

I don't think this will work as intended. Raspberry Pi OS Lite does not have xserver-xorg installed, but does have libx11-6.

pi@raspberrypi:~ $ cat /etc/rpi-issue
Raspberry Pi reference 2021-03-04
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 461109415073d2eb67083709662ba983cc191f14, stage2
pi@raspberrypi:~ $ dpkg-query -s xserver-xorg
dpkg-query: package 'xserver-xorg' is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files.
pi@raspberrypi:~ $ dpkg-query -s libx11-6
Package: libx11-6
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 1370
Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
Architecture: armhf
Multi-Arch: same
Source: libx11
Version: 2:1.6.7-1+deb10u1
Depends: libc6 (>= 2.28), libxcb1 (>= 1.11.1), libx11-data
Description: X11 client-side library
 This package provides a client interface to the X Window System, otherwise
 known as 'Xlib'.  It provides a complete API for the basic functions of the
 window system.
 .
 More information about X.Org can be found at:
 <URL:https://www.X.org>
 .
 This module can be found at
 git://anongit.freedesktop.org/git/xorg/lib/libX11
XECDesign commented 3 years ago

You're right, something seems to drag it in as a recommended package, which I should get rid of for the next set of images and save some space.

And it probably doesn't make a ton of sense to use VS Code through X11 forwarding anyway, so I think my original comment was a bit too pedantic.

michaelstoops commented 3 years ago

Oh, are you the image builder? Cool, nice to meet you.

lurch commented 3 years ago

@XECDesign It seems to be git that's dragging in these unwanted X11 packages, see my comment here: https://github.com/raspberrypi/pico-setup/pull/20#discussion_r608724527

XECDesign commented 3 years ago

In the case of pi-gen it happens because ssh has xauth as a recommended package, which then depends on the x11 libs. Git drags in the ssh client as a recommended package, so you end up with the same situation.

lurch commented 3 years ago

Ahhh, I hadn't noticed that git was pulling in openssh-client, and it was actually the latter that was dragging in xauth and the X11 libs! :laughing: But apt install --no-install-recommends openssh-client works without dragging in xauth. And after that I can do apt install git and remain X11-bloat-free :+1: :wink: (or even better, apt install --no-install-recommends ssh-client as ssh-client is the metapackage that git recommends)

aallan commented 3 years ago

Ahhh, I hadn't noticed that git was pulling in openssh-client, and it was actually the latter that was dragging in xauth and the X11 libs! 😆

Makes sense, you want to be able to display forward your XWindows stuff I guess, so SSH just pulls in the X11 libs so you can do that?