/[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 142 by dpavlin, Tue Aug 4 18:05:49 2009 UTC
# Line 8  use server; Line 8  use server;
8  use pxelinux;  use pxelinux;
9  use File::Slurp;  use File::Slurp;
10    
 sub shared {  
         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;  
 }  
   
11  sub debian_live {  sub debian_live {
12          $dhcpd::file = "pxelinux.0";          $dhcpd::file = "pxelinux.0";
13          $pxelinux::path_prefix = 'live-helper/tftpboot/';          $pxelinux::path_prefix = 'live-helper/tftpboot/';
14          $pxelinux::config_file = 'pxelinux.cfg/default';          $pxelinux::config_file = 'pxelinux.cfg/default';
15  }  }
16    
17  use LWP::Simple qw/mirror RC_NOT_MODIFIED/;  use upstream;
18    
19    =head1 webconverger
20    
21    Webconverger - the opensource Web Kiosk
22    
23    L<http://webconverger.org/>
24    
25    =cut
26    
27  sub webconverger {  sub webconverger {
28          $dhcpd::file = "pxelinux.0";          my $ip = shift;
         $pxelinux::path_prefix = 'webconverger/';  
29    
30          my $dir = "$server::base_dir/tftp/$pxelinux::path_prefix";          upstream::iso( 'http://download.webconverger.com/webc-5.2.iso' );
31    
32          mkdir $dir unless -d $dir;          pxelinux::config_for_ip( $ip, qq{
33    
34          my $cfg = "$dir/pxelinux.cfg";  default webconverger
35          return 1 if -e $cfg;  label webconverger
36            kernel iso/live/vmlinuz-2.6.30-backports.1-486
37            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
38    
39            });
40    
41    }
42    
43          mkdir $cfg;  =head1 debirf
44    
45          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';  
46    
47          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")  
                 ;  
48    
49          mkdir "$dir/iso" unless -e "$dir/iso";  =cut
50    
51          system "mount -t iso9660 | grep webc-5.2 || sudo mount $iso $dir/iso/ -o loop -t iso9660 -v";  sub debirf {
52            my $ip = shift;
53    
54          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' );
55    
56          $cfg .= '/default';          pxelinux::config_for_ip( $ip, qq{
57    
58          write_file $cfg, qq{  default linux
59  label webconverger  label linux
60          kernel iso/live/vmlinuz-2.6.30-backports.1-486          kernel iso/vmlinuz-2.6.26-1-686
61          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
         };  
62    
63  #       $pxelinux::config_file = $cfg;          });
64  }  }
65    
66  sub for_ip {  sub for_ip {
67          my $ip = shift;          my $ip = shift;
68  #       debian_live();  #       debian_live();
69          webconverger();  #       webconverger($ip);
70            debirf($ip);
71  #       $tftp::dir = "$server::base_dir/tftp/$pxelinux::path_prefix";  #       $tftp::dir = "$server::base_dir/tftp/$pxelinux::path_prefix";
72  }  }
73    

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

  ViewVC Help
Powered by ViewVC 1.1.26