apt.conf

Bruce Edge bedge at troikanetworks.com
Fri May 16 19:05:26 CEST 2003


> From: Kief Morris [mailto:kmorris at kief.com]
> 
> When I install a system with FAI, it pulls the unstable releases of
> most of the applications, and leaves an apt.conf file on the installed
> machine which seems to be the same one used during the install.
> So how do I get FAI to prefer stable releases unless otherwise
> specified (and is there a way to specify exceptions)? And what's
> the recommended way to customize the apt.conf file on the installed
> machine, should I put it in files/etc/apt.conf, use a hook, 
> or something
> else?

You set the default version if fai in /etc/fai/fai.conf:

	debdist=sarge # distribution: woody, sarge, sid

Then, what I do is I have a hook, instsoft.LINUX, which grabs a default preferences file for the defined classes, 

# This determines which debian release we use, stable, unstable, or testing
fcopy /etc/apt/preferences

which all look something like this:

cat /export/fai/config/files/etc/apt/preferences/DEBIAN_STABLE 
Package: *
Pin: release a=stable
Pin-Priority: 1001

Package: *
Pin: release a=testing
Pin-Priority: 2

Package: *
Pin: release a=unstable
Pin-Priority: 1


Or, use specific version callouts, not all that good because as package versions are updated in the debian releases, some versions become no longer available.

cat /export/fai/config/files/etc/apt/preferences/DEBIAN_CUSTOM_FOR_PROJ_XXX
Package: *
Pin: release a=stable
Pin-Priority: 1001

Package: *
Pin: release a=testing
Pin-Priority: 2

Package: *
Pin: release a=unstable
Pin-Priority: 1

Package: libc6
Pin: version 2.2.5-11.2
Pin-Priority: 1001

Package: locales
Pin: version 2.2.5-11.2
Pin-Priority: 1001

Package: debianutils
Pin: version 1.16
Pin-Priority: 1001

Package: shellutils
Pin: version 2.0.11-11
Pin-Priority: 1001


Or, yet another variant, I have my own debian version:

Package: *
Pin: release a=debian_release_for_proj_xxx
Pin-Priority: 1001

Package: *
Pin: release a=testing
Pin-Priority: 2

Package: *
Pin: release a=unstable
Pin-Priority: 1

and my local debian mirror has:

ls -l /mnt/deb-mirror/debian/dists
lrwxrwxrwx    1 root     root            6 May 12 15:32 Debian2.2r7 -> potato
lrwxrwxrwx    1 root     root            5 May 12 15:44 Debian3.0r1a -> woody
-rw-r--r--    1 root     root          401 Dec 16 10:05 README
drwxr-sr-x    5 root     root          240 Dec 16 10:45 debian-release-for-projxxx
drwxr-xr-x    5 root     root          240 Jul 12  2002 potato
drwxr-sr-x    2 root     root         4720 May 15 12:39 potato-proposed-updates
lrwxrwxrwx    1 root     root           22 May 12 15:32 proposed-updates -> woody-proposed-updates
drwxr-sr-x    5 root     root          208 May 15 12:39 sarge
drwxr-sr-x    5 root     root          176 May 15 12:39 sarge-proposed-updates
drwxr-sr-x    5 root     root          280 May 15 12:40 sid
lrwxrwxrwx    1 root     root            5 May 12 15:32 stable -> woody
lrwxrwxrwx    1 root     root           22 May 12 15:32 stable-proposed-updates -> woody-proposed-updates
lrwxrwxrwx    1 root     root            5 May 12 15:32 testing -> sarge
lrwxrwxrwx    1 root     root           22 May 12 15:32 testing-proposed-updates -> sarge-proposed-updates
lrwxrwxrwx    1 root     root            3 May 12 15:32 unstable -> sid
drwxr-sr-x    5 root     root          240 Dec 16 10:45 woody
drwxr-sr-x    5 root     root         8272 May 15 12:39 woody-proposed-updates

note the debian-release-for-projxxx dir, this is a copy of woody with some of sarge merged into it.

Make sure that your sources.list file has all these releases defined too.

Oh, and the instsoft.LINUX hook also does:

$ROOTCMD apt-get update

# Pull installation up/down to level defined in new preferences file
echo Yes, do as I say! | \
$ROOTCMD apt-get -y -f --force-yes --ignore-hold dist-upgrade || true

echo dist-upgrage complete
set -xv
# Force a few packages to set the dependencies right for everything else
if [ $tree_type -eq 2 ] ; then
        # This is needed because the FAI root is sarge based.
        echo Yes, do as I say! | \
        $ROOTCMD apt-get --reinstall --fix-missing -y -f --force-yes install \
                perl locales libc6 fileutils shellutils textutils sysvinit coreutils-
fi

Which is a brute force, but functional way of forcing any root fs built from FAI extracting it's tarball into any other debian version, even with downgrades.

Lastly, for the downgrades to work, you need an apt.conf which looks like:


// This file is used in the chroot environment from install_packages
// (called by rcS_fai)

// Options for apt-get for FAI
APT 
{
  // Options for apt-get
  Get 
  {
     Assume-Yes "true";     
     Fix-Missing "yes";     
     Show-Upgraded "yes";
     Purge "true";              // really purge! Also removes config files
     List-Cleanup "true";
     ReInstall "false";
  };
  Cache-Limit "20000000";  
};

DPkg 
{
  Options {
          "--abort-after=4711";   // a magic number in cologne ;-)
      "--force-confnew";              // [BRE] added, to make non-interactive.
          "--force-overwrite";
          }
};


-Bruce



More information about the linux-fai mailing list