Skip to content

Commit

Permalink
Switch to using HTTPS instead of FTP
Browse files Browse the repository at this point in the history
HTML scraping isn't ideal, but is way faster and hopefully is more reliable and puts us on the correct side of the notice on https://ftp.gnu.org/:

    NOTICE (Updated October 15 2021):

    If you maintain scripts used to access ftp.gnu.org over FTP,
    we strongly encourage you to change them to use HTTPS instead.

    Eventually we hope to shut down FTP protocol access, but plan
    to give notice here and other places for several months ahead
    of time.
  • Loading branch information
tianon committed Jan 2, 2024
1 parent d39c97f commit fc4c21a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ else
fi
versions=( "${versions[@]%/}" )

ftpBase='ftp://ftp.gnu.org/gnu/bash'
ftp_list() {
curl --silent --list-only "$ftpBase/${1:-}/"
}
ftpBase='https://ftp.gnu.org/gnu/bash'

allBaseVersions="$(
ftp_list \
| sed -rne '/^bash-([0-9].+)[.]tar[.]gz$/s//\1/p' \
wget -qO- "$ftpBase/" \
| sed -rne '/^(.*[/"[:space:]])?bash-([0-9].+)[.]tar[.]gz([/"[:space:]].*)?$/s//\2/p' \
| sort -V
)"

Expand Down Expand Up @@ -84,10 +81,9 @@ for version in "${versions[@]}"; do
patchlevel=
if [ "$version" = "$rcVersion" ]; then
patchlevel="$(
ftp_list "bash-$rcVersion-patches" \
| sed -rne '/^bash[0-9]+-([0-9]{3})$/s//\1/p' \
| tail -1 \
|| :
{ wget -qO- "$ftpBase/bash-$rcVersion-patches/" || :; } \
| sed -rne '/^(.*[/"[:space:]])?bash[0-9]+-([0-9]{3})([/"[:space:]].*)?$/s//\2/p' \
| tail -1
)"
fi
patchlevel="${patchlevel#0}"
Expand Down

0 comments on commit fc4c21a

Please sign in to comment.