--- lib/PXElator/config.pm 2009/10/02 10:23:56 450 +++ lib/PXElator/config.pm 2010/01/02 22:55:33 461 @@ -133,6 +133,9 @@ sub nfsroot { my $ip = shift || die "no ip?"; + my $dist = 'lenny'; + $dist = 'squeeze'; + my $nfsroot = "$server::base_dir/tftp/nfsroot"; my $debian_mirror = server::conf_default( 'debian_mirror', 'http://ftp.debian.org/debian' ); @@ -145,14 +148,19 @@ if ( ! -e $debootstrap ) { - system "sudo debootstrap --arch i386 lenny $debootstrap $debian_mirror"; + system "sudo debootstrap --arch i386 $dist $debootstrap $debian_mirror"; - file::append "$debootstrap/etc/kernel-img.conf", "do_initrd = Yes\n" && - in_chroot $debootstrap => 'apt-get install -y --force-yes atl2-modules-2.6-686'; - in_chroot $debootstrap => 'apt-get -f install -y --force-yes locales'; # linux-image-2.6-686 + file::append "$debootstrap/etc/apt/sources.list.d/non-free.list", "deb $debian_mirror $dist non-free\n"; + in_chroot $debootstrap => 'apt-get update'; + file::append "$debootstrap/etc/kernel-img.conf", "do_initrd = Yes\n"; + in_chroot $debootstrap => 'apt-get -f install -y --force-yes locales linux-image-2.6-686 firmware-bnx2'; + + # this can fails on some distros, so we run it alone + in_chroot $debootstrap => 'apt-get install -y --force-yes atl2-modules-2.6-686'; file::append "$debootstrap/etc/initramfs-tools/modules", "atl2\n"; - file::change("$debootstrap/etc/initramfs-tools/initramfs.conf", 'BOOT=local' => 'BOOT=nfs' ) && + + file::change "$debootstrap/etc/initramfs-tools/initramfs.conf", 'BOOT=local' => 'BOOT=nfs'; in_chroot $debootstrap => 'update-initramfs -u'; } @@ -174,11 +182,13 @@ } + my $server = server::as_hash_for $ip; + my $hostname = client::conf( $ip => 'hostname' ) || 'nfsroot'; file::replace "$export/etc/hostname", $hostname; file::replace "$export/etc/hosts", "127.0.0.1\tlocalhost $hostname\n"; - file::replace "$export/etc/resolv.conf", "domain $server::domain_name\nnameserver $server::ip\n"; - file::replace "$export/etc/rsyslog.d/pxelator.conf", "*.*\t\@$server::ip\n"; + file::replace "$export/etc/resolv.conf", "domain $server->{domain}\nnameserver $server->{ip}\n"; + file::replace "$export/etc/rsyslog.d/pxelator.conf", "*.*\t\@$server->{ip}\n"; file::append "$debootstrap/etc/network/interfaces", qq{ @@ -199,8 +209,12 @@ default nfsroot label nfsroot - kernel debootstrap/vmlinuz - append initrd=debootstrap/initrd.img root=/dev/nfs nfsroot=$server::ip:$export ro ip=dhcp + kernel $ip/vmlinuz + append initrd=$ip/initrd.img root=/dev/nfs nfsroot=$server->{ip}:$export ro ip=dhcp + +label old + kernel $ip/vmlinuz.old + append initrd=$ip/initrd.img.old root=/dev/nfs nfsroot=$server->{ip}:$export ro ip=dhcp }); }