apt-get
installs the package you ask for, and any packages which it depends on which you don't already have, and any packages they depend on, and any packages they depend on, and so on. It is possible to replicate this offline but it's a bit of a pain - at least, I don't know of an easy way.
If you can find a way to get the Pi connected to the internet, this will be your easiest option by a long shot.
However if you simply can't, this is an outline of a way to do what you want. I don't have a nicely packaged script to give you -- this will involve some fiddling and manual work. Expect to encounter problems.
In short, the tool apt-rdepends
on an internet-connected machine can recursively find all dependencies, which you can then download, transfer to the offline machine and install with dpkg
.
- Get another Pi with an identical operating system, connected to the internet
- On that Pi, install
apt-depends
using sudo apt-get install apt-repends
- On the same Pi, get the list of dependencies:
apt-rdepends xserver-xorg-input-evdev
- Download each of those dependencies (
deb
s) in turn using apt-get download <dependency>
- Copy them all over to the offline Pi, using a USB stick or whatever.
- On the offline Pi,
cd
to the location of those debs, and install them sudo dpkg -i *.deb
You can script steps 3 and 4 easily enough.
It's probably also possible to do this on non-Pi hardware or with a different OS by telling apt-get
to get packages from a different repository but I haven't tried. Perhaps something in /etc/apt/
allows you to configure it, or perhaps apt-get
has another way of knowing what platform it's downloading for.
I don't know what will happen if there are awkward version incompatibilities with other things you have installed. Expect trouble if this happens.