--- lib/PXElator/config.pm 2010/01/02 17:20:40 457 +++ lib/PXElator/config.pm 2010/01/03 01:19:50 463 @@ -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,17 +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/apt/sources.list.d/non-free.list", "deb $debian_mirror lenny non-free\n"; + 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 install -y --force-yes atl2-modules-2.6-686 firmware-bnx2'; - in_chroot $debootstrap => 'apt-get -f install -y --force-yes locales'; # linux-image-2.6-686 + 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'; } @@ -177,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{ @@ -198,14 +205,8 @@ file::append "$export/etc/rc.local", $_; } ( '/srv/sysadmin-cookbook/recepies/amt/serial-console.sh' ); - pxelinux::config_for_ip( $ip, qq{ - -default nfsroot -label nfsroot - kernel debootstrap/vmlinuz - append initrd=debootstrap/initrd.img root=/dev/nfs nfsroot=$server::ip:$export ro ip=dhcp + pxelinux::config_ip_boot( $ip, "$export/boot", "root=/dev/nfs nfsroot=$server->{ip}:$export ro ip=dhcp" ); - }); } sub openvz {