Created
September 13, 2009 17:16
-
-
Save anonymous/186245 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'expect' | |
require 'pty' | |
PTY.spawn( 'dnscache-setup' ) do |read,write,pid| | |
write.sync = true | |
$expect_verbose = false | |
read.expect( '(press enter to begin setup, or press control-C to abort)', 30 ) do |response| | |
write.print "\n" if response | |
end | |
read.expect( '[/var]' ) do |response| | |
# use default path /var/dnscachex | |
write.print "\n" if response | |
end | |
read.expect( 'IP to bind cache to [127.0.0.1]> ') do |response| | |
write.print "192.168.102.106\n" if response | |
end | |
read.expect( 'enter forward-to IP' ) do |response| | |
write.print( "192.168.1.1\n" ) if response | |
write.print( "\n" ) if response | |
end | |
read.expect( 'Enter IP>' ) do |response| | |
write.print( "192.168\n" ) if response | |
write.print( "\n") if response | |
write.print( "\n") if response | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment