2009-01-22 01:05:29 +00:00
|
|
|
#
|
|
|
|
# netboot65 server
|
|
|
|
#
|
|
|
|
# Jonno Downes (jonno@jamtronix.com) - January, 2009
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
Thread.abort_on_exception=true
|
|
|
|
|
|
|
|
def log_msg(msg)
|
|
|
|
puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} #{msg}"
|
|
|
|
end
|
|
|
|
|
2009-01-23 10:54:06 +00:00
|
|
|
lib_path=File.expand_path(File.dirname(__FILE__)+'/../lib')
|
|
|
|
$:.unshift(lib_path) unless $:.include?(lib_path)
|
|
|
|
require 'tftp_server'
|
|
|
|
require 'tndp_server'
|
2009-01-22 01:05:29 +00:00
|
|
|
|
2009-01-23 10:54:06 +00:00
|
|
|
bootfile_dir=File.expand_path(File.dirname(__FILE__)+'/../boot')
|
2009-01-22 01:05:29 +00:00
|
|
|
tftp_server=Netboot65TFTPServer.new(bootfile_dir)
|
|
|
|
tftp_server.start
|
2009-01-23 10:54:06 +00:00
|
|
|
|
2009-01-25 01:53:51 +00:00
|
|
|
tndp_server=TNDPServer.new(File.dirname(__FILE__)+"/../file_system_images")
|
2009-01-23 10:54:06 +00:00
|
|
|
tndp_server.start
|
2009-01-22 01:05:29 +00:00
|
|
|
begin
|
|
|
|
loop do
|
|
|
|
sleep(1) #wake up every second to get keyboard input, so we break on ^C
|
|
|
|
end
|
|
|
|
rescue Interrupt
|
|
|
|
log_msg "got interrupt signal - shutting down"
|
|
|
|
end
|
|
|
|
tftp_server.shutdown
|
2009-01-23 10:54:06 +00:00
|
|
|
tndp_server.shutdown
|
2009-01-22 02:53:18 +00:00
|
|
|
log_msg "shut down complete."
|