aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/ser2net.rb
diff options
context:
space:
mode:
authorJerome Bernard2012-02-15 14:07:37 +0100
committerAdam Vandenberg2012-04-28 17:50:34 -0700
commit2edaba7f84e37e8eb58dbb9281faa4627369fec2 (patch)
tree966f9351095bbaff5491e70afe8cef5a6f1a5df6 /Library/Formula/ser2net.rb
parentd18ddfa194846a27f613d250b1c92ef9074eb234 (diff)
downloadhomebrew-2edaba7f84e37e8eb58dbb9281faa4627369fec2.tar.bz2
ser2net 2.7
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula/ser2net.rb')
-rw-r--r--Library/Formula/ser2net.rb70
1 files changed, 70 insertions, 0 deletions
diff --git a/Library/Formula/ser2net.rb b/Library/Formula/ser2net.rb
new file mode 100644
index 000000000..4317ede52
--- /dev/null
+++ b/Library/Formula/ser2net.rb
@@ -0,0 +1,70 @@
+require 'formula'
+
+class Ser2net < Formula
+ homepage 'http://ser2net.sourceforge.net'
+ url 'http://downloads.sourceforge.net/project/ser2net/ser2net/2.7/ser2net-2.7.tar.gz'
+ md5 '22977477789868923a5de09a85e847dd'
+
+ def install
+ ENV.deparallelize
+
+ # Fix etc location
+ inreplace ["ser2net.c", "ser2net.8"], "/etc/ser2net.conf", "#{etc}/ser2net.conf"
+
+ system "./configure", "--disable-debug", "--disable-dependency-tracking",
+ "--prefix=#{prefix}",
+ "--mandir=#{man}"
+ system "make install"
+ etc.install 'ser2net.conf'
+
+ plist_path.write startup_plist
+ plist_path.chmod 0644
+ end
+
+ def caveats; <<-EOS.undent
+ Serial to Network Proxy (ser2net)
+
+ ser2net provides a way for a user to connect from a network connection to a serial port.
+ It provides all the serial port setup, a configuration file to configure the ports, a
+ control login for modifying port parameters, monitoring ports, and controlling ports.
+
+ To configure ser2net, edit the example configuration in #{etc}/ser2net.conf
+
+ To start manually ser2net server:
+ ser2net -p 12345
+ where 12345 is the port on which sernet will listen to control commands
+
+ You can start ser2net automatically on login running as your user with:
+ mkdir -p ~/Library/LaunchAgents
+ cp #{plist_path} ~/Library/LaunchAgents/
+ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
+ EOS
+ end
+
+ def startup_plist
+ return <<-EOPLIST
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>Label</key>
+ <string>#{plist_name}</string>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>KeepAlive</key>
+ <true/>
+ <key>UserName</key>
+ <string>#{`whoami`.chomp}</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>#{HOMEBREW_PREFIX}/sbin/ser2net</string>
+ <string>-p</string>
+ <string>12345</string>
+ </array>
+ <key>WorkingDirectory</key>
+ <string>#{HOMEBREW_PREFIX}</string>
+ </dict>
+</plist>
+ EOPLIST
+ end
+end