--- lib/PXElator/config.pm 2010/09/17 20:57:11 534 +++ lib/PXElator/config.pm 2011/02/12 14:31:16 558 @@ -18,7 +18,14 @@ our $server; our $server_ip; -sub available { qw/katalog debian_live webconverger debirf tinycore nfsroot openvz printer wrt clonezilla ubuntu memdisk vyatta android/ }; +sub available { qw/ + katalog debian_live webconverger + debirf tinycore nfsroot + openvz printer wrt + clonezilla ubuntu memdisk vyatta android + systemrescue + memtest +/ }; sub debian_live { my ($ip) = @_; @@ -44,14 +51,20 @@ my $hostname = client::conf( $ip => 'hostname' ) || 'debian-live'; - # FIXME drop in shell because we can't create user + # FIXME drop in shell because users doesn't work in current image + my $custom_init = 'init=/bin/hash'; + + if ( my $custom_squashfs = client::conf( $ip => 'squashfs' ) ) { + $squashfs = $custom_squashfs; + $custom_init = ''; + } pxelinux::config_for_ip( $ip, qq{ default debian_live label debian_live kernel $vmlinuz - append initrd=$initrd fetch=http://$server_ip:7777/debian_live/$squashfs boot=live nopersistent hostname=$hostname union=aufs noprompt autologin username=user debug init=/bin/bash + append initrd=$initrd fetch=http://$server_ip:7777/debian_live/$squashfs boot=live nopersistent hostname=$hostname union=aufs noprompt autologin username=user debug $custom_init }); } @@ -64,10 +77,19 @@ =cut +sub _glob_first { + my ( $dir, $path ) = @_; + my @glob = glob "$dir/$path"; + my $first = $glob[0] || die "no $dir/$path"; + $dir =~ s{iso/*$}{}; + $first =~ s{^\Q$dir\E}{}g; + return $first; +} + sub webconverger { my ($ip) = @_; - $mounted->{"webconverger/$ip"} ||= upstream::iso( 'http://download.webconverger.com/webc-5.5.iso' ); + $mounted->{"webconverger/$ip"} ||= upstream::iso( 'http://download.webconverger.com/webc-6.2.iso' ); my $hostname = client::conf( $ip => 'hostname' ) || 'webconverger'; @@ -76,12 +98,17 @@ my $fetch = client::conf( $ip => 'webconverger/fetch' , default => "http://$server_ip:7777/webconverger/iso/live/filesystem.squashfs" ); + my $mnt = "$server::base_dir/tftp/webconverger/iso"; + warn "# mnt: $mnt\n"; + my $kernel = _glob_first $mnt => 'live/vmlinuz*'; + my $initrd = _glob_first $mnt => 'live/initrd.img*'; + pxelinux::config_for_ip( $ip, qq{ 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 kioskresetstation=10 + kernel $kernel + append initrd=$initrd 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 }); @@ -243,6 +270,45 @@ }); } + + +# http://www.sysresccd.org/Sysresccd-manual-en_PXE_network_booting +sub systemrescue { + my $ip = shift; + my $path = upstream::iso( 'http://sourceforge.net/projects/systemrescuecd/files/sysresccd-x86/1.6.1/systemrescuecd-x86-1.6.1.iso/download' ); + + my $dir = "$server::base_dir/tftp/systemrescue"; + symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk"; + + client::conf $ip => 'kvm.boot' => "n -cdrom $path"; + + pxelinux::config_for_ip( $ip, qq{ + +default systemrescue +label systemrescue + + kernel iso/isolinux/rescuecd + append initrd=iso/isolinux/initram.igz dodhcp netboot=http://$server::ip:7777/systemrescue/iso/sysrcd.dat + + }); +} + +# http://www.memtest.org/ +sub memtest { + my $ip = shift; + + my $dir = "$server::base_dir/tftp/memtest"; + mkdir $dir unless -e $dir; + symlink '/boot/memtest86+.bin', "$dir/memtest.bin" unless -e "$dir/memtest.bin"; + + pxelinux::config_for_ip( $ip, qq{ + +default memtest +label memtest + linux memtest.bin + + }); +} sub in_chroot { my ( $dir, $command ) = @_;