I'm unsure which version of wget
or OS and any proxy's exist between you and sourceforge but wget
downloaded the file when I removed the "/download" and left it at the file extension.
I don't want to flood the post or pastebin my entire session but I got the 302 then 200 status codes before the transfer began. What happens when you try wget
?
Resolving downloads.sourceforge.net... 216.34.181.59
Connecting to downloads.sourceforge.net|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 302 Found
[snipped for brevity]
HTTP request sent, awaiting response... 200 OK
Length: 13432789 (13M) [application/x-gzip]
Saving to: `download'
The simple approach
If you are using another machine, one which is connected to the internet, to upgrade your target computer, you can simply use the same sources.list
file on the two machines, run apt-get update
and then copy the package lists over:
$ sudo mv /etc/apt/sources.list /etc/apt/sources.list.orig
$ sudo mv target_computer_sources.list /etc/apt/sources.list
$ sudo apt-get update
apt
stores its repository file lists in /var/lib/apt/lists/
, so afer running the command above, you cam copy everything in /var/lib/apt/lists/
to the target machine and then revert to the original sources.list
:
$ sudo mv /etc/apt/sources.list.orig /etc/apt/sources.list
The complex way
I for whatever reason the method above does not work for you, you can do it the way you were suggesting, you just need to parse the output of apt-get update --print-uris
. The following are from my LMDE system but the idea is the same:
$ sudo apt-get update --print-uris -y | head
'ftp://ftp.debian.org/debian/dists/testing/main/source/Sources.bz2' ftp.debian.org_debian_dists_testing_main_source_Sources 0 :
'ftp://ftp.debian.org/debian/dists/testing/contrib/source/Sources.bz2' ftp.debian.org_debian_dists_testing_contrib_source_Sources 0 :
'ftp://ftp.debian.org/debian/dists/testing/non-free/source/Sources.bz2' ftp.debian.org_debian_dists_testing_non-free_source_Sources 0 :
'ftp://ftp.debian.org/debian/dists/testing/InRelease' ftp.debian.org_debian_dists_testing_InRelease 0
'http://packages.linuxmint.com/dists/debian/main/source/Sources.bz2' packages.linuxmint.com_dists_debian_main_source_Sources 0 :
'http://packages.linuxmint.com/dists/debian/upstream/source/Sources.bz2' packages.linuxmint.com_dists_debian_upstream_source_Sources 0 :
'http://packages.linuxmint.com/dists/debian/import/source/Sources.bz2' packages.linuxmint.com_dists_debian_import_source_Sources 0 :
'http://packages.linuxmint.com/dists/debian/main/binary-amd64/Packages.bz2' packages.linuxmint.com_dists_debian_main_binary-amd64_Packages 0 :
'http://packages.linuxmint.com/dists/debian/upstream/binary-amd64/Packages.bz2' packages.linuxmint.com_dists_debian_upstream_binary-amd64_Packages 0 :
'http://packages.linuxmint.com/dists/debian/import/binary-amd64/Packages.bz2' packages.linuxmint.com_dists_debian_import_binary-amd64_Packages 0 :
In the output above, the 1st field is the URL and the 2nd is the name the file will be saved under. As I mentioned before, apt
stores its repository file lists in /var/lib/apt/lists/
, you can verify this by running locate
on one of the 2nd fields above:
$ locate packages.linuxmint.com_dists_debian_main_source_Sources
/var/lib/apt/lists/packages.linuxmint.com_dists_debian_main_source_Sources
So, if you want to download and update each of those lists, you will need to parse the output of apt-get update --print-uris
and tell wget
to use the 2nd field as the output name:
$ sudo apt-get update --print-uris -y | sed "s/'//g" | cut -d ' ' -f 1,2 |
while read url target; do wget $url -O ./$target; done
This will download each package list and save it in the current directory using the appropriate name. You can now copy these files over to the /var/lib/apt/lists/
directory of the target machine.
Best Answer
Try this:
-r
recursively-l1
to a maximum depth of 1--no-parent
ignore links to a higher directory-A "*.deb"
your pattern