[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Installing extra packages into /target/ - suggested design



[Tollef Fog Heen]
> I'm not sure using apt is a good thing for this.  It would mean that
> your sources.list would have to be correctly set up and (for
> cd/floppy/nfs installs) the media should be mounted inside the
> chroot, in the right place.  How do you propose we ensure this?

I solved this by calling APT twice, once to download the package with
root on /, and once to installing with root on /target.  This works.
The code look like this (from rootskel - apt-install):

  PATH=$PATH:/target/usr/bin:/target/bin:/target/usr/sbin:/target/sbin \
  LD_LIBRARY_PATH=/usr/lib:/lib:/target/usr/lib:/target/lib \
  /target/usr/bin/apt-get \
      -o Dir::State=/target/var/lib/apt \
      -o Dir::State::status=/target/var/lib/dpkg/status \
      -o Dir::Cache=/target/var/cache/apt \
      -o Dir::Etc=/target/etc/apt \
      -o Dir::Bin::methods=/target/usr/lib/apt/methods \
      -o Dir::Bin::gzip=/target/bin/gzip \
      -o Dir::Bin::dpkg=/target/usr/bin/dpkg \
      -o Dpkg::Options::=--root=/target \
      -y --download-only install $*
  
  # Some packages (eg. the kernel-image package) require a mounted /proc/
  # Only mount it if it isn't mounted already
  if [ ! -f /target/proc/cmdline ] ; then
      mount -t proc proc /target/proc
  fi
  DEBIAN_FRONTEND=noninteractive \
  chroot /target apt-get --no-download -y install $* < /dev/null
  umount /target/proc

This work just fine with CD install.  I believe it should work just
fine with network installs as well.
  
> I think using basepkg-installer (not in CVS yet) is a better choice,
> since it reuses debootstrap functionality and is a lot simpler than
> using apt.

I would rather have something that handles dependencies.



Reply to: