aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjtimberman2010-03-28 01:29:13 -0600
committerAdam Vandenberg2010-06-16 14:24:47 -0700
commitdff0f8d57a0a0b10740f6ead93f96c828bba521c (patch)
tree21aeb69d8dc324da79b7b87120a6afc1dadb3954
parentfee76dece4e2ef5845e36b41737de7f5b96e7ebb (diff)
downloadhomebrew-dff0f8d57a0a0b10740f6ead93f96c828bba521c.tar.bz2
Formula for runit
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
-rw-r--r--Library/Formula/runit.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/Library/Formula/runit.rb b/Library/Formula/runit.rb
new file mode 100644
index 000000000..2dbf04254
--- /dev/null
+++ b/Library/Formula/runit.rb
@@ -0,0 +1,43 @@
+require 'formula'
+
+class Runit <Formula
+ url 'http://smarden.org/runit/runit-2.1.1.tar.gz'
+ homepage 'http://smarden.org/runit'
+ md5 '8fa53ea8f71d88da9503f62793336bc3'
+
+ def install
+ # Runit untars to 'admin/runit-VERSION'
+ Dir.chdir("runit-2.1.1")
+
+ # Per the installation doc on OS X, we need to make a couple changes.
+ system "echo 'cc -Xlinker -x' >src/conf-ld"
+ inreplace 'src/Makefile', / -static/, ''
+
+ inreplace 'src/sv.c', "char *varservice =\"/service/\";", "char *varservice =\"#{var}/service/\";"
+ system "package/compile"
+
+ # The commands are compiled and copied into the 'command' directory and
+ # names added to package/commands. Read the file for the commands and
+ # install them in homebrew.
+ rcmds = File.open("package/commands").read
+ rcmds.each do |r|
+ bin.install("command/#{r.chomp}")
+ man8.install("man/#{r.chomp}.8")
+ end
+ (var + "service").mkpath
+ end
+
+ def man8; man+'man8' end
+
+ def caveats
+ <<-END_CAVEATS
+This formula does not install runit as a replacement for init.
+The service directory is #{var}/service instead of /service.
+To have runit ready to run services, start runsvdir:
+
+ $ runsvdir -P #{var}
+
+Depending on the services managed by runit, this may need to start as root.
+ END_CAVEATS
+ end
+end