X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=lib%2FPXElator%2Fconfig.pm;h=3d656c06bcc8621e2d67c8c515b00fed118d9aaf;hb=3e9cdd6cff194ac7e3b34b4917704afd69ae12ca;hp=8c898da626a08e16c34f2c845ca36947c8cb184e;hpb=92c10393cc23a30c02d89e35b64d912a5d4e52f5;p=pxelator diff --git a/lib/PXElator/config.pm b/lib/PXElator/config.pm index 8c898da..3d656c0 100644 --- a/lib/PXElator/config.pm +++ b/lib/PXElator/config.pm @@ -17,7 +17,7 @@ our $mounted; our $server; our $server_ip; -sub available { qw/katalog debian_live webconverger debirf tinycore nfsroot openvz printer wrt/ }; +sub available { qw/katalog debian_live webconverger debirf tinycore nfsroot openvz printer wrt clonezilla ubuntu memdisk vyatta/ }; sub debian_live { my ($ip) = @_; @@ -68,7 +68,7 @@ sub webconverger { default webconverger label webconverger kernel iso/live/vmlinuz-2.6.30-backports.1-486 - append initrd=iso/live/initrd.img-2.6.30-backports.1-486 fetch=$fetch boot=live quiet nosudo splash video=vesa:ywrap,mtrr vga=788 nopersistent username=webc hostname=$hostname union=aufs homepage=$homepage locale=hr noprompt + append initrd=iso/live/initrd.img-2.6.30-backports.1-486 fetch=$fetch boot=live quiet nosudo splash video=vesa:ywrap,mtrr vga=788 nopersistent username=webc hostname=$hostname union=aufs homepage=$homepage locale=hr noprompt kioskresetstation=10 }); @@ -127,6 +127,90 @@ label linux }); } +sub clonezilla { + my $ip = shift; + upstream::iso( 'http://sourceforge.net/projects/clonezilla/files/clonezilla_live_alternative_testing/clonezilla-live-20100503-lucid.iso/download' ); + pxelinux::config_for_ip( $ip, qq{ + +default linux +label linux + kernel iso/live/vmlinuz + append initrd=iso/live/initrd.img boot=live union=aufs noswap noprompt vga=788 fetch=http://$server_ip:7777/clonezilla/iso/live/filesystem.squashfs + + }); +} + +sub ubuntu { + my $ip = shift; + upstream::iso( 'http://mirrors.us.kernel.org/ubuntu-releases/lucid/ubuntu-10.04-desktop-i386.iso' ); + + my $export = "$server::base_dir/tftp/ubuntu/iso"; + my $exported = `exportfs | grep $export`; + if ( $exported ne $export ) { + warn "exportfs $exported\n"; + system "sudo exportfs -i -o rw,async,no_root_squash,no_subtree_check,fsid=999 $ip:$export"; + } + pxelinux::config_for_ip( $ip, qq{ + +default linux +label linux + kernel iso/casper/vmlinuz + append initrd=iso/casper/initrd.lz boot=casper netboot=nfs nfsroot=$server_ip:$export -- + + }); +} + +sub memdisk { + my $ip = shift; + + my $dir = "$server::base_dir/tftp/memdisk"; + mkdir $dir unless -e $dir; + + symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk"; + + my $image = client::conf( $ip => 'memdisk.image' ); + + if ( ! $image ) { + $image = 'freedos.gz'; + upstream::mirror_file 'http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/unofficial/balder/balder10.imz' => "$dir/$image"; + warn "using $image [default FreeDOS]\n"; + symlink "$dir/$image", client::ip_path $ip . '/memdisk.image'; + } else { + $image =~ s{^.+/tftp/memdisk/}{} && warn "using $image\n"; + } + + if ( my $kvm = client::conf $ip => 'kvm' ) { + client::conf $ip => 'kvm.bin', 'qemu-system-i386'; # FIXME kvm doesn't seem to work + } + + pxelinux::config_for_ip( $ip, qq{ + +default $image +label $image + kernel memdisk + append initrd=$image + + }); +} + +sub vyatta { + my $ip = shift; + upstream::iso( 'http://www.vyatta.com/downloads/vc6.1/vyatta-livecd_VC6.1-2010.08.20_i386.iso' ); + + my $dir = "$server::base_dir/tftp/vyatta"; + symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk"; + + pxelinux::config_for_ip( $ip, qq{ + +default vyatta +label vyatta + + kernel iso/live/vmlinuz1 + append initrd=iso/live/initrd1.img boot=live nopersistent noautologin nonetworking nouser hostname=vyatta fetch=http://$server_ip:7777/vyatta/iso/live/filesystem.squashfs + + }); +} + sub in_chroot { my ( $dir, $command ) = @_; write_file "$dir/tmp/inside.sh", $command; @@ -185,6 +269,11 @@ sub nfsroot { } + my $exported = `exportfs | grep $export`; + if ( $exported ne $export ) { + warn "exportfs $exported\n"; + system "sudo exportfs -i -o rw,async,no_root_squash,no_subtree_check,fsid=999 $ip:$export"; + } my $hostname = client::conf( $ip => 'hostname' ) || 'nfsroot'; file::replace "$export/etc/hostname", $hostname;