aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorMax Howell2013-04-12 17:41:12 -0400
committerMax Howell2013-04-12 17:41:12 -0400
commit5fbe64d945cc4a0056c8775b62e6da5a60b9fc4d (patch)
treeb651a3821b0b81a83f8d2d9d19d29caa580c59fa /Library/Formula
parent4c9fa931d76b8b335c41abd9de2d9dab334bc08e (diff)
downloadhomebrew-5fbe64d945cc4a0056c8775b62e6da5a60b9fc4d.tar.bz2
Be kind to users with old nginx plists
Since I moved the nginx binary from `sbin` to `bin`, it's possible old Launch Agent plists exist that still look in `sbin` (among other things). If we find an old nginx keg that has an `sbin` directory, we create an `sbin` symlink for the new nginx we are installing. Homebrew always works.
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/nginx.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/Library/Formula/nginx.rb b/Library/Formula/nginx.rb
index f8a59dde8..b218e4cf0 100644
--- a/Library/Formula/nginx.rb
+++ b/Library/Formula/nginx.rb
@@ -74,6 +74,9 @@ class Nginx < Formula
man8.install "objs/nginx.8"
(var/'run/nginx').mkpath
+ # nginx’s docroot is #{prefix}/html, this isn't useful, so we symlink it
+ # to #{HOMEBREW_PREFIX}/var/www. The reason we symlink instead of patching
+ # is so the user can redirect it easily to something else if they choose.
prefix.cd do
dst = HOMEBREW_PREFIX/"var/www"
if not dst.exist?
@@ -85,6 +88,17 @@ class Nginx < Formula
end
Pathname.new("#{prefix}/html").make_relative_symlink(dst)
end
+
+ # for most of this formula’s life the binary has been placed in sbin
+ # and Homebrew used to suggest the user copy the plist for nginx to their
+ # ~/Library/LaunchAgents directory. So we need to have a symlink there
+ # for such cases
+ if (HOMEBREW_CELLAR/'nginx').subdirs.any?{|d| (d/:sbin).directory? }
+ sbin.mkpath
+ sbin.cd do
+ (sbin/'nginx').make_relative_symlink(bin/'nginx')
+ end
+ end
end
def caveats; <<-EOS.undent