aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorPeter Hollows2011-12-11 02:27:20 +1100
committerAdam Vandenberg2012-02-04 19:29:33 -0800
commit0228551703f6b005cda6b34ce676d02af5822a71 (patch)
tree56fc71d64c9f25b68e06e344486ee20a4cc6fd02 /Library
parent6d32041089f69b286e38202d327fdd290b6c7e42 (diff)
downloadhomebrew-0228551703f6b005cda6b34ce676d02af5822a71.tar.bz2
polipo: launchd plist
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/polipo.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/Library/Formula/polipo.rb b/Library/Formula/polipo.rb
index 1973a4407..7d3f3abe3 100644
--- a/Library/Formula/polipo.rb
+++ b/Library/Formula/polipo.rb
@@ -12,5 +12,44 @@ class Polipo < Formula
make_opts = "PREFIX=#{prefix} LOCAL_ROOT=#{share}/polipo/www DISK_CACHE_ROOT=#{cache_root} MANDIR=#{man} INFODIR=#{info} PLATFORM_DEFINES=-DHAVE_IPv6"
system "make all #{make_opts}"
system "make install #{make_opts}"
+
+ plist_path.write startup_plist
+ plist_path.chmod 0644
+ 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>#{bin}/polipo</string>
+ </array>
+ </dict>
+</plist>
+ EOPLIST
+ end
+
+ def caveats; <<-EOS.undent
+ If this is your first install, automatically load on login with:
+ mkdir -p ~/Library/LaunchAgents
+ cp #{plist_path} ~/Library/LaunchAgents/
+ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
+
+ If this is an upgrade and you already have the #{plist_path.basename} loaded:
+ launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename}
+ cp #{plist_path} ~/Library/LaunchAgents/
+ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
+ EOS
end
end