Fix wget -S --spider test conditions
The test condition in wget-S --spider causes pkg to think a url doesn't exist when it does.
Here is the code:
# exit if URL is not found (if we get a 404 back)
if [ -z "$DOWNLOAD_URL" -o "`wget -S --spider "$DOWNLOAD_URL" 2>&1 | grep -m1 'HTTP/1.1 404 Not Found'`" != '' ]; then
error "Package URL not found $DOWNLOAD_URL"
return 8
fi
https://gitlab.com/sc0ttj/Pkg/blob/master/usr/sbin/pkg#L4339
Here is some test output:
# wget -S --spider http://deb.devuan.org/merged/pool/DEBIAN/main/o/openssh/openssh-client_7.4p1-10+deb9u7_i386.deb
Spider mode enabled. Check if remote file exists.
--2019-10-16 05:50:53-- http://deb.devuan.org/merged/pool/DEBIAN/main/o/openssh/openssh-client_7.4p1-10+deb9u7_i386.deb
Resolving deb.devuan.org (deb.devuan.org)... 190.64.49.124, 130.225.254.116, 37.220.36.58, ...
Connecting to deb.devuan.org (deb.devuan.org)|190.64.49.124|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 302 Found
Date: Wed, 16 Oct 2019 17:51:25 GMT
Server: Apache
Location: http://deb.debian.org/debian/pool/main/o/openssh/openssh-client_7.4p1-10+deb9u7_i386.deb
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
Location: http://deb.debian.org/debian/pool/main/o/openssh/openssh-client_7.4p1-10+deb9u7_i386.deb [following]
Spider mode enabled. Check if remote file exists.
--2019-10-16 05:51:01-- http://deb.debian.org/debian/pool/main/o/openssh/openssh-client_7.4p1-10+deb9u7_i386.deb
Resolving deb.debian.org (deb.debian.org)... 149.20.4.15, 130.89.148.77, 128.31.0.62, ...
Connecting to deb.debian.org (deb.debian.org)|149.20.4.15|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 302 Found
Date: Wed, 16 Oct 2019 17:51:25 GMT
Server: Apache
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Referrer-Policy: no-referrer
X-Xss-Protection: 1
Location: http://cdn-fastly.deb.debian.org/debian/pool/main/o/openssh/openssh-client_7.4p1-10+deb9u7_i386.deb
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
Location: http://cdn-fastly.deb.debian.org/debian/pool/main/o/openssh/openssh-client_7.4p1-10+deb9u7_i386.deb [following]
Spider mode enabled. Check if remote file exists.
--2019-10-16 05:51:01-- http://cdn-fastly.deb.debian.org/debian/pool/main/o/openssh/openssh-client_7.4p1-10+deb9u7_i386.deb
Resolving cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)... 151.101.184.204, 2a04:4e42:2c::204
Connecting to cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)|151.101.184.204|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Server: Apache
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Referrer-Policy: no-referrer
X-Xss-Protection: 1
Last-Modified: Sun, 11 Aug 2019 15:29:51 GMT
ETag: "ce67a-58fd91417e264"
X-Clacks-Overhead: GNU Terry Pratchett
Cache-Control: public, max-age=2592000
Content-Type: application/x-debian-package
Via: 1.1 varnish
Content-Length: 845434
Accept-Ranges: bytes
Date: Wed, 16 Oct 2019 17:51:26 GMT
Via: 1.1 varnish
Age: 93851
Connection: keep-alive
X-Served-By: cache-ams21039-AMS, cache-mdw17334-MDW
X-Cache: HIT, MISS
X-Cache-Hits: 1, 0
X-Timer: S1571248286.195509,VS0,VE93
Length: 845434 (826K) [application/x-debian-package]
Remote file exists.
Notice that the "HTTP/1.1 404 Not Found" is in the output but if you follow the whole output at the end it says "Remote file exists"