diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/Makefile.in | 37 | ||||
-rwxr-xr-x | bin/cat5rancid.in (renamed from bin/cat5rancid) | 336 | ||||
-rwxr-xr-x | bin/clogin.in (renamed from bin/clogin) | 127 | ||||
-rwxr-xr-x | bin/configure | 1239 | ||||
-rw-r--r-- | bin/configure.in | 49 | ||||
-rwxr-xr-x | bin/control_rancid.in (renamed from bin/control_rancid) | 16 | ||||
-rwxr-xr-x | bin/create_cvs.in (renamed from bin/create_cvs) | 0 | ||||
-rwxr-xr-x | bin/do-diffs.in (renamed from bin/do-diffs) | 2 | ||||
-rwxr-xr-x | bin/elogin.in (renamed from bin/elogin) | 2 | ||||
-rw-r--r-- | bin/env.in (renamed from bin/env) | 5 | ||||
-rwxr-xr-x | bin/erancid.in (renamed from bin/erancid) | 2 | ||||
-rwxr-xr-x | bin/flogin.in (renamed from bin/flogin) | 2 | ||||
-rwxr-xr-x | bin/francid.in (renamed from bin/francid) | 2 | ||||
-rwxr-xr-x | bin/jlogin.in (renamed from bin/jlogin) | 198 | ||||
-rwxr-xr-x | bin/jrancid.in (renamed from bin/jrancid) | 20 | ||||
-rwxr-xr-x | bin/par.in (renamed from bin/par) | 2 | ||||
-rwxr-xr-x | bin/rancid-fe.in (renamed from bin/rancid-fe) | 2 | ||||
-rwxr-xr-x | bin/rancid.in (renamed from bin/rancid) | 123 | ||||
-rwxr-xr-x | bin/rename.in (renamed from bin/rename) | 2 | ||||
-rwxr-xr-x | bin/rrancid.in (renamed from bin/rrancid) | 2 |
20 files changed, 1822 insertions, 346 deletions
diff --git a/bin/Makefile.in b/bin/Makefile.in new file mode 100644 index 0000000..ca5616b --- /dev/null +++ b/bin/Makefile.in @@ -0,0 +1,37 @@ +PREFIX = @prefix@ + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +BIN_PROGS = @RD_BIN_PROGS@ +BIN_DATAS = @RD_BIN_DATAS@ + +all: + +install: all + for prog in $(BIN_PROGS) ; do \ + $(INSTALL) $$prog $(PREFIX)/bin; \ + done; \ + if test -f $(PREFIX)/bin/env ; then \ + echo "WARNING: *** $(PREFIX)/bin/env exists: not installing."; \ + else \ + $(INSTALL_DATA) env $(PREFIX)/bin; \ + fi +# BIN_DATAS are empty at the moment. +# for prog in $(BIN_DATAS) ; do \ +# $(INSTALL_DATA) $$prog $(PREFIX)/bin; \ +# done; \ + +clean: + rm -f Makefile env $(BIN_DATAS) $(BIN_PROGS) + +distclean: clean + rm -f config.log config.status + +distdir: + for file in Makefile.in configure.in env.in $(BIN_DATAS:=.in) ; do \ + $(INSTALL_DATA) $$file $(distdir); \ + done + for file in configure $(BIN_PROGS:=.in) ; do \ + $(INSTALL) $$file $(distdir); \ + done diff --git a/bin/cat5rancid b/bin/cat5rancid.in index 8073448..8eb529b 100755 --- a/bin/cat5rancid +++ b/bin/cat5rancid.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!@PERLV_PATH@ ## ## ## Copyright (C) 1997 by Henry Kilmer. @@ -28,7 +28,9 @@ $file = $opt_f; $host = $ARGV[0]; $clean_run = 0; $found_end = 0; -$timeo = 90; # clogin timeout in seconds +$timeo = 90; # clogin timeout in seconds + +my(%modules); # module info (part from sh ver, part from sh module) # This routine is used to print out the router configuration sub ProcessHistory { @@ -138,113 +140,90 @@ sub ShowVersion { tr/\015//d; last if(/^$prompt/); next if(/^(\s*|\s*$cmd\s*)$/); - if (/^Slave in slot (\d+) is running/) { - $slave = " Slave:"; - next; - } - /^IOS .* Software \(([A-Za-z-0-9]*)\), .*Version\s+(.*)$/ && + /^(\S+) Software, Version\s+(.*)$/ && ProcessHistory("COMMENTS","keysort","F1", - "!Image:$slave Software: $1, $2\n") && next; - /^([A-Za-z-0-9_]*) Synced to mainline version: (.*)$/ && - ProcessHistory("COMMENTS","keysort","F2", - "!Image:$slave $1 Synced to mainline version: $2\n") && next; - /^Compiled (.*)$/ && + "!Image: Software: $2\n") && next; + /^(\S+) S\/W compiled on (.*)$/ && ProcessHistory("COMMENTS","keysort","F3", - "!Image:$slave Compiled: $1\n") && next; - /^ROM: (System )?Bootstrap.*(Version.*)$/ && + "!Image: Compiled: $1 on $2\n") && next; + /^System Bootstrap (Version.*)$/ && ProcessHistory("COMMENTS","keysort","G1", - "!ROM Bootstrap: $2\n") && next; - /^ROM: \d+ Bootstrap .*(Version.*)$/ && - ProcessHistory("COMMENTS","keysort","G2", - "!ROM Image: Bootstrap $1\n!\n") && next; - /^ROM: .*(Version.*)$/ && - ProcessHistory("COMMENTS","keysort","G3","!ROM Image: $1\n") && next; - /^BOOTFLASH: .*(Version.*)$/ && - ProcessHistory("COMMENTS","keysort","G4","!BOOTFLASH: $1\n") && next; - /^System image file is "([^\"]*)", booted via (\S*)/ && -# removed the booted source due to -# CSCdk28131: cycling info in 'sh ver' -# ProcessHistory("COMMENTS","keysort","F4","!Image: booted via $2, $1\n") && - ProcessHistory("COMMENTS","keysort","F4","!Image: booted $1\n") && - next; - /^System image file is "([^\"]*)"$/ && - ProcessHistory("COMMENTS","keysort","F5","!Image: $1\n") && next; - if (/(\S+)\s+\((\S+)\)\s+processor.*with (\S+K) bytes/) { - my($proc) = $1; - my($cpu) = $2; - my($mem) = $3; - if ( $1 eq "CSC") { - $type = "AGS"; - } elsif ( $1 eq "CSC4") { - $type = "AGS+"; - } elsif ( $1 eq "2511" || $1 eq "2524" || $1 eq "AS2511-RJ") { - $type = "2500"; - } elsif ( $1 eq "3620" || $1 eq "3640") { - $type = "3600"; - } elsif ( $1 eq "RSP7000") { - $type = "7500"; - } elsif ( $1 =~ /RSP\d/) { - $type = "7500"; - } elsif ( $1 eq "RP1") { - $type = "7000"; - } elsif ( $1 eq "RP") { - $type = "7000"; - } elsif ( $1 =~ /720[246]/) { - $type = "7200"; - } elsif ($1 =~ /1200[48]\/GRP/ || $1 =~ /1201[26]\/GRP/) { - $type = "12000"; - } else { - $type = $1; - } - print STDERR "TYPE = $type\n" if ($debug); + "!Bootstrap: $1\n") && next; + if (/^Hardware Version: (\S+) Model: (\S+) Serial #: (\S+)/) { + my($proc) = $2; + # Really should figure out types of switches here. + $type = $2; ProcessHistory("COMMENTS","keysort","A1", - "!Chassis type:$slave $proc - a $type router\n"); - ProcessHistory("COMMENTS","keysort","B1", - "!Memory:$slave main $mem\n"); - ProcessHistory("COMMENTS","keysort","A3","!CPU:$slave $cpu\n"); + "!Chassis type: $proc - a $type switch\n"); + ProcessHistory("COMMENTS","keysort","C1", "!Serial Number: $3\n"); + ProcessHistory("COMMENTS","keysort","C2", "!Hardware Version: $1\n"); next; } - if (/(\S+) Silicon\s*Switch Processor/) { - if (!defined($C0)) { - $C0=1; ProcessHistory("COMMENTS","keysort","C0","!\n"); + # stuff module h/w, s/w, ports, etc into %module + if (/^Mod\s+Port\s+Model/) { + <INPUT>; + my($slot); + while (<INPUT>) { + tr/\015//d; + last if (/^\s*$/); + if (/^(\d+)\s+(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s?:\s+(\S+)/) { + $slot = $1; + $modules{$slot}->{ports} = $2; + $modules{$slot}->{model} = $3; + $modules{$slot}->{serial} = $4; + $modules{$slot}->{$5} = $6; # revision info + } + /^\s+(\S+)\s?:\s+(\S+)/ && + ($modules{$slot}->{$1} = $2); } - ProcessHistory("COMMENTS","keysort","C2","!SSP: $1\n"); - $ssp = 1; - $sspmem = $1; next; } - /^(\d+K) bytes of multibus/ && - ProcessHistory("COMMENTS","keysort","B2", - "!Memory: multibus $1\n") && next; - /^(\d+K) bytes of non-volatile/ && - ProcessHistory("COMMENTS","keysort","B3", - "!Memory: nvram $1\n") && next; - /^(\d+K) bytes of flash memory/ && - ProcessHistory("COMMENTS","keysort","B5","!Memory: flash $1\n") && - next; - /^(\d+K) bytes of .*flash partition/ && - ProcessHistory("COMMENTS","keysort","B6", - "!Memory: flash partition $1\n") && next; - /^(\d+K) bytes of Flash internal/ && - ProcessHistory("COMMENTS","keysort","B4", - "!Memory: bootflash $1\n") && next; - if(/^(\d+K) bytes of (Flash|ATA)?.*PCMCIA .*slot ?(\d)/i) { - ProcessHistory("COMMENTS","keysort","B7", - "!Memory: pcmcia $2 slot$3 $1\n"); + # stuff module h/w, s/w, ports, etc into %module - yet another format + if (/^Module\s+Ports\s+Model/) { + <INPUT>; + my($slot); + while (<INPUT>) { + tr/\015//d; + last if (/^\s*$/); + if (/^(\d+)\s+(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+\s+)?(\S+)\s*$/) { + $slot = $1; + $modules{$slot}->{ports} = $2; + $modules{$slot}->{model} = $3; + $modules{$slot}->{serial} = $4; + $modules{$slot}->{Hw} = $5; + $modules{$slot}->{Fw} = $6; + $modules{$slot}->{Sw} = $8; + $modules{$slot}->{Fw1} = $7; + $modules{$slot}->{Fw1} =~ s/\s*$//; + if ($modules{$slot}->{Fw1} =~ /^$/) {delete($modules{$slot}->{Fw1});} + } + } next; } - if(/^WARNING/) { - if (!defined($I0)) { - $I0=1; - ProcessHistory("COMMENTS","keysort","I0","!\n"); - } - ProcessHistory("COMMENTS","keysort","I1","! $_"); - # The line after the WARNING is what to do about it. + if (/^ DRAM/) { + # Eat 2 lines & then get the total dram, flash, & nvram. + $_ = <INPUT>; $_ = <INPUT>; $_ = <INPUT>; tr/\015//d; - ProcessHistory("COMMENTS","keysort","I1","! $_"); + /\S+\s+(\S+)\s+\S+\s+\S+\s+(\S+)\s+\S+\s+\S+\s+(\S+)/ && + ProcessHistory("COMMENTS","keysort","B1", + "!Memory: dram $1\n") && + ProcessHistory("COMMENTS","keysort","B5", + "!Memory: flash $2\n") && + ProcessHistory("COMMENTS","keysort","B2", + "!Memory: nvram $3\n"); + next; } - if (/^Configuration register is (.*)$/) { - $config_register=$1; + if (/^Module DRAM/) { + # Eat a line & then get the total dram, flash, & nvram. + $_ = <INPUT>; + $_ = <INPUT>; tr/\015//d; + /\S+\s+(\S+)\s+(\S+)\s+(\S+)/ && + ProcessHistory("COMMENTS","keysort","B1", + "!Memory: dram $1\n") && + ProcessHistory("COMMENTS","keysort","B5", + "!Memory: flash $2\n") && + ProcessHistory("COMMENTS","keysort","B2", + "!Memory: nvram $3\n"); next; } } @@ -336,8 +315,6 @@ sub ShowGSR { # This routine parses "show boot" sub ShowBoot { - # Pick up boot variables if 7000/7200/7500/12000; - # otherwise pick up bootflash. print STDERR " In ShowBoot: $_" if ($debug); while (<INPUT>) { @@ -353,10 +330,12 @@ sub ShowBoot { if (!defined($H0)) { $H0=1; ProcessHistory("COMMENTS","keysort","H0","!\n"); } - if ($type !~ /^(120|7)/) { - ProcessHistory("COMMENTS","keysort","H2","!BootFlash: $_"); - } elsif (/variable/) { - ProcessHistory("COMMENTS","keysort","H1","!Variable: $_"); + /^(\S+) variable (.*)$/ && + ProcessHistory("COMMENTS","keysort","H1","!Variable: $1 $2\n") && + next; + if (/^Configuration register is (.*)$/) { + $config_register=$1; + next; } } ProcessHistory("COMMENTS","","","!\n"); @@ -683,32 +662,106 @@ sub ShowDiag { # This routine parses "show module" sub ShowModule { + my($slot); print STDERR " In ShowModule: $_" if ($debug); -# # eat the header lines -# $junk = <INPUT>; -# $junk = <INPUT>; - - while (<INPUT>) { +OUTER:while (<INPUT>) { tr/\015//d; last if(/^$prompt/); -# last if(/^$/); -# $junk = $_; -# $slot = substr($junk, 0, 2) + 0; -# $port = substr($junk, 24, 3) + 0; -# $plu = ""; -# $plu = "s" if $port > 1; -# $type = substr($junk, 30, 21); -# $type =~ s/^\s+//; -# $type =~ s/\s+$//; -# $board = substr($junk, 52, 9); -# $board =~ s/ //; -# $serial = substr($junk, 62,9) + 0; -# ProcessHistory("SLOT","","","!Slot $slot/$board: $type, $port port$plu, serial $serial\n"); - ProcessHistory("SLOT","","","! $_"); + # stuff module type into %module + if (/^Mod\s+Slot\s+Ports/) { + <INPUT>; + while (<INPUT>) { + tr/\015//d; + last if (/^\s*$/); + last OUTER if (/^$prompt/); + if (/^Module .*mismatch/) { + ProcessHistory("MODWARN","","","!\n! WARNING: $_"); + while (<INPUT>) { + tr/\015//d; + last OUTER if (/^\s*$/); + last if (/^\d/); + ProcessHistory("MODWARN","","","! $_"); + } + } + if (/^(\d+)\s+\d+\s+\d+\s+(.*)\s+\S+\s+\S+\s*$/) { + $modules{$1}->{type} = $2; + $modules{$1}->{type} =~ s/\s{2,}.*$//; + } + } + next; + } + # one does it one way... pita + if (/^Mod\s+Module-Name\s+Ports/) { + <INPUT>; + #my($slot); + while (<INPUT>) { + tr/\015//d; + last if (/^\s*$/); + last OUTER if (/^$prompt/); + if (/^(\d+)\s+(\S+\s+)?\d+\s+(.*)\s+\S+\s+(\S+)\s+\S+\s*$/) { + $modules{$1}->{serial} = $4; + $modules{$1}->{type} = $3; + #$modules{$1}->{type} =~ s/\s{2,}.*$//; + $modules{$1}->{type} =~ s/\s*$//; + } + } + next; + } + # daughter boards + if (/^Mod\s+Sub-Type/) { + <INPUT>; + my($slot, $board); + while (<INPUT>) { + tr/\015//d; + last if (/^\s*$/); + last OUTER if (/^$prompt/); + if (/^(\d+)\s+(\S+.*\s+)?(\S+)\s+(\S+)\s+(\S+)\s*$/) { + $board = 0 if ($slot != $1); + $slot = $1; + $modules{$1}->{daughter}->{$board}->{model} = $3; + $modules{$1}->{daughter}->{$board}->{serial} = $4; + $modules{$1}->{daughter}->{$board}->{Hw} = $5; + $modules{$1}->{daughter}->{$board}->{type} = $2; + $modules{$1}->{daughter}->{$board}->{type} =~ s/\s*$//; + $board++; + } + } + next; + } + } + + # dump the module info + foreach $slot (sort numerically keys(%modules)) { + my($dboards); + ProcessHistory("MODS","","","!\n"); + ProcessHistory("MODS","","",sprintf("!Slot $slot: type %s, %d ports\n", $modules{$slot}->{type}, $modules{$slot}->{ports})); + delete($modules{$slot}->{ports}); + delete($modules{$slot}->{type}); + my($model) = sprintf("!Slot $slot: part %s, serial %s\n", $modules{$slot}->{model}, $modules{$slot}->{serial}); + delete($modules{$slot}->{model}); + delete($modules{$slot}->{serial}); + # deal with daughter boards before slot versions + if (defined($modules{$slot}->{daughter})) { + my($board); + foreach $board (sort numerically keys(%{$modules{$slot}->{daughter}})) { + $dboards .= sprintf("!Slot $slot/$board: type %s\n", $modules{$slot}->{daughter}->{$board}->{type}); + $dboards .= sprintf("!Slot $slot/$board: hvers %s\n", $modules{$slot}->{daughter}->{$board}->{Hw}); + $dboards .= sprintf("!Slot $slot/$board: part %s, serial %s\n", $modules{$slot}->{daughter}->{$board}->{model}, $modules{$slot}->{daughter}->{$board}->{serial}); + } + delete($modules{$slot}->{daughter}); + } + my($ver); my($i) = 0; + ProcessHistory("MODS","","","!Slot $slot:"); + foreach $ver (sort keys(%{$modules{$slot}})) { + if ($i) {ProcessHistory("MODS","","",",");} + ProcessHistory("MODS","","",sprintf(" %s: %s", $ver, $modules{$slot}->{$ver})); + $i++; + } + ProcessHistory("MODS","","","\n"); + ProcessHistory("MODS","","",$model); + if ($dboards) {ProcessHistory("MODS","","",$dboards);} } - # The "write term" code gives us one of these, so skip it here - # ProcessHistory("SLOT","","","!\n"); } # This routine parses "show c7200" for the 7200 @@ -749,12 +802,15 @@ sub ShowC7200 { sub WriteTerm { print STDERR " In WriteTerm: $_" if ($debug); + ProcessHistory("","","","!\n"); while (<INPUT>) { tr/\015//d; last if (/^$prompt/); -#heas next if (/^\.+$/); + next if (/^\.+$/ | /^$/); /Non-Volatile memory is in use/ && return(-1); # NvRAM is locked # skip the crap + next if (/^This command shows non-default configurations only./i); + next if (/^Use 'write terminal all' to show both default and non/i); if (/^(\.\.+$|##+$|Building configuration...)/i) { while (<INPUT>) { tr/\015//d; @@ -764,6 +820,9 @@ sub WriteTerm { last; } ProcessHistory("","","","!\n"); + if (defined($config_register)) { + ProcessHistory("","","","config-register $config_register\n"); + } tr/\015//d; } # some versions have other crap mixed in with the bits in the @@ -857,7 +916,7 @@ sub WriteTerm { # snmp-server host a.b.c.d <community> if (/^set snmp trap (\d+\.\d+\.\d+\.\d+) /) { if (defined($ENV{'NOCOMMSTR'})) { - ProcessHistory("SNMPSERVERHOST","ipsort","$1","# set snmp trap $1 <removed>\n"); + ProcessHistory("SNMPSERVERHOST","ipsort","$1","!set snmp trap $1 <removed>\n"); } else { ProcessHistory("SNMPSERVERHOST","ipsort","$1","$_"); } @@ -865,7 +924,7 @@ sub WriteTerm { } if (/^(set snmp community) (\S+) (\S+)/) { if (defined($ENV{'NOCOMMSTR'})) { - ProcessHistory("SNMPSERVERCOMM","keysort","$_","#$1 $2 <removed>\n"); + ProcessHistory("SNMPSERVERCOMM","keysort","$_","!$1 $2 <removed>\n"); } else { ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_") } @@ -873,7 +932,7 @@ sub WriteTerm { } # order tacacs server statements /^set (tacacs) key / && - ProcessHistory("","","","! set $1 key <removed>\n") && next; + ProcessHistory("","","","!set $1 key <removed>\n") && next; /^set tacacs server (\d+\.\d+\.\d+\.\d+)/ && ProcessHistory("TAC","ipsort","$1","$_") && next; # order clns host statements @@ -918,46 +977,24 @@ sub DoNothing {print STDOUT;} # Main %commands=( 'show version' => "ShowVersion", -# 'show install active' => "ShowInstallActive", -# 'show env all' => "ShowEnv", -# 'show gsr chassis' => "ShowGSR", 'show boot' => "ShowBoot", -# 'show bootvar' => "ShowBoot", 'show flash' => "ShowFlash", 'dir bootflash:' => "DirSlotN", 'dir slot0:' => "DirSlotN", -# 'dir /all disk0:' => "DirSlotN", 'dir slot1:' => "DirSlotN", -# 'dir /all disk1:' => "DirSlotN", -# 'show controllers' => "ShowContAll", -# 'show controllers cbus' => "ShowContCbus", -# 'show diagbus' => "ShowDiagbus", -# 'show diag' => "ShowDiag", 'show module' => "ShowModule", -# 'show c7200' => "ShowC7200", 'write term' => "WriteTerm" ); # keys() doesnt return things in the order entered and the order of the # cmds is important (show version first and write term last). pita @commands=( "show version", -# "show install active", -# "show env all", -# "show gsr chassis", "show boot", -# "show bootvar", "show flash", "dir bootflash:", "dir slot0:", -# "dir /all disk0:", "dir slot1:", -# "dir /all disk1:", -# "show controllers", -# "show controllers cbus", -# "show diagbus", -# "show diag", "show module", -# "show c7200", "write term" ); $cisco_cmds=join(";",@commands); @@ -1001,7 +1038,6 @@ TOP: while(<INPUT>) { } while (/> \(enable\)\s*($cmds_regexp)\s*$/) { $cmd = $1; -# if (!defined($prompt)) {$prompt = ($_ =~ /^([^>]+> .enable.)/)[0]; } if (!defined($prompt)) {$prompt = ($_ =~ /^([^>]+>)/)[0]; } print STDERR ("HIT COMMAND:$_") if ($debug); if (! defined($commands{$cmd})) { diff --git a/bin/clogin b/bin/clogin.in index 1b345be..bfe3ae1 100755 --- a/bin/clogin +++ b/bin/clogin.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/expect -- +#!@EXPECT_PATH@ -- ## ## ## Copyright (C) 1997 by Henry Kilmer, Erik Sherk and Pete Whiting. @@ -252,39 +252,56 @@ proc source_password_file { } { } # Log into the router. -proc login { router user userpswd passwd enapasswd prompt cyphertype } { +proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } { global spawn_id in_proc do_command do_script global u_prompt p_prompt e_prompt set in_proc 1 - set tryssh 1 - # Telnet to the router & try to login. - if [ catch {spawn telnet $router} reason ] { - send_user "Error: failed to telnet: $reason\n" - exit 1 - } - sleep 0.3 - - # This helps cleanup each expect clause. - expect_after { - timeout { - send_user "\nError: TIMEOUT reached\n" - catch {close}; wait - if { $in_proc} { - return 1 - } else { - continue + # try each of the connection methods in $cmethod until one is successful + set progs [llength $cmethod] + foreach prog [lrange $cmethod 0 end] { + if ![string compare $prog "telnet"] { + if [ catch {spawn telnet $router} reason ] { + send_user "Error: telnet failed: $reason\n" + exit 1 } - } eof { - send_user "\nError: EOF received\n" - catch {close}; wait - if { $in_proc} { - return 1 - } else { - continue + } elseif ![string compare $prog "ssh"] { + if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] { + send_user "Error: ssh failed: $reason\n" + exit 1 + } + } elseif ![string compare $prog "rsh"] { + if [ catch {spawn rsh -l $user $router} reason ] { + send_user "Error: rsh failed: $reason\n" + exit 1 + } + } else { + puts "ERROR: unknown connection method: $prog" + return 1 + } + incr progs -1 + sleep 0.3 + + # This helps cleanup each expect clause. + expect_after { + timeout { + send_user "\nError: TIMEOUT reached\n" + catch {close}; wait + if { $in_proc} { + return 1 + } else { + continue + } + } eof { + send_user "\nError: EOF received\n" + catch {close}; wait + if { $in_proc} { + return 1 + } else { + continue + } } } - } # Here we get a little tricky. There are several possibilities: # the router can ask for a username and passwd and then @@ -294,29 +311,20 @@ proc login { router user userpswd passwd enapasswd prompt cyphertype } { # then it will just send the passwd. # if telnet fails with connection refused, try ssh expect { - "Connection refused" { - close; wait - if { $tryssh } { - if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] { - send_user "Error: failed to ssh: $reason\n" - exit 1 - } - set tryssh 0 - sleep 0.3 - exp_continue - } else { - expect eof - send_user "Error: Connection Refused\n"; wait; return 1 + -re "(Connection refused|Secure connection \[^\n\r]+ refused|Connection closed by)" { + catch {close}; wait + if !$progs { + send_user "\nError: Connection Refused ($prog)\n"; return 1 } } eof { send_user "Error: Couldn't login\n"; wait; return 1 - } "Unknown host\r\n" { - expect eof + } -nocase "unknown host\r" { + catch {close}; send_user "Error: Unknown host\n"; wait; return 1 } "Host is unreachable" { - expect eof + catch {close}; send_user "Error: Host Unreachable!\n"; wait; return 1 } "No address associated with name" { - expect eof + catch {close}; send_user "Error: Unknown host\n"; wait; return 1 } -re "Host key not found .* \(yes\/no\)\?" { @@ -330,12 +338,18 @@ proc login { router user userpswd passwd enapasswd prompt cyphertype } { -re "$u_prompt" { send "$user\r" expect { eof { send_user "Error: Couldn't login\n"; wait; return 1 } + "Login invalid" { send_user "Error: Invalid login\n"; vatch {close}; wait; return 1 } -re "$p_prompt" { send "$userpswd\r" } "$prompt" { set in_proc 0; return 0 } } exp_continue } - -re "$p_prompt" { send "$passwd\r" + -re "$p_prompt" { + if ![string compare $prog "ssh"] { + send "$userpswd\r" + } else { + send "$passwd\r" + } expect { eof { send_user "Error: Couldn't login\n"; wait; return 1 } -re "$e_prompt" { send "$enapasswd\r" } @@ -343,7 +357,7 @@ proc login { router user userpswd passwd enapasswd prompt cyphertype } { } exp_continue } - "$prompt" { } + "$prompt" { break; } denied { send_user "Error: Check your passwd for $router\n" if { $do_command || $do_script } { send "exit\r" @@ -355,6 +369,7 @@ proc login { router user userpswd passwd enapasswd prompt cyphertype } { } "% Bad passwords" {send_user "Error: Check your passwd for $router\n"; return 1 } } +} set in_proc 0 return 0 } @@ -404,19 +419,27 @@ proc run_commands { prompt command } { set commands [split $command \;] set num_commands [llength $commands] + # the pager can not be turned off on the PIX, so we have to look + # for the "More" prompt for {set i 0} {$i < $num_commands} { incr i} { send "[subst -nocommands [lindex $commands $i]]\r" expect { - -re "^\[^\n\r]*$reprompt." { exp_continue } -re "^\[^\n\r *]*$reprompt" {} + -re "^\[^\n\r]*$reprompt." { exp_continue } + -re "^<--- More --->" { send " " + exp_continue } -re "\[\n\r]" { exp_continue } } } } else { + # the pager can not be turned off on the PIX, so we have to look + # for the "More" prompt send "[subst -nocommands $command]\r" expect { - -re "^\[^\n\r]*$reprompt." { exp_continue } -re "^\[^\n\r *]*$reprompt" {} + -re "^\[^\n\r]*$reprompt." { exp_continue } + -re "^<--- More --->" { send " " + exp_continue } -re "\[\n\r]" { exp_continue } } } @@ -506,7 +529,7 @@ foreach router [lrange $argv $i end] { set u_prompt [find userprompt $router] if { "$u_prompt" == "" } { set u_prompt "(Username|login):" } set p_prompt [find passprompt $router] - if { "$p_prompt" == "" } { set p_prompt "\[Pp]assword:" } + if { "$p_prompt" == "" } { set p_prompt "(\[Pp]assword|passwd):" } set e_prompt [find enableprompt $router] if { "$e_prompt" == "" } { set e_prompt "\[Pp]assword:" } @@ -519,8 +542,12 @@ foreach router [lrange $argv $i end] { if { "$cyphertype" == "" } { set cyphertype "3des" } } + # Figure out connection method + set cmethod [find method $router] + if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} } + # Login to the router - if {[login $router $ruser $userpswd $passwd $enapasswd $prompt $cyphertype]} { + if {[login $router $ruser $userpswd $passwd $enapasswd $prompt $cmethod $cyphertype]} { continue } if { $enable } { diff --git a/bin/configure b/bin/configure new file mode 100755 index 0000000..b586b8d --- /dev/null +++ b/bin/configure @@ -0,0 +1,1239 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_default_prefix=/usr/local/rancid + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file= + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:560: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +RD_BIN_DATAS=$rd_cv_rd_bin_datas + +RD_BIN_PROGS=$rd_cv_rd_bin_progs + + +PERLV_PATH=$ac_cv_path_PERLV_PATH + +EXPECT_PATH=$ac_cv_path_EXPECT_PATH + + +# locate tools to build $PATH for env. order is significant. want to be +# sure that we pick up the the proper diff and ucbmail in bin/env. +unset ENV_PATH +# Extract the first word of "diff", so it can be a program name with args. +set dummy diff; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:629: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_DIFF'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$DIFF" in + /*) + ac_cv_path_DIFF="$DIFF" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_DIFF="$DIFF" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_DIFF="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_DIFF" && ac_cv_path_DIFF="no" + ;; +esac +fi +DIFF="$ac_cv_path_DIFF" +if test -n "$DIFF"; then + echo "$ac_t""$DIFF" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ENV_PATH=`dirname $ac_cv_path_DIFF` +# Extract the first word of "Mail", so it can be a program name with args. +set dummy Mail; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:666: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_UCBMAIL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$UCBMAIL" in + /*) + ac_cv_path_UCBMAIL="$UCBMAIL" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_UCBMAIL="$UCBMAIL" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_UCBMAIL="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_UCBMAIL" && ac_cv_path_UCBMAIL="no" + ;; +esac +fi +UCBMAIL="$ac_cv_path_UCBMAIL" +if test -n "$UCBMAIL"; then + echo "$ac_t""$UCBMAIL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_UCBMAIL`" +# Extract the first word of "cvs", so it can be a program name with args. +set dummy cvs; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:703: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_CVS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$CVS" in + /*) + ac_cv_path_CVS="$CVS" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_CVS="$CVS" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_CVS="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_CVS" && ac_cv_path_CVS="no" + ;; +esac +fi +CVS="$ac_cv_path_CVS" +if test -n "$CVS"; then + echo "$ac_t""$CVS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_CVS`" +# Extract the first word of "comm", so it can be a program name with args. +set dummy comm; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:740: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_COMM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$COMM" in + /*) + ac_cv_path_COMM="$COMM" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_COMM="$COMM" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_COMM="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_COMM" && ac_cv_path_COMM="no" + ;; +esac +fi +COMM="$ac_cv_path_COMM" +if test -n "$COMM"; then + echo "$ac_t""$COMM" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_COMM`" +# Extract the first word of "mkdir", so it can be a program name with args. +set dummy mkdir; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:777: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MKDIR" in + /*) + ac_cv_path_MKDIR="$MKDIR" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_MKDIR="$MKDIR" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_MKDIR="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MKDIR" && ac_cv_path_MKDIR="no" + ;; +esac +fi +MKDIR="$ac_cv_path_MKDIR" +if test -n "$MKDIR"; then + echo "$ac_t""$MKDIR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_MKDIR`" +# Extract the first word of "dirname", so it can be a program name with args. +set dummy dirname; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:814: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_DIRNAME'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$DIRNAME" in + /*) + ac_cv_path_DIRNAME="$DIRNAME" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_DIRNAME="$DIRNAME" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_DIRNAME="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_DIRNAME" && ac_cv_path_DIRNAME="no" + ;; +esac +fi +DIRNAME="$ac_cv_path_DIRNAME" +if test -n "$DIRNAME"; then + echo "$ac_t""$DIRNAME" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_DIRNAME`" +# Extract the first word of "touch", so it can be a program name with args. +set dummy touch; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:851: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_TOUCH'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$TOUCH" in + /*) + ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_TOUCH="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_TOUCH" && ac_cv_path_TOUCH="no" + ;; +esac +fi +TOUCH="$ac_cv_path_TOUCH" +if test -n "$TOUCH"; then + echo "$ac_t""$TOUCH" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_TOUCH`" +# Extract the first word of "sendmail", so it can be a program name with args. +set dummy sendmail; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:888: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_SENDMAIL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$SENDMAIL" in + /*) + ac_cv_path_SENDMAIL="$SENDMAIL" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_SENDMAIL="$SENDMAIL" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_SENDMAIL="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_SENDMAIL" && ac_cv_path_SENDMAIL="no" + ;; +esac +fi +SENDMAIL="$ac_cv_path_SENDMAIL" +if test -n "$SENDMAIL"; then + echo "$ac_t""$SENDMAIL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SENDMAIL`" +# Extract the first word of "sort", so it can be a program name with args. +set dummy sort; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:925: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_SORT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$SORT" in + /*) + ac_cv_path_SORT="$SORT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_SORT="$SORT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_SORT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_SORT" && ac_cv_path_SORT="no" + ;; +esac +fi +SORT="$ac_cv_path_SORT" +if test -n "$SORT"; then + echo "$ac_t""$SORT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SORT`" +ENV_PATH="$ENV_PATH:/usr/local/bin:/usr/bin" + +ENV_PATH=`echo $ENV_PATH | $PERLV_PATH -e 'foreach $x(split(":",<>)){next unless (length($x));push(@F, $x),$seen{$x}=1 unless (defined $seen{$x});}print join(":",@F);'` + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile env $RD_BIN_DATAS $RD_BIN_PROGS" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@RD_BIN_DATAS@%$RD_BIN_DATAS%g +s%@RD_BIN_PROGS@%$RD_BIN_PROGS%g +s%@PERLV_PATH@%$PERLV_PATH%g +s%@EXPECT_PATH@%$EXPECT_PATH%g +s%@DIFF@%$DIFF%g +s%@UCBMAIL@%$UCBMAIL%g +s%@CVS@%$CVS%g +s%@COMM@%$COMM%g +s%@MKDIR@%$MKDIR%g +s%@DIRNAME@%$DIRNAME%g +s%@TOUCH@%$TOUCH%g +s%@SENDMAIL@%$SENDMAIL%g +s%@SORT@%$SORT%g +s%@ENV_PATH@%$ENV_PATH%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile env $RD_BIN_DATAS $RD_BIN_PROGS"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + +# fix permissions on scripts. +for file in $RD_BIN_PROGS; do chmod a+x $file; done diff --git a/bin/configure.in b/bin/configure.in new file mode 100644 index 0000000..cdade86 --- /dev/null +++ b/bin/configure.in @@ -0,0 +1,49 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT() + +dnl default install location +AC_PREFIX_DEFAULT(/usr/local/rancid) + +dnl install program(s) +AC_PROG_INSTALL + +RD_BIN_DATAS=$rd_cv_rd_bin_datas +AC_SUBST(RD_BIN_DATAS) +RD_BIN_PROGS=$rd_cv_rd_bin_progs +AC_SUBST(RD_BIN_PROGS) + +PERLV_PATH=$ac_cv_path_PERLV_PATH +AC_SUBST(PERLV_PATH) +EXPECT_PATH=$ac_cv_path_EXPECT_PATH +AC_SUBST(EXPECT_PATH) + +# locate tools to build $PATH for env. order is significant. want to be +# sure that we pick up the the proper diff and ucbmail in bin/env. +unset ENV_PATH +AC_PATH_PROG(DIFF,diff,no) +ENV_PATH=`dirname $ac_cv_path_DIFF` +AC_PATH_PROG(UCBMAIL,Mail,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_UCBMAIL`" +AC_PATH_PROG(CVS,cvs,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_CVS`" +AC_PATH_PROG(COMM,comm,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_COMM`" +AC_PATH_PROG(MKDIR,mkdir,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_MKDIR`" +AC_PATH_PROG(DIRNAME,dirname,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_DIRNAME`" +AC_PATH_PROG(TOUCH,touch,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_TOUCH`" +AC_PATH_PROG(SENDMAIL,sendmail,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SENDMAIL`" +AC_PATH_PROG(SORT,sort,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SORT`" +ENV_PATH="$ENV_PATH:/usr/local/bin:/usr/bin" + +ENV_PATH=`echo $ENV_PATH | $PERLV_PATH -e 'foreach $x(split(":",<>)){next unless (length($x));push(@F, $x),$seen{$x}=1 unless (defined $seen{$x});}print join(":",@F);'` +AC_SUBST(ENV_PATH) + +AC_OUTPUT(Makefile env $RD_BIN_DATAS $RD_BIN_PROGS) + +# fix permissions on scripts. +for file in $RD_BIN_PROGS; do chmod a+x $file; done diff --git a/bin/control_rancid b/bin/control_rancid.in index 2c367d6..2acecc7 100755 --- a/bin/control_rancid +++ b/bin/control_rancid.in @@ -55,10 +55,10 @@ cd $DIR grep -v '^#' router.db > routers.db cut -d: -f1,2 routers.db | sort -u > routers.all.new diff routers.all routers.all.new > /dev/null 2>&1; RALL=$? -perl -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print "$F[0]:$F[1]\n") +@PERLV_PATH@ -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print "$F[0]:$F[1]\n") if ($F[2] =~ /^down$/i);}' routers.db | sort -u > routers.down.new diff routers.down routers.down.new > /dev/null 2>&1; RDOWN=$? -perl -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print "$F[0]:$F[1]\n") +@PERLV_PATH@ -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print "$F[0]:$F[1]\n") if ($F[2] =~ /^up$/i);}' routers.db | sort -u > routers.up.new diff routers.up routers.up.new > /dev/null 2>&1; RUP=$? @@ -68,22 +68,22 @@ then if [ $RUP -ne 0 ] ; then if [ $RUP -eq 1 ] ; then echo Routers changed to up: - comm -13 routers.up routers.up.new | sed -e 's/^/ /' -e 's/:.*$//' + comm -13 routers.up routers.up.new | sed -e 's/^/ /' echo elif [ -s routers.up.new ] ; then echo Routers changed to up: - sed -e 's/^/ /' -e 's/:.*$//' routers.up.new + sed -e 's/^/ /' routers.up.new echo fi fi if [ $RDOWN -ne 0 ] ; then if [ $RDOWN -eq 1 ] ; then echo Routers changed to down: - comm -13 routers.down routers.down.new | sed -e 's/^/ /' -e 's/:.*$//' + comm -13 routers.down routers.down.new | sed -e 's/^/ /' echo elif [ -s routers.down.new ] ; then echo Routers changed to down: - sed -e 's/^/ /' -e 's/:.*$//' routers.down.new + sed -e 's/^/ /' routers.down.new echo fi fi @@ -91,7 +91,7 @@ then WCNEW=`wc -l routers.all.new | sed -e 's/^ *\([^ ]*\) .*$/\1/'` if [ $RALL -eq 1 -a $WC -gt $WCNEW ] ; then echo Deleted routers: - comm -23 routers.all routers.all.new | sed -e 's/^/ /' -e 's/:.*$//' + comm -23 routers.all routers.all.new | sed -e 's/^/ /' fi ) > routers.mail @@ -241,7 +241,7 @@ rm -f $DIR/routers.failed if [ "X$OLDTIME" = "X" ] ; then OLDTIME=24 fi -perl -F: -ane "{\$t = (stat(\$F[0]))[9]; print \`ls -ld \$F[0]\` +@PERLV_PATH@ -F: -ane "{\$t = (stat(\$F[0]))[9]; print \`ls -ld \$F[0]\` if (time() - \$t >= $OLDTIME*60*60);}" $DIR/routers.up | sort -u > $DIR/routers.failed if [ -s $DIR/routers.failed ] then diff --git a/bin/create_cvs b/bin/create_cvs.in index df7e56e..df7e56e 100755 --- a/bin/create_cvs +++ b/bin/create_cvs.in diff --git a/bin/do-diffs b/bin/do-diffs.in index fa4acd2..4a310ef 100755 --- a/bin/do-diffs +++ b/bin/do-diffs.in @@ -36,7 +36,7 @@ do if [ "X$LOCKTIME" = "X" ] ; then LOCKTIME=4 fi - perl -e "\$t = (stat(\"$LOCKFILE\"))[9]; print \"OLD\\n\" if (time() - \$t >= $LOCKTIME*60*60);" > $TMPDIR/.$GROUP.old + @PERLV_PATH@ -e "\$t = (stat(\"$LOCKFILE\"))[9]; print \"OLD\\n\" if (time() - \$t >= $LOCKTIME*60*60);" > $TMPDIR/.$GROUP.old if [ -s $TMPDIR/.$GROUP.old ] then ( diff --git a/bin/elogin b/bin/elogin.in index ebf126e..e75efed 100755 --- a/bin/elogin +++ b/bin/elogin.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/expect -- +#!@EXPECT_PATH@ -- ## ## ## Copyright (C) 1997 by Henry Kilmer, Erik Sherk and Pete Whiting. @@ -13,8 +13,9 @@ TERM=network;export TERM # don't take kindly to sym-links. # TMPDIR=/tmp; export TMPDIR -BASEDIR=$HOME/rancid; export BASEDIR -PATH=$BASEDIR/bin:/usr/local/bin:/usr/ucb:/usr/bin:/bin:/usr/lib:/usr/sbin;export PATH +BASEDIR=@prefix@; export BASEDIR +PATH=$BASEDIR/bin:@ENV_PATH@; export PATH +#PATH=$BASEDIR/bin:/usr/local/bin:/usr/ucb:/usr/bin:/bin:/usr/lib:/usr/sbin;export PATH CVSROOT=$BASEDIR/CVS; export CVSROOT # # if NOPIPE is set, temp files will be used instead of a cmd pipe during diff --git a/bin/erancid b/bin/erancid.in index 2adba78..185a634 100755 --- a/bin/erancid +++ b/bin/erancid.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!@PERLV_PATH@ ## ## Hacked version of rancid for ADC EZT3 series muxes. Only tested ## with switch software 1.50 so far - terry@tmk.com diff --git a/bin/flogin b/bin/flogin.in index 652e38a..0419bb6 100755 --- a/bin/flogin +++ b/bin/flogin.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/expect -- +#!@EXPECT_PATH@ -- ## ## ## Copyright (C) 1997 by Henry Kilmer, Erik Sherk and Pete Whiting. diff --git a/bin/francid b/bin/francid.in index 54aae8d..6f0c2b7 100755 --- a/bin/francid +++ b/bin/francid.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!@PERLV_PATH@ ## ## Amazingly hacked version of Hank's rancid - this one tries to ## deal with foundrys. diff --git a/bin/jlogin b/bin/jlogin.in index a21188c..0718321 100755 --- a/bin/jlogin +++ b/bin/jlogin.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/expect -- +#!@EXPECT_PATH@ -- ## ## ## Copyright (C) 1997 by Henry Kilmer, Erik Sherk and Pete Whiting. @@ -225,96 +225,119 @@ proc source_password_file { } { } # Log into the router. -proc login { router user passwd prompt cyphertype identfile} { +proc login { router user passwd prompt cmethod cyphertype identfile} { global spawn_id in_proc do_command do_script passphrase set in_proc 1 - # ssh to the router & try to login with or without an identfile. - # We use two calls to spawn since spawn does not seem to parse - # spaces correctly. - if {$identfile != ""} { - if [ catch {spawn ssh -c $cyphertype -x -l $user -i $identfile $router} reason ] { - send_user "Error: failed to ssh: $reason\n" - exit 1 + # try each of the connection methods in $cmethod until one is successful + set progs [llength $cmethod] + foreach prog [lrange $cmethod 0 end] { + if ![string compare $prog "telnet"] { + if [ catch {spawn telnet $router} reason ] { + send_user "Error: telnet failed: $reason\n" + exit 1 + } + } elseif ![string compare $prog "ssh"] { + # ssh to the router & try to login with or without an identfile. + # We use two calls to spawn since spawn does not seem to parse + # spaces correctly. + if {$identfile != ""} { + if [ catch {spawn ssh -c $cyphertype -x -l $user -i $identfile $router} reason ] { + send_user "Error: failed to ssh: $reason\n" + exit 1 + } + } else { + if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] { + send_user "Error: failed to ssh: $reason\n" + exit 1 + } + } + } elseif ![string compare $prog "rsh"] { + if [ catch {spawn rsh -l $user $router} reason ] { + send_user "Error: rsh failed: $reason\n" + exit 1 + } + } else { + puts "ERROR: unknown connection method: $prog" + return 1 } - } else { - if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] { - send_user "Error: failed to ssh: $reason\n" - exit 1 + incr progs -1 + sleep 0.3 + + # This helps cleanup each expect clause. + expect_after { + timeout { + send_user "\nError: TIMEOUT reached\n" + catch {close}; wait + if { $in_proc} { + return 1 + } else { + continue + } + } eof { + send_user "\nError: EOF received\n" + catch {close}; wait + if { $in_proc} { + return 1 + } else { + continue + } + } } - } - sleep 0.3 - # This helps cleanup each expect clause. - expect_after { - timeout { - send_user "\nError: TIMEOUT reached\n" - catch {close}; wait - if { $in_proc} { - return 1 - } else { - continue + # Here we get a little tricky. There are several possibilities: + # the router can ask for a username and passwd and then + # talk to the TACACS server to authenticate you, or if the + # TACACS server is not working, then it will use the enable + # passwd. Or, the router might not have TACACS turned on, + # then it will just send the passwd. + expect { + -re "(Connection refused|Secure connection \[^\n\r]+ refused|Connectionclosed by)" { + catch {close}; wait + if !$progs { + send_user "\nError: Connection Refused ($prog)\n"; return 1 + } } - } eof { - send_user "\nError: EOF received\n" - catch {close}; wait - if { $in_proc} { - return 1 - } else { - continue + eof { send_user "Error: Couldn't login\n"; wait; return 1 + } -nocase "unknown host\r\n" { + catch {close}; + send_user "Error: Unknown host\n"; wait; return 1 + } "Host is unreachable" { + catch {close}; + send_user "Error: Host Unreachable!\n"; wait; return 1 + } "No address associated with name" { + catch {close}; + send_user "Error: Unknown host\n"; wait; return 1 } - } - } - - # Here we get a little tricky. There are several possibilities: - # the router can ask for a username and passwd and then - # talk to the TACACS server to authenticate you, or if the - # TACACS server is not working, then it will use the enable - # passwd. Or, the router might not have TACACS turned on, - # then it will just send the passwd. - expect { - eof { send_user "Error: Couldn't login\n"; wait; return 1 } - "Connection refused" { - expect eof - send_user "Error: Connection Refused\n"; wait; return 1 - } "Unknown host\r\n" { - expect eof - send_user "Error: Unknown host\n"; wait; return 1 - } "Host is unreachable" { - expect eof - send_user "Error: Host Unreachable!\n"; wait; return 1 - } "No address associated with name" { - expect eof - send_user "Error: Unknown host\n"; wait; return 1 - } - -re "Enter passphrase for RSA key '\[^'\]*': " { - send_user "\nKey has passphrase!\n" - send "$passphrase\r" - exp_continue } - -re "Host key not found .* \(yes\/no\)\?" { - send "yes\r" - send_user "Host $router added to the list of known hosts.\n" - exp_continue } - -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" { - send "no\r" - send_user "Error: The host key for $router has changed. update the known_hosts file accordingly.\n" - return 1 } - -re "(Username|^login):" { send "$user\r" - expect { - eof { send_user "Error: Couldn't login\n"; wait; return 1 } - -re "\[Pp]assword:" { send "$passwd\r" } - "$prompt" { set in_proc 0; return 0 } + -re "Enter passphrase for RSA key '\[^'\]*': " { + send_user "\nKey has passphrase!\n" + send "$passphrase\r" + exp_continue } + -re "Host key not found .* \(yes\/no\)\?" { + send "yes\r" + send_user "Host $router added to the list of known hosts.\n" + exp_continue } + -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" { + send "no\r" + send_user "Error: The host key for $router has changed. update the known_hosts file accordingly.\n" + return 1 } + -re "(Username|\[\r\n]login):" { send "$user\r" + expect { + eof { send_user "Error: Couldn't login\n"; + wait; return 1 } + -re "\[Pp]assword:" { send "$passwd\r" } + "$prompt" { set in_proc 0; return 0 } + } + exp_continue } - exp_continue - } - "\[Pp]assword:" { send "$passwd\r" - expect { + "\[Pp]assword:" { send "$passwd\r" + expect { eof { send_user "Error: Couldn't login\n"; wait; return 1 } "$prompt" { set in_proc 0; return 0 } } exp_continue } - "$prompt" { } + "$prompt" { break; } denied { send_user "Error: Check your passwd for $router\n" if { $do_command || $do_script } { send "quit" @@ -326,6 +349,7 @@ proc login { router user passwd prompt cyphertype identfile} { } "% Bad passwords" {send_user "Error: Check your passwd for $router\n"; return 1 } } + } set in_proc 0 return 0 } @@ -380,20 +404,6 @@ foreach router [lrange $argv $i end] { set prompt ">" - # Figure out passwords -# if { $do_passwd } { -# set pswd [find password $router] -# if { [llength $pswd] == 0 } { -# send_user "Error - no password for $router in $password_file.\n" -# continue -# } -# if { $do_enapasswd && !$autoenable && [llength $pswd] < 2 } { -# send_user "Error - no enable password for $router in $password_file." -# continue -# } -# set passwd [lindex $pswd 0] -# } - # Figure out username if {[info exists username]} { # command line username @@ -427,8 +437,12 @@ foreach router [lrange $argv $i end] { if { "$cyphertype" == "" } { set cyphertype "3des" } } + # Figure out connection method + set cmethod [find method $router] + if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} } + # Login to the router - if {[login $router $loginname $passwd $prompt $cyphertype $identfile]} { + if {[login $router $loginname $passwd $prompt $cmethod $cyphertype $identfile]} { continue } diff --git a/bin/jrancid b/bin/jrancid.in index ea158bf..633d844 100755 --- a/bin/jrancid +++ b/bin/jrancid.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!@PERLV_PATH@ ## ## Amazingly hacked version of Hank's rancid - this one tries to ## deal with Junipers. @@ -30,6 +30,7 @@ $file = $opt_f; $host = $ARGV[0]; $clean_run = 0; +$found_end = 0; # This routine is used to print out the router configuration sub ProcessHistory { @@ -278,8 +279,8 @@ sub ShowChassisRoutingEngine { return; } -# This routine parses "show chassis scb", "show chassis ssb", and -# "show chassis feb". +# This routine parses "show chassis feb" "show chassis scb", "show +# chassis sfm detail", and "show chassis ssb". # Only do this routine once. sub ShowChassisSCB { print STDERR " In ShowChassisSCB: $_" if ($debug); @@ -355,8 +356,13 @@ sub ShowConfiguration { ProcessHistory("","","","# $_"); while (<INPUT>) { tr/\015//d; - last if(/^$prompt/); next if (/^\s*$/); + # end of config - hopefully. juniper does not have a reliable + # end-of-config tag. appears to end with "\nPROMPT>", but not sure. + if(/^$prompt/) { + $found_end++; + last; + } /^database header mismatch: / && return(-1); /^version .*;\d+$/ && return(-1); @@ -389,6 +395,7 @@ sub DoNothing {print STDOUT;} "show chassis hardware" => "ShowChassisHardware", "show chassis routing-engine" => "ShowChassisRoutingEngine", "show chassis scb" => "ShowChassisSCB", + "show chassis sfm detail" => "ShowChassisSCB", "show chassis ssb" => "ShowChassisSCB", "show chassis feb" => "ShowChassisSCB", "show system boot-messages" => "ShowSystemBootMessages", @@ -403,6 +410,7 @@ sub DoNothing {print STDOUT;} "show chassis hardware", "show chassis routing-engine", "show chassis scb", + "show chassis sfm detail", "show chassis ssb", "show chassis feb", "show system boot-messages", @@ -484,12 +492,12 @@ if (defined($ENV{NOPIPE})) { # check for completeness $commands = join(", ", keys(%commands)); -if (scalar(%commands) || !$clean_run) { +if (scalar(%commands) || !$clean_run || !$found_end) { if (scalar(%commands)) { printf(STDOUT "missed cmd(s): %s\n", join(',', keys(%commands))); printf(STDERR "missed cmd(s): %s\n", join(',', keys(%commands))) if ($debug); } - if (!$clean_run) { + if (!$clean_run || !$found_end) { print STDOUT "End of run not found\n"; print STDERR "End of run not found\n" if ($debug); system("/usr/bin/tail -1 $host.new"); @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!@PERLV_PATH@ ## ## ## Copyright (C) 1997 by Henry Kilmer and Peter Whiting. diff --git a/bin/rancid-fe b/bin/rancid-fe.in index e3fa735..8e5d333 100755 --- a/bin/rancid-fe +++ b/bin/rancid-fe.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!@PERLV_PATH@ ## ## ## Copyright (C) 1997 by Henry Kilmer. diff --git a/bin/rancid b/bin/rancid.in index 4bdde6c..d7b5fbf 100755 --- a/bin/rancid +++ b/bin/rancid.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!@PERLV_PATH@ ## ## ## Copyright (C) 1997 by Henry Kilmer. @@ -142,6 +142,8 @@ sub ShowVersion { $slave = " Slave:"; next; } + /^Cisco Secure PIX /i && + ProcessHistory("COMMENTS","keysort","F1", "!Image: $_") && next; /^IOS .* Software \(([A-Za-z-0-9]*)\), .*Version\s+(.*)$/ && ProcessHistory("COMMENTS","keysort","F1", "!Image:$slave Software: $1, $2\n") && next; @@ -154,6 +156,17 @@ sub ShowVersion { /^ROM: (System )?Bootstrap.*(Version.*)$/ && ProcessHistory("COMMENTS","keysort","G1", "!ROM Bootstrap: $2\n") && next; + if (/^Hardware:\s+(.*), (.* RAM), CPU (.*)$/) { + ProcessHistory("COMMENTS","keysort","A1", + "!Chassis type: $1 - a PIX\n"); + ProcessHistory("COMMENTS","keysort","A2", + "!CPU: $3\n"); + ProcessHistory("COMMENTS","keysort","B1", "!Memory: $2\n"); + } + /^Serial Number:\s+(.*)$/ && + ProcessHistory("COMMENTS","keysort","C1", "!$_") && next; + /^Activation Key:\s+(.*)$/ && + ProcessHistory("COMMENTS","keysort","C2", "!$_") && next; /^ROM: \d+ Bootstrap .*(Version.*)$/ && ProcessHistory("COMMENTS","keysort","G2", "!ROM Image: Bootstrap $1\n!\n") && next; @@ -173,7 +186,7 @@ sub ShowVersion { my($proc) = $1; my($cpu) = $2; my($mem) = $3; - my($deivce) = "router"; + my($device) = "router"; if ( $1 eq "CSC") { $type = "AGS"; } elsif ( $1 eq "CSC4") { @@ -264,7 +277,7 @@ sub ShowInstallActive { last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); return(1) if /^\s*\^\s*$/; - return(1) if /Invalid input detected/; + return(1) if /(Invalid input detected|Type help or )/; ProcessHistory("COMMENTS","keysort","F5","!Image: $_") && next; } return(0); @@ -339,7 +352,7 @@ sub ShowGSR { # This routine parses "show boot" sub ShowBoot { - # Pick up boot variables if 7000/7200/7500/12000; + # Pick up boot variables if 7000/7200/7500/12000/2900; # otherwise pick up bootflash. print STDERR " In ShowBoot: $_" if ($debug); @@ -349,14 +362,18 @@ sub ShowBoot { next if (/^(\s*|\s*$cmd\s*)$/); return(1) if /^\s*\^\s*$/; return(1) if /Ambiguous command/i; - return(1) if /Invalid input detected/; + return(1) if /(Invalid input detected|Type help or )/; return(1) if /(Open device \S+ failed|Error opening \S+:)/; next if /CONFGEN variable/; if (!defined($H0)) { $H0=1; ProcessHistory("COMMENTS","keysort","H0","!\n"); } if ($type !~ /^(120|7)/) { - ProcessHistory("COMMENTS","keysort","H2","!BootFlash: $_"); + if ($type !~ /^2900/) { + ProcessHistory("COMMENTS","keysort","H2","!BootFlash: $_"); + } else { + ProcessHistory("COMMENTS","keysort","H1","!Variable: $_"); + } } elsif (/variable/) { ProcessHistory("COMMENTS","keysort","H1","!Variable: $_"); } @@ -376,7 +393,7 @@ sub ShowFlash { next if (/^(\s*|\s*$cmd\s*)$/); return(1) if ($type =~ /^(120|7)/); return(1) if /^\s*\^\s*$/; - return(1) if /Invalid input detected/; + return(1) if /(Invalid input detected|Type help or )/; ProcessHistory("FLASH","","","!Flash: $_"); } ProcessHistory("","","","!\n"); @@ -396,7 +413,7 @@ sub DirSlotN { next if (/^(\s*|\s*$cmd\s*)$/); return(1) if ($type !~ /^(120|7|36)/); return(1) if /^\s*\^\s*$/; - return(1) if /Invalid input detected/; + return(1) if /(Invalid input detected|Type help or )/; return(1) if /\%Error: No such file or directory/; return(1) if /No space information available/; return(-1) if /\%Error calling/; @@ -607,14 +624,20 @@ sub ShowDiag { /^$/ && next; if (!defined($showdiags)) {$showdiags=1; ProcessHistory("SLOT","","","!\n");} s/Port Packet Over SONET/POS/; - if (/^\s*SLOT (\d+)\s+\(.*\): (.*)/) { + if (/^\s*SLOT\s+(\d+)\s+\((.*)\): (.*)/) { $slot = $1; - ProcessHistory("SLOT","","","!Slot $slot: $2\n"); + ProcessHistory("SLOT","","","!Slot $slot: $3\n"); + # Here we look for boards that don't have DRAM. + $board = "Other"; $board = "RP" if (/Route Processor/); $board = "CLK" if (/Clock Scheduler Card/); + $board = "SFC" if (/Switch Fabric Card/); next; } - if (/^\s+PCA:\s+(.*)/){ + if (/^\s+MAIN:\s+ type \d+,\s+(.*)/) { + ProcessHistory("SLOT","","","!Slot $slot/MAIN: part $1\n") && next; + } + if (/^\s+PCA:\s+(.*)/) { local($part) = $1; $_ = <INPUT>; /^\s+HW version (\S+)\s+S\/N (\S+)/ && @@ -622,7 +645,6 @@ sub ShowDiag { ProcessHistory("SLOT","","","!Slot $slot/PCA: hvers $1\n"); next; } - if (/^\s+MBUS: .*\)\s+(.*)/) { local($tmp) = "!Slot $slot/MBUS: part $1"; $_ = <INPUT>; @@ -633,7 +655,7 @@ sub ShowDiag { } if (/^\s+MBUS Agent Software version (.*)/) { local($sw) = $1; - local($tail) = "!\n" if ($board =~ /(CLK|RP)/); + local($tail) = "!\n" if ($board ne "Other"); ProcessHistory("SLOT","","","!Slot $slot/MBUS: software $sw\n$tail"); next; } @@ -646,7 +668,7 @@ sub ShowDiag { next; } # 7200 and 3600 stuff - if (/^(Slot)\s+(\d+):/ || /^\s+(WIC|VIC) Slot (\d):/) { + if (/^(Slot)\s+(\d+(\/\d+)?):/ || /^\s+(WIC|VIC) Slot (\d):/) { if ($1 eq "WIC") { $WIC = "/$2"; } elsif ($1 eq "VIC") { @@ -679,12 +701,43 @@ sub ShowDiag { /number\s+(\S+)\s+Part number\s+(\S+)/ && ProcessHistory("SLOT","","","!Slot $slot$WIC: part $2, serial $1\n!\n") && next; + } + return(0); } + +# This routine parses "show module". +sub ShowModule { + print STDERR " In ShowModule: $_" if ($debug); + + my(@lines); + my($slot); + + while (<INPUT>) { + tr/\015//d; + return if (/^\s*\^$/); + last if (/^$prompt/); + next if (/^(\s*|\s*$cmd\s*)$/); + + # match slot info line, slot info then the rev info (the two are split) + if (/^ ?(\d+)\s+(\d+)\s+(.*)\s+(\S+)\s+(\S+)\s*$/) { + $lines[$1] .= "!Slot $1: type $3, $2 ports\n!Slot $1: part $4, serial $5\n"; + $lines[$1] =~ s/\s+,/,/g; + } + if (/^ ?(\d+)\s+\S+\s+to\s+\S+\s+(\S+)\s+(.*)\s+(\S+)\s*$/) { + $lines[$1] .= "!Slot $1: hvers $2, firmware $3, sw $4\n"; + $lines[$1] =~ s/\s+,/,/g; + } + } + foreach $slot (@lines) { + next if ($slot =~ /^\s*$/); + ProcessHistory("Module","","","$slot!\n"); + } + return(0); } # This routine parses "show c7200" for the 7200 -# This will create arrarys for hw info. +# This will create arrays for hw info. sub ShowC7200 { # Skip if this is not a 7200. print STDERR " In ShowC7200: $_" if ($debug); @@ -725,10 +778,14 @@ sub ShowVTP { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); + return(1) if /^\s*\^\s*$/; + return(1) if /(Invalid input detected|Type help or )/; return(1) if ($type !~ /^2900XL$/); + next if (/^Configuration last modified by/); ProcessHistory("COMMENTS","keysort","I0","!VTP: $_"); } ProcessHistory("COMMENTS","keysort","I0","!\n"); + return(0); } # This routine processes a "write term" @@ -738,16 +795,21 @@ sub WriteTerm { while (<INPUT>) { tr/\015//d; last if(/^$prompt/); + # the pager can not be disabled per-session on the PIX + s/^<-+ More -+>\s*//; /Non-Volatile memory is in use/ && return(-1); # NvRAM is locked # skip the crap if (/^(##+$|Building configuration...)/i) { while (<INPUT>) { - next if (/^Current configuration:/i); + next if (/^Current configuration\s*:/i); + next if (/^:/); next if (/^([%!].*|\s*)$/); next if (/^ip add.*ipv4:/); # band-aid for 3620 12.0S last; } - ProcessHistory("","","","!\nconfig-register $config_register\n"); + if (defined($config_register)) { + ProcessHistory("","","","!\nconfig-register $config_register\n"); + } tr/\015//d; } # some versions have other crap mixed in with the bits in the @@ -760,18 +822,18 @@ sub WriteTerm { /^ length / && next; # kill length on serial lines /^ width / && next; # kill width on serial lines /^ clockrate / && next; # kill clockrate on serial interfaces - /^enable password / && - ProcessHistory("ENABLE","","","! enable password <removed>\n") && + /^(enable )?(password|passwd) / && + ProcessHistory("ENABLE","","","!$1$2 <removed>\n") && next; /^username (\S+) password /&& - ProcessHistory("USER","keysort","$1","! username $1 password <removed>\n") && next; + ProcessHistory("USER","keysort","$1","!username $1 password <removed>\n") && next; /^\s*password / && ProcessHistory("LINE-PASS","","","! password <removed>\n") && next; /^\s*neighbor (\S*) password / && ProcessHistory("","","","! neighbor $1 password <removed>\n") && next; /^(ip ftp password) / && - ProcessHistory("","","","! $1 <removed>\n") && next; + ProcessHistory("","","","!$1 <removed>\n") && next; /^( ip ospf authentication-key) / && ProcessHistory("","","","!$1 <removed>\n") && next; /^( ip ospf message-digest-key \d+ md5) / && @@ -851,7 +913,7 @@ sub WriteTerm { } elsif ($token =~ /^(informs?|traps?|(no)?auth)$/) { $line .= " " . $token; } else { - $line = "! $line " . join(' ', ("<removed>", join(' ',@tokens))); + $line = "!$line " . join(' ', ("<removed>", join(' ',@tokens))); last; } } @@ -863,14 +925,14 @@ sub WriteTerm { } if (/^(snmp-server community) (\S+)/) { if (defined($ENV{'NOCOMMSTR'})) { - ProcessHistory("SNMPSERVERCOMM","keysort","$_","! $1 <removed>$'") && next; + ProcessHistory("SNMPSERVERCOMM","keysort","$_","!$1 <removed>$'") && next; } else { ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_") && next; } } # order/prune tacacs/radius server statements /^(tacacs-server|radius-server) key / && - ProcessHistory("","","","! $1 key <removed>\n") && next; + ProcessHistory("","","","!$1 key <removed>\n") && next; # order clns host statements /^clns host \S+ (\S+)/ && ProcessHistory("CLNS","keysort","$1","$_") && next; @@ -878,7 +940,7 @@ sub WriteTerm { /^alias / && ProcessHistory("ALIAS","keysort","$_","$_") && next; # delete ntp auth password /^(ntp authentication-key \d+ md5) / && - ProcessHistory("","","","! $1 <removed>\n") && next; + ProcessHistory("","","","!$1 <removed>\n") && next; # order ntp peers/servers if (/^ntp (server|peer) (\d+)\.(\d+)\.(\d+)\.(\d+)/) { $sortkey = sprintf("$1 %03d%03d%03d%03d",$2,$3,$4,$5); @@ -899,16 +961,17 @@ sub WriteTerm { # system controller /^syscon address (\S*) (\S*)/ && - ProcessHistory("","","","! syscon address $1 <removed>\n") && + ProcessHistory("","","","!syscon address $1 <removed>\n") && next; /^syscon password (\S*)/ && - ProcessHistory("","","","! syscon password <removed>\n") && + ProcessHistory("","","","!syscon password <removed>\n") && next; # catch anything that wasnt match above. ProcessHistory("","","","$_"); # end of config - if (/^end$/) { + #if (/^end(\n\[OK])?$/) { + if (/^(: )?end$/) { $found_end = 1; return(1); } @@ -938,6 +1001,7 @@ sub DoNothing {print STDOUT;} 'show controllers cbus' => "ShowContCbus", 'show diagbus' => "ShowDiagbus", 'show diag' => "ShowDiag", + 'show module' => "ShowModule", # cat 6500-ios 'show c7200' => "ShowC7200", 'show vtp status' => "ShowVTP", 'write term' => "WriteTerm" @@ -962,6 +1026,7 @@ sub DoNothing {print STDOUT;} "show controllers cbus", "show diagbus", "show diag", + "show module", "show c7200", "show vtp status", "write term" @@ -994,7 +1059,7 @@ ProcessHistory("COMMENTS","keysort","F0","!\n"); ProcessHistory("COMMENTS","keysort","G0","!\n"); TOP: while(<INPUT>) { tr/\015//d; - if (/\#exit$/) { + if (/\#\s?exit$/) { $clean_run=1; last; } diff --git a/bin/rename b/bin/rename.in index 8883355..8c3a111 100755 --- a/bin/rename +++ b/bin/rename.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!@PERLV_PATH@ 'di'; 'ig00'; # diff --git a/bin/rrancid b/bin/rrancid.in index 40113aa..9d9b84f 100755 --- a/bin/rrancid +++ b/bin/rrancid.in @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!@PERLV_PATH@ ## ## hacked version of Hank's rancid - this one tries to deal with redbacks. ## |