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

Dynamic dependency install, better GPG key install, and other minor stuff #93

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

pfeerick
Copy link

@pfeerick pfeerick commented Dec 14, 2019

Per the discussion that was happening in #92, I've put my 💰 where my 😮 is and done a PR 😉

This PR introduces:

  • dynamic detection of typically needed dependencies needing to be installed, and installs in one pass rather than multiple stages
  • installs the GPG key via apt-key, thus ensuring a valid key is present
  • checks if the user has root priv, as they are required for many of the steps, thus allowing the install script to gracefully bug out, instead of a spectacular string of errors

If adopted, this PR Resolves #92; Resolves #76; Resolves #71; Resolves #63.

Note: These changes are completely untested at this point in time (but have passed shellcheck testing), so aren't in a fit state to merge right of this second. I don't expect any breakage, but expectation and reality often don't see eye to eye ;) Testing will happen within the next few days.

I would like to make some other minor changes, but they are style changes so need discussion first. Shell scripts don't need trailing ; at the end of commands, so I would like to remove them where not required which. Also, I want to change to tab indentation, rather than whitespace indentation.

Key reasoning for both changes is to the make the script fractionally smaller, improve consistency, and reduce chance of confusion later down the path.

Test for and only install missing dependencies
The install script generally needs root priv, so will
now gracefully bug out if it don't have them.
Closes several issue around GPG key not being properly installed
@pfeerick pfeerick changed the title Dynamic dependency install, better GPG, and other minor stuff Dynamic dependency install, better GPG key install, and other minor stuff Dec 14, 2019
@headmelted
Copy link
Owner

headmelted commented Dec 14, 2019

Writing this on phone at the minute but will be in front of laptop later today though and hopefully get this merged then. Thanks for taking the time to put this together!

Quieten apt-get update and install without completely quashing output, remove duplicate architecture message
Extra characters, can add to confusion as not consistently used in file.
@pfeerick
Copy link
Author

pfeerick commented Dec 20, 2019

Sorry for the delay... next few days become a week! :-O Latest changes are mostly cosmetic, no errrors were introduced, or any further functional changes made. @headmelted Is there a pre or post-install script included in the deb file? I'm trying to pin down the cause of the (failing) mid-install attempt to install the GPG key, and refresh the apt-cache, as that should not be happening during the install process. When you look at the output below, the steps between Setting up code-oss and Processing triggers for mime-support (3.62) should not be happening, but I can't pin down exactly how the .deb package is constructed.

Otherwise, this is working quite well now. Tested against fresh unconfigured installs of Raspbian Strech and Buster, on a Raspberry Pi 3B+.

pi@raspberrypi:~ $ wget -q -O - https://raw.githubusercontent.com/pfeerick/codebuilds/dependencies/docs/installers/apt.sh | sudo bash
Architecture detected as armv7l...
Updating APT cache...
Update complete.
Installing dependencies:  apt-transport-https ca-certificates
Retrieving GPG key [headmelted] (https://packagecloud.io/headmelted/codebuilds/gpgkey)...
OK
Removing any previous entry to headmelted repository
Installing [headmelted] repository...
Refreshing APT cache again...
Repository install complete.
Installing Visual Studio Code from [stretch]...
Selecting previously unselected package code-oss.
(Reading database ... 93828 files and directories currently installed.)
Preparing to unpack .../code-oss_1.42.0-1575969827_armhf.deb ...
Unpacking code-oss (1.42.0-1575969827) ...
Setting up code-oss (1.42.0-1575969827) ...
Retrieving GPG key [headmelted] (https://packagecloud.io/headmelted/codebuilds/gpgkey)...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
gpg: no valid OpenPGP data found.
Removing any previous entry to headmelted repository
Installing [headmelted] repository...
Updating APT cache...
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Hit:3 https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease
Reading package lists...
Done!
Processing triggers for mime-support (3.62) ...
Processing triggers for gnome-menus (3.31.4-3) ...
Processing triggers for desktop-file-utils (0.23-4) ...
Visual Studio Code install complete.
Installing any dependencies that may have been missed...
Missed dependency install complete.


Installation complete!

You can start code at any time by calling "code-oss" within a terminal.

A shortcut should also now be available in your desktop menus (depending on your distribution).

pi@raspberrypi:~ $ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

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