Skip to content

Instantly share code, notes, and snippets.

@eric-glb
Last active July 16, 2024 15:20
Show Gist options
  • Save eric-glb/0a6ea7685e6b4c1ffdf49545b908e087 to your computer and use it in GitHub Desktop.
Save eric-glb/0a6ea7685e6b4c1ffdf49545b908e087 to your computer and use it in GitHub Desktop.
Docker - RHEL7 / CentOS 7: get last packages
#!/bien/env bash
SRC=https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
rm -rf /tmp/centos7
mkdir -p /tmp/centos7
cd /tmp/centos7
curl -s $SRC | \
perl -MSort::Versions -nle '
push @{$a{$1}}, $2 if /href="([^"0-9]+)-(\d+[^"]+)"/;
}{
for (sort keys %a ) {
@v = sort { versioncmp($a, $b) } @{ $a{$_} };
printf "%s%s-%s\n", "'${SRC}'", $_, $v[-1];
}' | \
xargs -l curl -s --remote-name
cd ..
tar cvfz docker-centos7.tgz centos7/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment