Getting .deb package dependencies for an offline Ubuntu computer through Windows

Basically I want to "batch" download a .deb file and all its dependencies at once on a Windows 7 machine (of which I do not have admin access, it is a public computer.) I've seen plenty of Ubuntu based fixes that require terminal and apt, I'm asking how to do this on Windows. (I am not sure if this question fits here but I haven't found anywhere else that it could go.)

I've tried Keryx and Sushi-huh to try to get packages and their dependencies but these both require Python, Python can't be normally installed without admin permission. (Side note, I think I've seen programs bundle python so they can work without installing it to c:, is this possible as a workaround? Google isn't helping)

If anyone wants to know I'm trying to download Krita and Blender for Ubuntu 12.10/AMD64

I have been able to manually download single .deb files and dependencies upwards to 38 dependent packages, but then those 38 packages depend on other packages, It's maddening to not have some way to automatically do this on Windows.

*Edit Sorry I forgot to make it clear that my personal home computer is running Ubuntu 12.10 and the public computer I'm using to download is Windows 7


Solution 1:

You can generate a file with script of download with synaptic, select your packages and click on "File -> Generate Package Download Script", see more in ubuntu/PackageDownloadScript ,generate a file like :

#!/bin/sh
wget -c http://ftp.usf.edu/pub/ubuntu/pool/universe/i/ibm-3270/3270-common_3.3.10ga4-2build2_amd64.deb

remove #!/bin/sh and wget -c for get only urls, and with a new file you can download in any operating system, in windows 7 you can use wget for windows

Solution 2:

I had to do this the other day; first off, run

$ apt-get install -y (yourpackage) --print-uris > dependencies

You don't need sudo priviledges to do this as nothing is installed.

Using your favourite text editor, you can then delete the first few lines of the file dependencies which look something like this

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  ncurses-term ssh-import-id
Suggested packages:
  rssh molly-guard openssh-blacklist openssh-blacklist-extra monkeysphere
The following NEW packages will be installed
  ncurses-term openssh-server ssh-import-id
0 upgraded, 3 newly installed, 0 to remove and 26 not upgraded.
Need to get 771 kB of archives.
After this operation, 3,056 kB of additional disk space will be used.

then use sed to delete the unnecessary content which will just leave you with the URLs:

$ sed -i 's/ .*//' "dependencies"

and finally use wget to download all of these dependencies

$ wget -i dependencies

Solution 3:

I used apt-cache depends package to get all required packages in any case if the are already installed on system or not. So it will work always correct.
Because the command apt-cache works different, depending on language, you have to try this command on your system and adapt the command. apt-cache depends yourpackage
On an englisch system you get:

$ apt-cache depends yourpackage
node
  Depends: libax25
  Depends: libc6


On an german system you get: node

  Hängt ab von: libax25
  Hängt ab von: libc6


The englisch version with the term:
"Depends:"
You have to change the term "yourpackage" to your wish twice in this command, take care of this!

$ sudo apt-get --print-uris --yes -d --reinstall install yourpackage $(apt-cache depends yourpackage | grep "  Depends:" |  sed 's/  Depends://' | sed ':a;N;$!ba;s/\n//g') | grep ^\' | cut -d\' -f2 >downloads.list


And the german version with the term:
"Hängt ab von:"
This text is used twice in this command, if you want to adapt it to your language take care of this!
You have to change the term "yourpackage" to your wish twice in this command, take care of this!

$ sudo apt-get --print-uris --yes -d --reinstall install yourpackage $(apt-cache depends yourpackage | grep "Hängt ab von:" |  sed 's/  Hängt ab von://' | sed ':a;N;$!ba;s/\n//g') | grep ^\' | cut -d\' -f2 >downloads.list


You get the list of links in downloads.list
Check the list, go to your folder and run the list:

$ cd yourpathToYourFolder

$ wget --input-file downloads.list


All your required packages are in:

$ ls yourpathToYourFolder