/[pxelator]/lib/PXElator/config.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/config.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 135 by dpavlin, Tue Aug 4 13:19:08 2009 UTC revision 154 by dpavlin, Wed Aug 5 23:53:24 2009 UTC
# Line 8  use server; Line 8  use server;
8  use pxelinux;  use pxelinux;
9  use File::Slurp;  use File::Slurp;
10    
11  sub shared {  sub available { qw/debian_live webconverger debirf tinycore/ };
         my ($name, $value) = @_;  
   
         my $path ="$server::base_dir/conf/$server::ip/$name";  
         if ( defined $value ) {  
                 write_file $path, $value;  
         } else {  
                 $value = read_file $path if -e $path;  
         }  
         return $value;  
 }  
12    
13  sub debian_live {  sub debian_live {
14          $dhcpd::file = "pxelinux.0";          $dhcpd::file = "pxelinux.0";
# Line 26  sub debian_live { Line 16  sub debian_live {
16          $pxelinux::config_file = 'pxelinux.cfg/default';          $pxelinux::config_file = 'pxelinux.cfg/default';
17  }  }
18    
19  use LWP::Simple qw/mirror RC_NOT_MODIFIED/;  use upstream;
20    
21    =head1 webconverger
22    
23    Webconverger - the opensource Web Kiosk
24    
25    L<http://webconverger.org/>
26    
27    =cut
28    
29  sub webconverger {  sub webconverger {
30          $dhcpd::file = "pxelinux.0";          my ($ip) = @_;
31          $pxelinux::path_prefix = 'webconverger/';  
32            upstream::iso( 'http://download.webconverger.com/webc-5.2.iso' );
33    
34            my $homepage = server::shared( "$ip/homepage" ) || "http://${server::ip}:7777/client";
35            my $hostname = server::shared( "$ip/hostname" ) || 'webconverger';
36    
37            pxelinux::config_for_ip( $ip, qq{
38    
39          my $dir = "$server::base_dir/tftp/$pxelinux::path_prefix";  default webconverger
40    label webconverger
41            kernel iso/live/vmlinuz-2.6.30-backports.1-486
42            append initrd=iso/live/initrd.img-2.6.30-backports.1-486 fetch=http://172.16.10.1:7777/webconverger/iso/live/filesystem.squashfs boot=live quiet nosudo splash video=vesa:ywrap,mtrr vga=788 nopersistent username=webc hostname=$hostname union=aufs homepage=$homepage
43    
44          mkdir $dir unless -d $dir;          });
45    
46          my $cfg = "$dir/pxelinux.cfg";  }
         return 1 if -e $cfg;  
47    
48          mkdir $cfg;  =head1 debirf
49    
50          my $iso = '/srv/pxelator/iso/webc-5.2.iso';  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.
         my $url = 'http://download.webconverger.com/webc-5.2.iso';  
51    
52          print STDERR "mirror $url";  L<http://cmrg.fifthhorseman.net/wiki/debirf>
         mirror( $url, $iso)  
                 == RC_NOT_MODIFIED  
                 && warn(" not modified\n")  
                 || warn(" done ", -s $iso, " bytes\n")  
                 ;  
53    
54          mkdir "$dir/iso" unless -e "$dir/iso";  =cut
55    
56          system "mount -t iso9660 | grep webc-5.2 || sudo mount $iso $dir/iso/ -o loop -t iso9660 -v";  sub debirf {
57            my $ip = shift;
58    
59          symlink "/usr/lib/syslinux/pxelinux.0", "$dir/$dhcpd::file";          upstream::iso( 'http://cmrg.mayfirst.org/debirf/debirf-rescue_lenny_2.6.26-1-686.iso' );
60    
61          $cfg .= '/default';          pxelinux::config_for_ip( $ip, qq{
62    
63          write_file $cfg, qq{  default linux
64  label webconverger  label linux
65          kernel iso/live/vmlinuz-2.6.30-backports.1-486          kernel iso/vmlinuz-2.6.26-1-686
66          append initrd=iso/live/initrd.img-2.6.30-backports.1-486 fetch=http://172.16.10.1/pxelator/webconverger/iso/live/filesystem.squashfs boot=live quiet homepage=http://172.16.10.1:7777/ nonetworking nosudo splash video=vesa:ywrap,mtrr vga=788 nopersistent username=webc hostname=webconverger union=aufs          append initrd=iso//debirf-rescue_lenny_2.6.26-1-686.cgz
67          };  
68            });
69    }
70    
71    sub tinycore {
72            my $ip = shift;
73            upstream::iso( 'http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/release/tinycore_2.2.iso' );
74            pxelinux::config_for_ip( $ip, qq{
75    
76    default linux
77    label linux
78            kernel iso/boot/bzImage
79            append initrd=iso/boot/tinycore.gz
80    
81  #       $pxelinux::config_file = $cfg;          });
82  }  }
83    
84  sub for_ip {  sub for_ip {
85          my $ip = shift;          my $ip = shift;
86  #       debian_live();          my $deploy = server::shared( "deploy/$ip" ) || 'webconverger';
87          webconverger();          eval $deploy . '($ip)';
88  #       $tftp::dir = "$server::base_dir/tftp/$pxelinux::path_prefix";  #       $tftp::dir = "$server::base_dir/tftp/$pxelinux::path_prefix";
89  }  }
90    

Legend:
Removed from v.135  
changed lines
  Added in v.154

  ViewVC Help
Powered by ViewVC 1.1.26