Changeset 4081 in genesis for tools/wleiden.pl
- Timestamp:
- Mar 16, 2005, 6:10:04 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/wleiden.pl
r4079 r4081 1 #!/usr/bin/perl -w 1 2 # 2 3 # 3 4 # maart 2004 rick@wirelessleiden.nl 4 5 # 5 6 6 7 7 my $debug=0; … … 13 13 14 14 #variablen 15 my $workingfile = "";16 15 my $time=gmtime(); 17 16 my $source=`/bin/hostname -s`; … … 20 19 21 20 #slurp IP berekeningen info 22 do ( $IP_pmPath) || die ("Cann't open $IP_pmPath");21 do ("$IP_pmPath") || die ("Cann't open $IP_pmPath"); 23 22 #slurp dns info 24 do ( $dnsheader_confPath) || die ("Cann't open $dnsheader_confPath");23 do ("$dnsheader_confPath") || die ("Cann't open $dnsheader_confPath"); 25 24 26 25 … … 35 34 if( $1 eq $master_ip ) { 36 35 return(0); 37 break;38 36 }; 39 37 }; … … 59 57 60 58 61 62 59 sub txtconfig { 63 my $output = `cat $workingfile`; 64 return($output); 65 }; 66 60 my $output = ""; 61 foreach $interface (keys %config) { 62 $output .= $config{$interface}; 63 }; 64 return($output); 65 }; 67 66 68 67 … … 169 168 170 169 171 sub rc_ conf{170 sub rc_local { 172 171 my $output = genHeader("#"); 173 172 my $masterNotUsed = master_ipNotUsed(); 174 print $masterNotUsed;175 173 $output.= 176 174 "hostname=\"$nodetype$nodename.wLeiden.NET\"\n" . … … 298 296 299 297 sub parse_config { 300 $workingfile = $_[0];298 my $workingfile = $_[0]; 301 299 do($workingfile) || die("Cann't open/parse $workingfile"); 302 foreach $if (keys %config) {303 $cfg=$config{$if};300 foreach my $if (keys %config) { 301 my $cfg=$config{$if}; 304 302 while ($cfg) { 305 303 $cfg=~s/^([^\n\r]+)[\r\n]*//m; 306 $line=$1;304 my $line=$1; 307 305 $line=~s/\s*#.*//; 308 if ((( $name,$value)=split(/=/,$line)) eq 2) {309 $doit="if (exists(\$$name\{\"$if\"\})) {\$$name\{\"$if\"\}.=\"$separator$value\";} else {\$$name\{\"$if\"\}.=\"$value\";}";306 if (((my $name, my $value)=split(/=/,$line)) eq 2) { 307 my $doit="if (exists(\$$name\{\"$if\"\})) {\$$name\{\"$if\"\}.=\";$value\";} else {\$$name\{\"$if\"\}.=\"$value\";}"; 310 308 eval($doit); 311 309 }; … … 324 322 }; 325 323 326 if( $debug) {324 if( exists $ARGV[0] ) { 327 325 if( exists $ARGV[1] ) { 328 326 parse_config($ARGV[0]); … … 333 331 }; 334 332 }; 333 334 1;
Note:
See TracChangeset
for help on using the changeset viewer.