22 katalog debian_live webconverger
23 debirf tinycore nfsroot
25 clonezilla ubuntu memdisk vyatta android
32 my $from = 'http://cdimage.debian.org/cdimage/release/current-live/i386/web/';
33 $from = 'http://cdimage.debian.org/cdimage/squeeze_live_alpha2/i386/web/';
34 my $variant = 'standard';
36 my $dir = upstream::files $from => 'MD5SUMS';
38 my ( $vmlinuz, $initrd, $squashfs );
40 my @md5sum = read_file "$dir/MD5SUMS";
43 $vmlinuz = $1 if m/\s+(\S*vmlinuz\S*)/;
44 $initrd = $1 if m/\s+(\S*$variant\S*initrd\S*)/;
45 $squashfs = $1 if m/\s+(\S*$variant\S*\.squashfs)$/;
46 warn "# MD5SUM: $_\n";
49 upstream::files $from => $vmlinuz, $initrd, $squashfs;
51 my $hostname = client::conf( $ip => 'hostname' ) || 'debian-live';
53 # FIXME drop in shell because users doesn't work in current image
54 my $custom_init = 'init=/bin/hash';
56 if ( my $custom_squashfs = client::conf( $ip => 'squashfs' ) ) {
57 $squashfs = $custom_squashfs;
61 pxelinux::config_for_ip( $ip, qq{
66 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
73 Webconverger - the opensource Web Kiosk
75 L<http://webconverger.org/>
80 my ( $dir, $path ) = @_;
81 my @glob = glob "$dir/$path";
82 my $first = $glob[0] || die "no $dir/$path";
84 $first =~ s{^\Q$dir\E}{}g;
91 $mounted->{"webconverger/$ip"} ||= upstream::iso( 'http://download.webconverger.com/webc-6.2.iso' );
93 my $hostname = client::conf( $ip => 'hostname' ) || 'webconverger';
95 my $homepage = client::conf( $ip => 'webconverger/homepage'
96 , default => "http://$server_ip:7777/client" );
97 my $fetch = client::conf( $ip => 'webconverger/fetch'
98 , default => "http://$server_ip:7777/webconverger/iso/live/filesystem.squashfs" );
100 my $mnt = "$server::base_dir/tftp/webconverger/iso";
101 warn "# mnt: $mnt\n";
102 my $kernel = _glob_first $mnt => 'live/vmlinuz*';
103 my $initrd = _glob_first $mnt => 'live/initrd.img*';
105 pxelinux::config_for_ip( $ip, qq{
110 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
118 $mounted->{"webconverger/$ip"} ||= upstream::iso( 'http://download.webconverger.com/webc-5.5.iso' );
119 my $hostname = client::conf( $ip => 'hostname' ) || 'katalog';
120 my $homepage = client::conf( $ip => 'webconverger/homepage' => "http://koha.ffzg.hr" );
121 my $fetch = client::conf( $ip => 'webconverger/fetch' => "http://$server_ip:7777/webconverger/custom.squashfs" );
123 pxelinux::config_for_ip( $ip, qq{
127 kernel iso/live/vmlinuz-2.6.30-backports.1-486
128 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
135 debirf is a system that will create diskless, all-in-ram images (kernel and initramfs) that boot entirely into ram and leave the user in a fully functional Debian system.
137 L<http://cmrg.fifthhorseman.net/wiki/debirf>
144 upstream::iso( 'http://cmrg.mayfirst.org/debirf/debirf-rescue_lenny_2.6.26-1-686.iso' );
146 pxelinux::config_for_ip( $ip, qq{
150 kernel iso/vmlinuz-2.6.26-1-686
151 append initrd=iso//debirf-rescue_lenny_2.6.26-1-686.cgz
158 upstream::iso( 'http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/3.x/release/tinycore-current.iso' );
159 pxelinux::config_for_ip( $ip, qq{
163 kernel iso/boot/bzImage
164 append initrd=iso/boot/tinycore.gz
171 upstream::iso( 'http://sourceforge.net/projects/clonezilla/files/clonezilla_live_alternative_testing/clonezilla-live-20100503-lucid.iso/download' );
172 pxelinux::config_for_ip( $ip, qq{
176 kernel iso/live/vmlinuz
177 append initrd=iso/live/initrd.img boot=live union=aufs noswap noprompt vga=788 fetch=http://$server_ip:7777/clonezilla/iso/live/filesystem.squashfs
184 upstream::iso( 'http://mirrors.us.kernel.org/ubuntu-releases/lucid/ubuntu-10.04-desktop-i386.iso' );
186 my $export = "$server::base_dir/tftp/ubuntu/iso";
187 my $exported = `exportfs | grep $export`;
188 if ( $exported ne $export ) {
189 warn "exportfs $exported\n";
190 system "sudo exportfs -i -o rw,async,no_root_squash,no_subtree_check,fsid=999 $ip:$export";
192 pxelinux::config_for_ip( $ip, qq{
196 kernel iso/casper/vmlinuz
197 append initrd=iso/casper/initrd.lz boot=casper netboot=nfs nfsroot=$server_ip:$export --
205 my $dir = "$server::base_dir/tftp/memdisk";
206 mkdir $dir unless -e $dir;
208 symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk";
210 my $image = client::conf( $ip => 'memdisk.image' );
213 $image = 'freedos.gz';
214 upstream::mirror_file 'http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/unofficial/balder/balder10.imz' => "$dir/$image";
215 warn "using $image [default FreeDOS]\n";
216 symlink "$dir/$image", client::ip_path $ip . '/memdisk.image';
218 $image =~ s{^.+/tftp/memdisk/}{} && warn "using $image\n";
221 if ( my $kvm = client::conf $ip => 'kvm' ) {
222 client::conf $ip => 'kvm.bin', 'qemu-system-i386'; # FIXME kvm doesn't seem to work
225 pxelinux::config_for_ip( $ip, qq{
237 upstream::iso( 'http://www.vyatta.com/downloads/vc6.1/vyatta-livecd_VC6.1-2010.08.20_i386.iso' );
239 my $dir = "$server::base_dir/tftp/vyatta";
240 symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk";
242 pxelinux::config_for_ip( $ip, qq{
247 kernel iso/live/vmlinuz1
248 append initrd=iso/live/initrd1.img boot=live nopersistent noautologin nonetworking nouser hostname=vyatta fetch=http://$server_ip:7777/vyatta/iso/live/filesystem.squashfs
255 my $path = upstream::iso( 'http://android-x86.googlecode.com/files/android-x86-1.6-r2.iso' );
257 my $dir = "$server::base_dir/tftp/android";
258 symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk";
260 client::conf $ip => 'kvm.boot' => "n -cdrom $path";
262 pxelinux::config_for_ip( $ip, qq{
264 default android-1.6-donut
265 label android-1.6-donut
268 append initrd=iso/initrd.img root=/dev/ram0 androidboot_hardware=eeepc acpi_sleep=s3_bios,s3_mode quiet SRC= DATA= SDCARD= vga=788 DEBUG=1
274 # http://www.sysresccd.org/Sysresccd-manual-en_PXE_network_booting
277 my $path = upstream::iso( 'http://sourceforge.net/projects/systemrescuecd/files/sysresccd-x86/1.6.1/systemrescuecd-x86-1.6.1.iso/download' );
279 my $dir = "$server::base_dir/tftp/systemrescue";
280 symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk";
282 client::conf $ip => 'kvm.boot' => "n -cdrom $path";
284 pxelinux::config_for_ip( $ip, qq{
289 kernel iso/isolinux/rescuecd
290 append initrd=iso/isolinux/initram.igz dodhcp netboot=http://$server::ip:7777/systemrescue/iso/sysrcd.dat
296 my ( $dir, $command ) = @_;
297 write_file "$dir/tmp/inside.sh", $command;
298 system "sudo chroot $dir sh -x /tmp/inside.sh";
302 my $ip = shift || die "no ip?";
307 my $nfsroot = "$server::base_dir/tftp/nfsroot";
308 my $debian_mirror = server::conf_default( 'debian_mirror', 'http://ftp.debian.org/debian' );
310 if ( ! -e $nfsroot ) {
311 system "sudo apt-get install nfs-kernel-server debootstrap aufs-modules-`uname -r` aufs-tools";
315 my $debootstrap = "$nfsroot/debootstrap";
317 if ( ! -e $debootstrap ) {
319 system "sudo debootstrap --arch i386 $dist $debootstrap $debian_mirror";
321 file::append "$debootstrap/etc/apt/sources.list.d/non-free.list", "deb $debian_mirror $dist non-free\n";
322 in_chroot $debootstrap => 'apt-get update';
324 file::append "$debootstrap/etc/kernel-img.conf", "do_initrd = Yes\n";
325 in_chroot $debootstrap => 'apt-get -f install -y --force-yes locales linux-image-2.6-686 firmware-bnx2';
327 # this can fails on some distros, so we run it alone
328 in_chroot $debootstrap => 'apt-get install -y --force-yes atl2-modules-2.6-686';
329 file::append "$debootstrap/etc/initramfs-tools/modules", "atl2\n";
331 file::change "$debootstrap/etc/initramfs-tools/initramfs.conf", 'BOOT=local' => 'BOOT=nfs';
332 in_chroot $debootstrap => 'update-initramfs -u';
336 my $export = "$nfsroot/$ip";
337 my $br = "$nfsroot/br/$ip";
339 $mounted->{"nfsroot/$ip"} ||= `mount | grep $export`;
341 if ( ! $mounted->{"nfsroot/$ip"} ) {
342 warn "mounting $export";
344 mkdir "$nfsroot/br" unless -e "$nfsroot/br";
345 mkdir $br unless -e $br;
346 mkdir $export unless -e $export;
348 system "sudo mount -t aufs -o br:$br:$debootstrap none $export";
349 system "sudo exportfs -i -o rw,async,no_root_squash,no_subtree_check,fsid=999 $ip:$export";
353 my $exported = `exportfs | grep $export`;
354 if ( $exported ne $export ) {
355 warn "exportfs $exported\n";
356 system "sudo exportfs -i -o rw,async,no_root_squash,no_subtree_check,fsid=999 $ip:$export";
359 my $hostname = client::conf( $ip => 'hostname' ) || 'nfsroot';
360 file::replace "$export/etc/hostname", $hostname;
361 file::replace "$export/etc/hosts", "127.0.0.1\tlocalhost $hostname\n";
362 file::replace "$export/etc/resolv.conf", "domain $server->{domain}\nnameserver $server->{ip}\n";
363 file::replace "$export/etc/rsyslog.d/pxelator.conf", "*.*\t\@$server->{ip}\n";
365 file::append "$debootstrap/etc/network/interfaces", qq{
368 iface lo inet loopback
376 file::copy_once $_ => "$export/$_";
377 file::append "$export/etc/rc.local", $_;
378 } ( '/srv/sysadmin-cookbook/recepies/amt/serial-console.sh' );
380 pxelinux::config_ip_boot( $ip, "$export/boot", "root=/dev/nfs nfsroot=$server->{ip}:$export ro ip=dhcp" );
386 ssh::shell( $ip, 'cat /proc/vz/veinfo', 'vzlist -a', 'uptime', 'free', 'df', 'zfs list' );
392 my $ip = shift || return;
393 $server = server::as_hash_for $ip;
394 $server_ip = $server->{ip} || die "no server ip";
395 my $config = client::conf( $ip => 'config' ) || return;
396 my $ret = eval $config . '($ip)'; # must be last
398 warn "ERROR in executing $config($ip): $@\n";
399 $ret .= qq{<pre style="color:red">$@</pre>};