2010-03-28 07:29:13 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Runit < Formula
|
2010-03-28 07:29:13 +00:00
|
|
|
homepage 'http://smarden.org/runit'
|
2012-02-21 06:04:21 +00:00
|
|
|
url 'http://smarden.org/runit/runit-2.1.1.tar.gz'
|
2012-09-03 18:33:56 +00:00
|
|
|
sha1 '8eee39639dcb79ba251ca4ab2c7cde38059f09c2'
|
2010-03-28 07:29:13 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
# Runit untars to 'admin/runit-VERSION'
|
2013-04-18 06:45:51 +00:00
|
|
|
cd "runit-#{version}" do
|
2012-02-21 06:04:21 +00:00
|
|
|
# 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/, ''
|
2010-03-28 07:29:13 +00:00
|
|
|
|
2012-02-21 06:04:21 +00:00
|
|
|
inreplace 'src/sv.c', "char *varservice =\"/service/\";", "char *varservice =\"#{var}/service/\";"
|
|
|
|
system "package/compile"
|
2010-03-28 07:29:13 +00:00
|
|
|
|
2012-02-21 06:04:21 +00:00
|
|
|
# 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
|
2010-03-28 07:29:13 +00:00
|
|
|
|
2012-02-21 06:04:21 +00:00
|
|
|
rcmds.each do |r|
|
|
|
|
bin.install("command/#{r.chomp}")
|
|
|
|
man8.install("man/#{r.chomp}.8")
|
|
|
|
end
|
2011-04-04 23:56:47 +00:00
|
|
|
|
2012-02-21 06:04:21 +00:00
|
|
|
(var + "service").mkpath
|
2010-03-28 07:29:13 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-04-04 23:56:47 +00:00
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
This formula does not install runit as a replacement for init.
|
|
|
|
The service directory is #{var}/service instead of /service.
|
2010-03-28 07:29:13 +00:00
|
|
|
|
2011-04-04 23:56:47 +00:00
|
|
|
To have runit ready to run services, start runsvdir:
|
2013-06-06 19:01:24 +00:00
|
|
|
runsvdir -P #{var}/service
|
2010-03-28 07:29:13 +00:00
|
|
|
|
2011-04-04 23:56:47 +00:00
|
|
|
Depending on the services managed by runit, this may need to start as root.
|
|
|
|
EOS
|
2010-03-28 07:29:13 +00:00
|
|
|
end
|
|
|
|
end
|