Created
April 9, 2024 05:57
-
-
Save skull-squadron/a8ccf213dc0e8a5c5dfcf98c0aa4551a to your computer and use it in GitHub Desktop.
Oracle Linux and Fedora: Replace docker YUM/RPM binaries with generic ones from the interwebs without hash/sig checking or confirmation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Needed for btrfs support on RH/Fedora-derived platforms | |
set -Eeuo pipefail | |
files=(containerd containerd-shim-runc-v2 ctr docker dockerd docker-init docker-proxy runc) | |
url_prefix="https://download.docker.com/linux/static/stable/$(/bin/arch)/" | |
ua='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36' | |
tarball=$(/bin/curl -fsSL -A "$ua" "$url_prefix" | /bin/grep -Eo 'docker-[0-9.]+tgz' | /bin/sort -Vur | /bin/head -1) | |
url="${url_prefix}${tarball}" | |
for f in "${files[@]}"; do | |
[ ! -e /bin/$f ] || /bin/mv -v /bin/$f /bin/$f.orig | |
done | |
/bin/curl --proto '=https' -fsS -A "$ua" "$url" | /bin/tar zvx --strip-components=1 -C /bin "${files[@]/#/docker/}" | |
for f in "${files[@]}"; do | |
/sbin/restorecon -Fv /bin/$f | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment