These checks were originally added in 3217c543b4,
which added a `REPO_FILE` variable. While it's with good intent to do a check
if the URL is valid, there are some issues with these checks;
The checks depend on `curl`, but are executed _before_ `pre_reqs` are installed,
so will produce an error if `curl` is not found;
./install.sh
# Executing docker install script, commit:
./install.sh: line 469: curl: command not found
Error: Unable to curl repository file https://download.docker.com/linux/fedora/docker-ce.repo, is it valid?
The checks are currently always performed, also if `DRY_RUN=1` is enabled;
DRY_RUN=1 REPO_FILE=no-such.repo ./install.sh
# Executing docker install script, commit:
Error: Unable to curl repository file https://download.docker.com/linux/fedora/no-such.repo, is it valid?
This patch removes the checks to address the above, and to simplify the script.
Running the script will still fail if an invalid URL is used for the `.repo` file,
which fails the script after the `pre_reqs` are installed;
With this patch:
When running the script with `DRY_RUN=1`:
DRY_RUN=1 ./install.sh
# Executing docker install script, commit:
dnf install -y -q dnf-plugins-core
dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
dnf makecache
dnf install -y -q docker-ce docker-ce-cli containerd.io docker-scan-plugin docker-compose-plugin docker-ce-rootless-extras
When running the script with `DRY_RUN=1` and an invalid repo, the script
completes successfully, but will show the commands it will run, including
the invalid URL:
DRY_RUN=1 REPO_FILE=no-such.repo ./install.sh
# Executing docker install script, commit:
dnf install -y -q dnf-plugins-core
dnf config-manager --add-repo https://download.docker.com/linux/fedora/no-such.repo
dnf makecache
dnf install -y -q docker-ce docker-ce-cli containerd.io docker-scan-plugin docker-compose-plugin docker-ce-rootless-extras
When running the script with an invalid repo URL, it will fail early (after
installing `pre_reqs`:
REPO_FILE=no-such.repo ./install.sh
# Executing docker install script, commit:
+ sh -c 'dnf install -y -q dnf-plugins-core'
...
+ sh -c 'dnf config-manager --add-repo https://download.docker.com/linux/fedora/no-such.repo'
Adding repo from: https://download.docker.com/linux/fedora/no-such.repo
Status code: 404 for https://download.docker.com/linux/fedora/no-such.repo (IP: 65.9.86.56)
Error: Configuration of repo failed
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This check gives a lot of false positives; ignoring it;
```
In build/install.sh line 106:
set +x
^----^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 108:
yy_a="$(echo "$1" | cut -d'.' -f1)"
^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
^-----------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 109:
yy_b="$(echo "$2" | cut -d'.' -f1)"
^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
^-----------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 110:
if [ "$yy_a" -lt "$yy_b" ]; then
^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
^---------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 111:
return 1
^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 113:
if [ "$yy_a" -gt "$yy_b" ]; then
^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
^---------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 114:
return 0
^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 116:
mm_a="$(echo "$1" | cut -d'.' -f2)"
^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
^-----------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 117:
mm_b="$(echo "$2" | cut -d'.' -f2)"
^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
^-----------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 118:
if [ "${mm_a#0}" -lt "${mm_b#0}" ]; then
^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
^-----------------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 119:
return 1
^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 122:
return 0
^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
In build/install.sh line 659:
exit 1
^----^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
For more information:
https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...
make: *** [Makefile:20: shellcheck] Error 1
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The buildx plugin has moved to a separate package for the 22.06 release.
We're currently doing test-builds on staging, so only try to install
this when using both the "test" channel and the staging domain.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
See https://tracker.debian.org/news/1305679/accepted-apt-240-source-into-unstable/:
* Install an empty /etc/apt/keyrings directory.
This directory is intended to provide an alternative to
/usr/share/keyrings for placing keys used with signed-by.
See also https://wiki.debian.org/DebianRepository/UseThirdParty?action=diff&rev2=47&rev1=46
(which was edited following a discussion with the APT maintainers about the expected usage):
> If future updates to the key will be managed by an apt/dpkg package as
> recommended below, then it SHOULD be downloaded into `/usr/share/keyrings`
> using the same filename that will be provided by the package. If it will
> be managed locally , it SHOULD be downloaded into `/etc/apt/keyrings` instead.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
While the script isn't intended for updating existing installations,
some users use it for that purpose, and when doing so may end up in
a situation where only the docker packages are updated, but containerd
is kept at the already installed version.
This patch explicitly installs the containerd.io package so that running
the script on an existing installation also updates the containerd.io
package to the latest version.
Docker packages before 18.09 bundled containerd in the docker-ce package,
so this step is made options based on the version that's requested to be
installed (defaults to "latest").
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Some environments may have a non-standard (non 022) umask set, in which case
the keyring would not get read-permissions for all users, which lead to errors
during install:
W: GPG error: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
This commit changes the permissions of the file, so that it's world-readable.
See https://stackoverflow.com/a/68764068
Co-Authored-By: ManhIT <manhit@s-developers.com>
Co-Authored-By: Hervé M <hmag@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>