On Sun, 26 Feb 2023, Greg Wooledge wrote:

On Sun, Feb 26, 2023 at 05:28:44PM +0000, Albretch Mueller wrote:
 Basically, I am trying to download all packages that are part of the
installation dependencies of a given one into a directory of my
choosing to then install packages on an unexposed machine.

The tricky part here is that the packages on machine A are not necessarily
the same as on machine B.  So, installing package P1 on machine A may
need dependencies P2, P3 and P4.  But on machine B, it may need dependencies
P3, P4 and P5 instead.

If you ignore that, then the obvious answer is:

A# apt-get --download-only --reinstall install P1
A# cd /var/cache/apt/archives
A# scp *.deb B:/var/cache/apt/archives/
A# ssh root@B

B# cd /var/cache/apt/archives
B# apt-get install ./P1.deb

That should utilize the cached dependent packages P2, P3, P4 which are
located in /v/c/a/a on machine B.

If additional dependencies are needed, you'll have to fetch those by
hand.



If you want to download all the dependencies (except essential packages)
then you can point to an empty dir.

I do something like:

  rm -f ${APT_WORK}/archives/*.deb
  APT_CONFIG=${APT_CONFIG} \
  DEBIAN_FRONTEND=noninteractive \
    apt-get -q -y install -d \
        -o APT::Install-Recommends=false \
      $@

where APT_CONFIG looks something like:
  cat <<EOF >${APT_CONFIG}
APT::Architecture "${ARCH}";
APT::Install-Recommends "false";

Dir::Etc::PreferencesParts "${APT_WORK}/preferences.d";
Dir::Etc::SourceParts "${APT_WORK}/sources.list.d";
Dir::Etc::TrustedParts "${aptdir}/trusted.d";
Dir::Etc::Parts "${aptdir}/conf.d";

Dir::State::Lists "${APT_WORK}/lists";
Dir::State::Status "${APT_WORK}/status";
Dir::Cache::Archives "${APT_WORK}/archives";
Dir::Cache::srcpkgcache "${APT_WORK}/srcpkgcache";
Dir::Cache::pkgcache "${APT_WORK}/pkgcache";
EOF

Reply via email to