FAI and non debian installs

Holger Parplies wfai at parplies.de
Tue Jun 17 22:46:42 CEST 2014


Hi,

Sylvain Milot wrote on 2014-06-17 13:20:41 -0400 [Re: FAI and non debian installs]:
> [...]
> >If I want half of a cluster to be debian wheezy, and the other half to
> >be ubuntu14.04, how do I disambiguate the $NFSROOT/etc/apt/sources.list
> >properly?
> 
> [...]
> files/etc/apt/apt.conf/SQUEEZE
> files/etc/apt/apt.conf/PRECISE
> files/etc/apt/apt.conf/WHEEZY
> files/etc/apt/sources.list
> files/etc/apt/sources.list/SQUEEZE
> files/etc/apt/sources.list/PRECISE
> files/etc/apt/sources.list/WHEEZY
> [and so on]

I think I started that way, too, but found the multiple slightly
different sources.list files (in NFSROOT, in base.tgz, in files/;
possibly different content for installation and installed system)
confusing and cumbersome to maintain.
I'm currently using this:

# cat hooks/prepareapt.DEFAULT 
#!/bin/bash

task_prepareapt
skiptask prepareapt
dist=""
# translate class name to distribution; could easily also set other values,
# e.g. vendor=debian server=ftp.debian.org components="main contrib non-free"
# or   vendor=ubuntu server=archive.ubuntu.com components="main restricted"
# and then generate
# deb http://$server/$vendor $dist $components
# below
ifclass WOODY   && dist=woody
ifclass SARGE   && dist=sarge
ifclass ETCH    && dist=etch
ifclass LENNY   && dist=lenny
ifclass SQUEEZE && dist=squeeze
ifclass WHEEZY  && dist=wheezy
[ -z "$dist" ] && exit 1

sources=$target/etc/apt/sources.list
cat <<EOF > $sources
# /etc/apt/sources.list generated by FAI prepareapt hook
# (c) 2012 Holger Parplies
deb http://packages/debian $dist main contrib non-free
EOF
ifclass COMPANY_A && echo "deb http://packages/repo_a $dist comp_a" >> $sources
ifclass COMPANY_B && echo "deb http://packages/repo_b $dist comp_b" >> $sources
exit 0


My reasoning was that this installs a definite version of sources.list into
the installing system at the point in time where it is needed - no more
outdated versions from base.tgz files, no more rebuilding base.tgz solely
for a change of sources.list, the ability to have differences according to
defined classes (e.g. for different administrative domains), and, most
important to me, no more guessing which sources.list might be used for
whatever reason during the next installation ;-).
There are probably many different ways to accomplish this, but for simple
sources.list files, this seemed the most concise. It is easily extendable
to other aspects of apt configuration (which I don't currently need).

One trick used here that might be worth noting is that the host name
"packages" resolves differently during installation and in each target
network (during installation, it's my FAI server, say 10.1.1.1; in the
COMPANY_A network, it might be 192.168.1.2, in COMPANY_B maybe 172.1.1.15).

Works really well for me.

Regards,
Holger

P.S.: No, I don't regularly install woody clients any more ;-).


More information about the linux-fai mailing list