/[pxelator]/lib/PXElator/network.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

Annotation of /lib/PXElator/network.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (hide annotations)
Fri Jul 31 17:07:39 2009 UTC (14 years, 8 months ago) by dpavlin
File size: 492 byte(s)
split network setup into own package and fixed it (tests help :-)

1 dpavlin 82 package network;
2    
3     use warnings;
4     use strict;
5    
6     use File::Slurp;
7    
8     use server;
9    
10     sub tap {
11    
12     my $interfaces = read_file '/etc/network/interfaces';
13    
14     if ( $interfaces !~ m{tap0.*$server::ip}s ) {
15    
16     system "sudo apt-get install vde2";
17    
18     $interfaces .= qq{
19    
20     iface tap0 inet static
21     address $server::ip
22     netmask $server::netmask
23     vde2-switch -
24    
25     };
26    
27     write_file '/etc/network/interfaces', $interfaces;
28    
29     }
30    
31     `/sbin/ifconfig tap0 2>/dev/null` =~ m{UP} || system "sudo ifup tap0";
32    
33     1;
34     }
35    
36     1;

  ViewVC Help
Powered by ViewVC 1.1.26