require 'bundler' Bundler::GemHelper.install_tasks def setup_service # Set up marionette as a service to start at boot. # define task: # 1) write to init.d/marionette # 2) set permissions # 3) set ifconfig # 4) start service script = <&2 exit 3 ;; esac exit 0 CODE ip = `sudo /sbin/ifconfig eth1 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` file = File.open('/etc/marionette.tcp','w') file.write ip file.close file = File.open('/etc/init.d/marionette','w') file.write script file.close system "sudo chmod 755 /etc/init.d/marionette" end setup_service