diff options
| author | Mike McQuaid | 2012-11-25 15:06:41 +0000 | 
|---|---|---|
| committer | Mike McQuaid | 2012-11-25 23:05:52 +0000 | 
| commit | 5825f62337c087897ae255a92ad94619a1dd1981 (patch) | |
| tree | d8e4885a3b5c8b00fc3ceae3969cf5df4354881c | |
| parent | 6dc4678ad3e88918e3b47da5d8b09b2e4677012c (diff) | |
| download | homebrew-5825f62337c087897ae255a92ad94619a1dd1981.tar.bz2 | |
Make generic caveats for launchd plist files.
50 files changed, 880 insertions, 1424 deletions
| diff --git a/Library/Formula/aiccu.rb b/Library/Formula/aiccu.rb index fcf3f7a31..5bf9e54d2 100644 --- a/Library/Formula/aiccu.rb +++ b/Library/Formula/aiccu.rb @@ -16,7 +16,9 @@ class Aiccu < Formula      etc.install 'doc/aiccu.conf' unless (etc/'aiccu.conf').exist?    end -  def startup_plist; <<-EOS.undent +  plist_options :startup => true + +  def plist; <<-EOS.undent      <?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"> @@ -25,9 +27,9 @@ class Aiccu < Formula        <string>#{plist_name}</string>        <key>ProgramArguments</key>        <array> -        <string>#{HOMEBREW_PREFIX}/sbin/aiccu</string> +        <string>#{opt_prefix}/sbin/aiccu</string>          <string>start</string> -        <string>#{HOMEBREW_PREFIX}/etc/aiccu.conf</string> +        <string>#{etc}/aiccu.conf</string>        </array>        <key>RunAtLoad</key>        <true/> @@ -47,7 +49,6 @@ class Aiccu < Formula        Because these are kernel extensions, there is no Homebrew formula for tuntap. -        Unless it exists already, a aiccu.conf file has been written to:          #{etc}/aiccu.conf @@ -55,17 +56,6 @@ class Aiccu < Formula        The 'aiccu' command will load this file by default unless told to use        a different one. - - -      To launch on startup: -      * if this is your first install: -          sudo cp #{plist_path} /Library/LaunchDaemons/ -          sudo launchctl load -w /Library/LaunchDaemons/#{plist_path.basename} - -      * if this is an upgrade and you already have the #{plist_path.basename} loaded: -          sudo launchctl unload -w /Library/LaunchDaemons/#{plist_path.basename} -          sudo cp #{plist_path} /Library/LaunchDaemons/ -          sudo launchctl load -w /Library/LaunchDaemons/#{plist_path.basename}      EOS    end  end diff --git a/Library/Formula/apollo.rb b/Library/Formula/apollo.rb index a0e9aae21..85384bad2 100644 --- a/Library/Formula/apollo.rb +++ b/Library/Formula/apollo.rb @@ -41,32 +41,17 @@ class Apollo < Formula      end      bin.write_exec_script libexec/'bin/apollo' - -    plist_path.write startup_plist -    plist_path.chmod 0644    end +  plist_options :manual => "#{HOMEBREW_PREFIX}/var/apollo/bin/apollo-broker" +    def caveats; <<-EOS.undent      To create the broker:          #{bin}/apollo create #{var}/apollo - -    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} - -    Or to start the broker in the foreground run: -        #{var}/apollo/bin/apollo-broker run -      EOS    end -  def startup_plist; <<-EOS.undent +  def plist; <<-EOS.undent      <?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"> diff --git a/Library/Formula/arangodb.rb b/Library/Formula/arangodb.rb index 163777040..4033da9c2 100644 --- a/Library/Formula/arangodb.rb +++ b/Library/Formula/arangodb.rb @@ -31,52 +31,40 @@ class Arangodb < Formula      (var+'log/arangodb').mkpath    end +  plist_options :manual => "#{HOMEBREW_PREFIX}/opt/arangodb/sbin/arangod" +    def caveats; <<-EOS.undent      Please note that this is a very early version if ArangoDB. There will be      bugs and the ArangoDB team would really appreciate it if you report them:        https://github.com/triAGENS/ArangoDB/issues -    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} - -    To start the ArangoDB server manually, run: -        /usr/local/sbin/arangod -      To start the ArangoDB shell, run:          arangosh      EOS    end -  def startup_plist -    return <<-EOS -<?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>KeepAlive</key> -    <true/> -    <key>Label</key> -    <string>#{plist_name}</string> -    <key>ProgramArguments</key> -    <array> -      <string>#{HOMEBREW_PREFIX}/sbin/arangod</string> -      <string>-c</string> -      <string>#{etc}/arangodb/arangod.conf</string> -    </array> -    <key>RunAtLoad</key> -    <true/> -    <key>UserName</key> -    <string>#{`whoami`.chomp}</string> -  </dict> -</plist> +  def plist; <<-EOS.undent +    <?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>KeepAlive</key> +        <true/> +        <key>Label</key> +        <string>#{plist_name}</string> +        <key>ProgramArguments</key> +        <array> +          <string>#{opt_prefix}/sbin/arangod</string> +          <string>-c</string> +          <string>#{etc}/arangodb/arangod.conf</string> +        </array> +        <key>RunAtLoad</key> +        <true/> +        <key>UserName</key> +        <string>#{`whoami`.chomp}</string> +      </dict> +    </plist>      EOS    end  end diff --git a/Library/Formula/beanstalk.rb b/Library/Formula/beanstalk.rb index b4bbcf220..933d44086 100644 --- a/Library/Formula/beanstalk.rb +++ b/Library/Formula/beanstalk.rb @@ -9,25 +9,10 @@ class Beanstalk < Formula      system "make", "install", "PREFIX=#{prefix}"    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} +  plist_options :manual => "beanstalkd" -      To start beanstalk manually: -        beanstalkd -    EOS -  end - -  def startup_plist -    <<-EOPLIST.undent +  def plist; <<-EOS.undent      <?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"> @@ -38,7 +23,7 @@ class Beanstalk < Formula          <string>#{plist_name}</string>          <key>ProgramArguments</key>          <array> -          <string>#{HOMEBREW_PREFIX}/bin/beanstalkd</string> +          <string>#{opt_prefix}/bin/beanstalkd</string>          </array>          <key>RunAtLoad</key>          <true/> @@ -54,6 +39,6 @@ class Beanstalk < Formula          <string>#{var}/log/beanstalkd.log</string>        </dict>      </plist> -    EOPLIST +    EOS    end  end diff --git a/Library/Formula/cassandra.rb b/Library/Formula/cassandra.rb index 7b7b82c2d..426ce29c3 100644 --- a/Library/Formula/cassandra.rb +++ b/Library/Formula/cassandra.rb @@ -30,44 +30,38 @@ class Cassandra < Formula    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 you plan to use the CQL shell (cqlsh), you will need the Python CQL library      installed. Since Homebrew prefers using pip for Python packages, you can      install that using:        pip install cql -      EOS    end -  def startup_plist; <<-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>KeepAlive</key> -    <true/> +  def plist; <<-EOS.undent +    <?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>KeepAlive</key> +        <true/> -    <key>Label</key> -    <string>#{plist_name}</string> +        <key>Label</key> +        <string>#{plist_name}</string> -    <key>ProgramArguments</key> -    <array> -        <string>#{HOMEBREW_PREFIX}/bin/cassandra</string> -        <string>-f</string> -    </array> +        <key>ProgramArguments</key> +        <array> +            <string>#{opt_prefix}/bin/cassandra</string> +            <string>-f</string> +        </array> -    <key>RunAtLoad</key> -    <true/> +        <key>RunAtLoad</key> +        <true/> -    <key>WorkingDirectory</key> -    <string>#{var}/lib/cassandra</string> -  </dict> -</plist> -    EOPLIST +        <key>WorkingDirectory</key> +        <string>#{var}/lib/cassandra</string> +      </dict> +    </plist> +    EOS    end  end diff --git a/Library/Formula/couchdb-lucene.rb b/Library/Formula/couchdb-lucene.rb index 9799c9a34..edf548dfa 100644 --- a/Library/Formula/couchdb-lucene.rb +++ b/Library/Formula/couchdb-lucene.rb @@ -17,63 +17,51 @@ class CouchdbLucene < Formula      (etc + "couchdb/local.d/couchdb-lucene.ini").write ini_file    end -  def caveats; <<-EOS.undent -    You can enable couchdb-lucene to automatically load on login with: +  def ini_file; <<-EOS.undent +    [couchdb] +    os_process_timeout=60000 ; increase the timeout from 5 seconds. -      mkdir -p ~/Library/LaunchAgents -      cp "#{plist_path}" ~/Library/LaunchAgents/ -      launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} +    [external] +    fti=#{which 'python'} #{prefix}/tools/couchdb-external-hook.py -    Or start it manually with: -      #{bin}/run +    [httpd_db_handlers] +    _fti = {couch_httpd_external, handle_external_req, <<"fti">>}      EOS    end -  def ini_file -    return <<-EOS -[couchdb] -os_process_timeout=60000 ; increase the timeout from 5 seconds. +  plist_options :manual => "#{HOMEBREW_PREFIX}/opt/couchdb-lucene/bin/run" -[external] -fti=#{which 'python'} #{prefix}/tools/couchdb-external-hook.py - -[httpd_db_handlers] -_fti = {couch_httpd_external, handle_external_req, <<"fti">>} -EOS -  end - -  def startup_plist -    return <<-EOS -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//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>EnvironmentVariables</key> -    <dict> -      <key>HOME</key> -      <string>~</string> -      <key>DYLD_LIBRARY_PATH</key> -      <string>/opt/local/lib:$DYLD_LIBRARY_PATH</string> -    </dict> -    <key>ProgramArguments</key> -    <array> -      <string>#{HOMEBREW_PREFIX}/bin/run</string> -    </array> -    <key>UserName</key> -    <string>#{`whoami`.chomp}</string> -    <key>StandardOutPath</key> -    <string>/dev/null</string> -    <key>StandardErrorPath</key> -    <string>/dev/null</string> -    <key>RunAtLoad</key> -    <true/> -    <key>KeepAlive</key> -    <true/> -  </dict> -</plist> -EOS +  def plist; <<-EOS.undent +    <?xml version="1.0" encoding="UTF-8"?> +    <!DOCTYPE plist PUBLIC "-//Apple Computer//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>EnvironmentVariables</key> +        <dict> +          <key>HOME</key> +          <string>~</string> +          <key>DYLD_LIBRARY_PATH</key> +          <string>/opt/local/lib:$DYLD_LIBRARY_PATH</string> +        </dict> +        <key>ProgramArguments</key> +        <array> +          <string>#{opt_prefix}/bin/run</string> +        </array> +        <key>UserName</key> +        <string>#{`whoami`.chomp}</string> +        <key>StandardOutPath</key> +        <string>/dev/null</string> +        <key>StandardErrorPath</key> +        <string>/dev/null</string> +        <key>RunAtLoad</key> +        <true/> +        <key>KeepAlive</key> +        <true/> +      </dict> +    </plist> +    EOS    end  end diff --git a/Library/Formula/ddclient.rb b/Library/Formula/ddclient.rb index 2e72ce52d..2303e71ce 100644 --- a/Library/Formula/ddclient.rb +++ b/Library/Formula/ddclient.rb @@ -35,61 +35,49 @@ class Ddclient < Formula      (var+'run/ddclient').mkpath    end -  def caveats; <<-EOS -For ddclient to work, you will need to do the following: +  def caveats; <<-EOS.undent +    For ddclient to work, you will need to create a configuration file +    in #{etc}/ddclient, a sample configuration can be found in +    #{opt_prefix}/share/doc/ddclient. -1) Create configuration file in #{etc}/ddclient, a sample -   configuration can be found in #{HOMEBREW_PREFIX}/share/doc/ddclient. +    Note: don't enable daemon mode in the configuration file; see +    additional information below. -   Note: don't enable daemon mode in the configuration file; see -   additional information below. +    The next reboot of the system will automatically start ddclient. -2) Install the launchd item in /Library/LaunchDaemons, like so: - -   sudo cp -vf #{plist_path} /Library/LaunchDaemons/ -   sudo chown -v root:wheel /Library/LaunchDaemons/#{plist_path.basename} - -3) Start the daemon using: - -  sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename} - -The next reboot of the system will automatically start ddclient. - -You can adjust the execution interval by changing the value of -StartInterval (in seconds) in /Library/LaunchDaemons/#{plist_path.basename}, -and then - -   sudo launchctl unload /Library/LaunchDaemons/#{plist_path.basename} -   sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename} -EOS +    You can adjust the execution interval by changing the value of +    StartInterval (in seconds) in /Library/LaunchDaemons/#{plist_path.basename}, +    and then +    EOS    end -  def startup_plist -    return <<-EOS -<?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>ProgramArguments</key> -  <array> -    <string>#{HOMEBREW_PREFIX}/sbin/ddclient</string> -    <string>-file</string> -    <string>#{etc}/ddclient/ddclient.conf</string> -  </array> -  <key>RunAtLoad</key> -  <true/> -  <key>StartInterval</key> -  <integer>300</integer> -  <key>WatchPaths</key> -  <array> -    <string>#{etc}/ddclient</string> -  </array> -  <key>WorkingDirectory</key> -  <string>#{etc}/ddclient</string> -</dict> -</plist> -EOS +  plist_options :startup => true + +  def plist; <<-EOS.undent +    <?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>ProgramArguments</key> +      <array> +        <string>#{opt_prefix}/sbin/ddclient</string> +        <string>-file</string> +        <string>#{etc}/ddclient/ddclient.conf</string> +      </array> +      <key>RunAtLoad</key> +      <true/> +      <key>StartInterval</key> +      <integer>300</integer> +      <key>WatchPaths</key> +      <array> +        <string>#{etc}/ddclient</string> +      </array> +      <key>WorkingDirectory</key> +      <string>#{etc}/ddclient</string> +    </dict> +    </plist> +    EOS    end  end diff --git a/Library/Formula/denyhosts.rb b/Library/Formula/denyhosts.rb index 247669554..c4b87aa77 100644 --- a/Library/Formula/denyhosts.rb +++ b/Library/Formula/denyhosts.rb @@ -38,7 +38,9 @@ class Denyhosts < Formula      sbin.install_symlink libexec+'denyhosts.py' => 'denyhosts'    end -  def startup_plist; <<-EOS.undent +  plist_options :startup => true + +  def plist; <<-EOS.undent      <?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"> @@ -47,7 +49,7 @@ class Denyhosts < Formula        <string>#{plist_name}</string>        <key>ProgramArguments</key>        <array> -        <string>#{HOMEBREW_PREFIX}/sbin/denyhosts</string> +        <string>#{opt_prefix}/sbin/denyhosts</string>        </array>        <key>RunAtLoad</key>        <true/> @@ -66,12 +68,6 @@ class Denyhosts < Formula      All DenyHosts scripts will load this file by default unless told to use      a different one. - -    A launchctl plist has been created that will run DenyHosts to update -    /etc/hosts.deny every 10 minutes. It will need to be run by the user that -    owns /etc/hosts.deny, usually root, and can be set to load at startup -    via: -      sudo cp #{plist_path} /Library/LaunchDaemons/      EOS    end  end diff --git a/Library/Formula/dnsmasq.rb b/Library/Formula/dnsmasq.rb index 136d9a6bc..390817772 100644 --- a/Library/Formula/dnsmasq.rb +++ b/Library/Formula/dnsmasq.rb @@ -36,16 +36,12 @@ class Dnsmasq < Formula      and edit to taste.        cp #{opt_prefix}/dnsmasq.conf.example #{etc}/dnsmasq.conf - -    To load dnsmasq automatically on startup, install and load the provided launchd -    item as follows: - -      sudo cp #{plist_path} /Library/LaunchDaemons -      sudo launchctl load -w /Library/LaunchDaemons/#{plist_path.basename}      EOS    end -  def startup_plist; <<-EOS.undent +  plist_options :startup => true + +  def plist; <<-EOS.undent      <?xml version="1.0" encoding="UTF-8"?>      <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">      <plist version="1.0"> @@ -54,7 +50,7 @@ class Dnsmasq < Formula          <string>#{plist_name}</string>          <key>ProgramArguments</key>          <array> -          <string>#{HOMEBREW_PREFIX}/sbin/dnsmasq</string> +          <string>#{opt_prefix}/sbin/dnsmasq</string>            <string>--keep-in-foreground</string>          </array>          <key>KeepAlive</key> diff --git a/Library/Formula/elasticsearch.rb b/Library/Formula/elasticsearch.rb index 150b46746..992f2b300 100644 --- a/Library/Formula/elasticsearch.rb +++ b/Library/Formula/elasticsearch.rb @@ -51,28 +51,11 @@ class Elasticsearch < Formula      end    end -  def caveats -    <<-EOS.undent -    If this is your first install, automatically load ElasticSearch on login with: -        mkdir -p ~/Library/LaunchAgents -        ln -nfs #{plist_path} ~/Library/LaunchAgents/ -        launchctl load -wF ~/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} -        ln -nfs #{plist_path} ~/Library/LaunchAgents/ -        launchctl load -wF ~/Library/LaunchAgents/#{plist_path.basename} - +  def caveats; <<-EOS.undent      If upgrading from 0.18 ElasticSearch requires flushing before shutting      down the cluster with no indexing operations happening after flush:          curl host:9200/_flush -    To stop the ElasticSearch daemon: -        launchctl unload -wF ~/Library/LaunchAgents/#{plist_path.basename} - -    To start ElasticSearch manually: -        elasticsearch -f -D es.config=#{prefix}/config/elasticsearch.yml -      See the 'elasticsearch.yml' file for configuration options.      You'll find the ElasticSearch log here: @@ -83,12 +66,12 @@ class Elasticsearch < Formula      You should see ElasticSearch running:          open http://localhost:9200/ -      EOS    end -  def startup_plist -    <<-PLIST.undent +  plist_options :manual => "elasticsearch -f -D es.config=#{HOMEBREW_PREFIX}/opt/elasticsearch/config/elasticsearch.yml" + +  def plist; <<-EOS.undent        <?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"> @@ -120,6 +103,6 @@ class Elasticsearch < Formula            <string>/dev/null</string>          </dict>        </plist> -    PLIST +    EOS    end  end diff --git a/Library/Formula/fail2ban.rb b/Library/Formula/fail2ban.rb index 00057b287..88b4b4482 100644 --- a/Library/Formula/fail2ban.rb +++ b/Library/Formula/fail2ban.rb @@ -28,13 +28,11 @@ class Fail2ban < Formula                       "--install-lib=#{libexec}",                       "--install-data=#{libexec}",                       "--install-scripts=#{bin}" - -    plist_path.write startup_plist -    plist_path.chmod 0644    end -  def startup_plist -    <<-EOF.undent +  plist_options :startup => true + +  def plist; <<-EOS.undent        <?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"> @@ -43,18 +41,17 @@ class Fail2ban < Formula          <string>#{plist_name}</string>          <key>ProgramArguments</key>          <array> -          <string>#{HOMEBREW_PREFIX}/bin/fail2ban-client</string> +          <string>#{opt_prefix}/bin/fail2ban-client</string>            <string>start</string>          </array>          <key>RunAtLoad</key>          <true/>        </dict>        </plist> -    EOF +    EOS    end -  def caveats -    <<-EOS.undent +  def caveats; <<-EOS.undent        Before using Fail2Ban for the first time you should edit jail        configuration and enable the jails that you want to use, for instance        ssh-ipfw. Also make sure that they point to the correct configuration @@ -69,15 +66,6 @@ class Fail2ban < Formula          10.4: http://www.fail2ban.org/wiki/index.php/HOWTO_Mac_OS_X_Server_(10.4)          10.5: http://www.fail2ban.org/wiki/index.php/HOWTO_Mac_OS_X_Server_(10.5) - -      A launchctl plist has been created that will start Fail2Ban at bootup. It -      must be run by a user that is allowed to manipulate the enabled rules, -      i.e. ipfw. -      To install it execute the following commands: - -        sudo cp #{plist_path} /Library/LaunchDaemons/ -        sudo launchctl load /Library/LaunchDaemons/#{plist_name} -      EOS    end  end diff --git a/Library/Formula/freediameter.rb b/Library/Formula/freediameter.rb index b5c75cd6c..9296b793e 100644 --- a/Library/Formula/freediameter.rb +++ b/Library/Formula/freediameter.rb @@ -52,17 +52,13 @@ class Freediameter < Formula      For more information about freeDiameter configuration options, read:        http://www.freediameter.net/trac/wiki/Configuration -    Other potentially usefull files can be found in #{prefix}/contrib - -    To load freeDiameter automatically on startup, install and load the provided launchd -    item as follows: - -      sudo cp #{plist_path} /Library/LaunchDaemons -      sudo launchctl load -w /Library/LaunchDaemons/#{plist_path.basename} +    Other potentially useful files can be found in #{prefix}/contrib      EOS    end -  def startup_plist; <<-EOS.undent +  plist_options :startup => true + +  def plist; <<-EOS.undent      <?xml version="1.0" encoding="UTF-8"?>      <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">      <plist version="1.0"> @@ -71,7 +67,7 @@ class Freediameter < Formula          <string>#{plist_name}</string>          <key>ProgramArguments</key>          <array> -          <string>#{HOMEBREW_PREFIX}/bin/freeDiameterd</string> +          <string>#{opt_prefix}/bin/freeDiameterd</string>          </array>          <key>KeepAlive</key>          <dict> diff --git a/Library/Formula/freeswitch.rb b/Library/Formula/freeswitch.rb index 98dc66599..8db18e8e4 100644 --- a/Library/Formula/freeswitch.rb +++ b/Library/Formula/freeswitch.rb @@ -27,7 +27,9 @@ class Freeswitch < Formula      system "make all cd-sounds-install cd-moh-install"    end -  def startup_plist; <<-EOS.undent +  plist_options :manual => "freeswitch -nc --nonat" + +  def plist; <<-EOS.undent      <?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"> @@ -51,22 +53,6 @@ class Freeswitch < Formula      EOS    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} - -    Or start it manually: -      freeswitch -nc --nonat -    EOS -  end -    def test      system "#{bin}/freeswitch", "-version"    end diff --git a/Library/Formula/gearman.rb b/Library/Formula/gearman.rb index ef6d66c5d..859e83525 100644 --- a/Library/Formula/gearman.rb +++ b/Library/Formula/gearman.rb @@ -15,38 +15,24 @@ class Gearman < Formula      system "make install"    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} +  plist_options :manual => "gearmand -d" -    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} - -      To start gearmand manually: -        gearmand -d +  def plist; <<-EOS.undent +    <?xml version="1.0" encoding="UTF-8"?> +    <!DOCTYPE plist PUBLIC "-//Apple Computer//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>Program</key> +        <string>#{opt_prefix}/sbin/gearmand</string> +        <key>RunAtLoad</key> +        <true/> +        <key>UserName</key> +        <string>#{`whoami`.chomp}</string> +      </dict> +    </plist>      EOS    end - -  def startup_plist; <<-EOPLIST -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//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>Program</key> -    <string>#{sbin}/gearmand</string> -    <key>RunAtLoad</key> -    <true/> -    <key>UserName</key> -    <string>#{`whoami`.chomp}</string> -  </dict> -</plist> -    EOPLIST -  end  end diff --git a/Library/Formula/graylog2-server.rb b/Library/Formula/graylog2-server.rb index 0b26f8f84..13500840f 100644 --- a/Library/Formula/graylog2-server.rb +++ b/Library/Formula/graylog2-server.rb @@ -28,67 +28,49 @@ class Graylog2Server < Formula      prefix.install Dir['*']    end -  def caveats -    <<-EOS.undent +  def caveats; <<-EOS.undent        In the interest of allowing you to run graylog2-server as a        non-root user, the default syslog_listen_port is set to 8514. -      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} - -      Or to manage graylog2-server without launchd: - -        To start graylog2-server: -          graylog2ctl start - -        To stop graylog2-server: -          graylog2ctl stop - -        The config file is located at: -          #{etc}/graylog2.conf +      The config file is located at: +        #{etc}/graylog2.conf      EOS    end -  def startup_plist -    return <<-EOS -<?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>ProgramArguments</key> -  <array> -    <string>java</string> -    <string>-jar</string> -    <string>#{prefix}/graylog2-server.jar</string> -    <string>-f</string> -    <string>#{etc}/graylog2.conf</string> -    <string>-p</string> -    <string>/tmp/graylog2.pid</string> -  </array> -  <key>RunAtLoad</key> -  <true/> -  <key>KeepAlive</key> -  <false/> -  <key>UserName</key> -  <string>#{`whoami`.chomp}</string> -  <key>WorkingDirectory</key> -  <string>#{HOMEBREW_PREFIX}</string> -  <key>StandardErrorPath</key> -  <string>#{var}/log/graylog2-server/error.log</string> -  <key>StandardOutPath</key> -  <string>#{var}/log/graylog2-server/output.log</string> -</dict> -</plist> -EOS +  plist_options :manual => "graylog2ctl start" + +  def plist; <<-EOS.undent +    <?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>ProgramArguments</key> +      <array> +        <string>java</string> +        <string>-jar</string> +        <string>#{opt_prefix}/graylog2-server.jar</string> +        <string>-f</string> +        <string>#{etc}/graylog2.conf</string> +        <string>-p</string> +        <string>/tmp/graylog2.pid</string> +      </array> +      <key>RunAtLoad</key> +      <true/> +      <key>KeepAlive</key> +      <false/> +      <key>UserName</key> +      <string>#{`whoami`.chomp}</string> +      <key>WorkingDirectory</key> +      <string>#{HOMEBREW_PREFIX}</string> +      <key>StandardErrorPath</key> +      <string>#{var}/log/graylog2-server/error.log</string> +      <key>StandardOutPath</key> +      <string>#{var}/log/graylog2-server/output.log</string> +    </dict> +    </plist> +    EOS    end    def test diff --git a/Library/Formula/ircd-hybrid.rb b/Library/Formula/ircd-hybrid.rb index f85903526..a533ddd45 100644 --- a/Library/Formula/ircd-hybrid.rb +++ b/Library/Formula/ircd-hybrid.rb @@ -34,50 +34,35 @@ class IrcdHybrid < Formula    def caveats; <<-EOS.undent      You'll more than likely need to edit the default settings in the config file:        #{etc}/ircd.conf - -    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} - -    Or start manually with: -      ircd - -    Which will give you a pid you can kill with: -      kill pid      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>KeepAlive</key> -  <false/> -  <key>Label</key> -  <string>#{plist_name}</string> -  <key>ProgramArguments</key> -  <array> -    <string>#{HOMEBREW_PREFIX}/sbin/ircd</string> -  </array> -  <key>RunAtLoad</key> -  <true/> -  <key>UserName</key> -  <string>#{`whoami`.chomp}</string> -  <key>WorkingDirectory</key> -  <string>#{HOMEBREW_PREFIX}</string> -  <key>StandardErrorPath</key> -  <string>#{var}/ircd.log</string> -</dict> -</plist> -    EOPLIST +  plist_options :manual => "ircd" + +  def plist; <<-EOS.undent +    <?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>KeepAlive</key> +      <false/> +      <key>Label</key> +      <string>#{plist_name}</string> +      <key>ProgramArguments</key> +      <array> +        <string>#{opt_prefix}/sbin/ircd</string> +      </array> +      <key>RunAtLoad</key> +      <true/> +      <key>UserName</key> +      <string>#{`whoami`.chomp}</string> +      <key>WorkingDirectory</key> +      <string>#{HOMEBREW_PREFIX}</string> +      <key>StandardErrorPath</key> +      <string>#{var}/ircd.log</string> +    </dict> +    </plist> +    EOS    end  end diff --git a/Library/Formula/isc-dhcp.rb b/Library/Formula/isc-dhcp.rb index 0fc2fca24..53e650651 100644 --- a/Library/Formula/isc-dhcp.rb +++ b/Library/Formula/isc-dhcp.rb @@ -70,46 +70,33 @@ class IscDhcp < Formula        File.new(file, File::CREAT|File::RDONLY).close      end -    # sample launchd plists -    plist_path.write dhcpd_plist -    plist_path.chmod 0644 -    (prefix+'homebrew.mxcl.dhcpd6.plist').write dhcpd6_plist +    # dhcpv6 plists +    (prefix+'homebrew.mxcl.dhcpd6.plist').write plist_dhcpd6      (prefix+'homebrew.mxcl.dhcpd6.plist').chmod 0644    end -  def caveats -    <<-EOCAVEATS.undent +  def caveats; <<-EOS.undent      This install of dhcpd expects config files to be in #{etc}.      All state files (leases and pids) are stored in #{var}/dhcpd.      Dhcpd needs to run as root since it listens on privileged ports. -    Sample launchd plists to achieve this have been provided at: -      #{plist_path} -    and: -      #{prefix}/homebrew.mxcl.dhcpd6.plist      There are two plists because a single dhcpd process may do either      DHCPv4 or DHCPv6 but not both. Use one or both as needed. -    Copy the plists to /Library/LaunchDaemons and start the services with -      cd /Library/LaunchDaemons -      launchctl load -w #{plist_path.basename} -      launchctl load -w homebrew.mxcl.dhcpd6.plist -      Note that you must create the appropriate config files before starting      the services or dhcpd will refuse to run.        DHCPv4: #{etc}/dhcpd.conf        DHCPv6: #{etc}/dhcpd6.conf      Sample config files may be found in #{etc}. -    If you change the config, restart dhcpd with one or both of -      launchctl stop #{plist_name} -      launchctl stop homebrew.mxcl.dhcpd6 -    EOCAVEATS +    EOS    end -  def dhcpd_plist -    <<-EOPLIST.undent +  plist_options :startup => true + +  def plist +    <<-EOS.undent      <?xml version='1.0' encoding='UTF-8'?>      <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"                      "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> @@ -118,7 +105,7 @@ class IscDhcp < Formula      <key>Label</key><string>#{plist_name}</string>      <key>ProgramArguments</key>        <array> -        <string>#{HOMEBREW_PREFIX}/sbin/dhcpd</string> +        <string>#{opt_prefix}/sbin/dhcpd</string>          <string>-f</string>        </array>      <key>Disabled</key><false/> @@ -127,11 +114,11 @@ class IscDhcp < Formula      <key>LowPriorityIO</key><true/>      </dict>      </plist> -    EOPLIST +    EOS    end -  def dhcpd6_plist -    <<-EOPLIST.undent +  def plist_dhcpd6 +    <<-EOS.undent      <?xml version='1.0' encoding='UTF-8'?>      <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"                      "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> @@ -140,7 +127,7 @@ class IscDhcp < Formula      <key>Label</key><string>#{plist_name}</string>      <key>ProgramArguments</key>        <array> -        <string>#{HOMEBREW_PREFIX}/sbin/dhcpd</string> +        <string>#{opt_prefix}/sbin/dhcpd</string>          <string>-f</string>          <string>-6</string>          <string>-cf</string> @@ -152,6 +139,6 @@ class IscDhcp < Formula      <key>LowPriorityIO</key><true/>      </dict>      </plist> -    EOPLIST +    EOS    end  end diff --git a/Library/Formula/jenkins.rb b/Library/Formula/jenkins.rb index 8c8abcfff..71712e8d4 100644 --- a/Library/Formula/jenkins.rb +++ b/Library/Formula/jenkins.rb @@ -15,39 +15,26 @@ class Jenkins < Formula      end    end -  def caveats; <<-EOS.undent -    If this is your first install, automatically load on login with: -      mkdir -p ~/Library/LaunchAgents -      ln -nfs #{plist_path} ~/Library/LaunchAgents/ -      launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} +  plist_options :manual => "java -jar #{HOMEBREW_PREFIX}/opt/jenkins/libexec/jenkins.war" -    If this is an upgrade and you already have the #{plist_path.basename} loaded: -      launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename} -      launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - -    Or start it manually: -      java -jar #{libexec}/jenkins.war -    EOS -  end - -  def startup_plist; <<-EOS -<?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>ProgramArguments</key> -  <array> -  <string>/usr/bin/java</string> -  <string>-jar</string> -  <string>#{HOMEBREW_PREFIX}/opt/jenkins/libexec/jenkins.war</string> -  <string>--httpListenAddress=127.0.0.1</string> -  </array> -  <key>RunAtLoad</key> -  <true/> -</dict> -</plist> -EOS +  def plist; <<-EOS.undent +    <?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>ProgramArguments</key> +        <array> +          <string>/usr/bin/java</string> +          <string>-jar</string> +          <string>#{opt_prefix}/libexec/jenkins.war</string> +          <string>--httpListenAddress=127.0.0.1</string> +        </array> +        <key>RunAtLoad</key> +        <true/> +      </dict> +    </plist> +  EOS    end  end diff --git a/Library/Formula/luciddb.rb b/Library/Formula/luciddb.rb index 47aab716c..f77714433 100644 --- a/Library/Formula/luciddb.rb +++ b/Library/Formula/luciddb.rb @@ -27,11 +27,11 @@ class Luciddb < Formula        n = Pathname.new(b).basename        (bin+n).write shim_script(n)      end -    plist_path.write luciddb_startup_plist(java_home) -    plist_path.chmod 0644    end -  def luciddb_startup_plist(java_home); <<-EOPLIST.undent +  plist_options :manual => "lucidDbServer" + +  def plist; <<-EOS.undent      <?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"> @@ -45,7 +45,7 @@ class Luciddb < Formula        <key>EnvironmentVariables</key>        <dict>          <key>JAVA_HOME</key> -        <string>#{java_home}</string> +        <string>#{`/usr/libexec/java_home`.chomp!}</string>        </dict>        <key>ProgramArguments</key>        <array> @@ -59,22 +59,6 @@ class Luciddb < Formula        <string>/dev/null</string>      </dict>      </plist> -    EOPLIST +    EOS    end - -  def caveats; <<-EOS.undent -    If this is your first install: -      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} - -    Or start the server manually by typing: -      lucidDbServer -   EOS - end  end diff --git a/Library/Formula/mariadb.rb b/Library/Formula/mariadb.rb index b0a5975fa..076ca821e 100644 --- a/Library/Formula/mariadb.rb +++ b/Library/Formula/mariadb.rb @@ -110,27 +110,12 @@ class Mariadb < Formula      Set up databases with:          unset TMPDIR          mysql_install_db --user=\`whoami\` --basedir="$(brew --prefix mariadb)" --datadir=#{var}/mysql --tmpdir=/tmp - -    If this is your first install, automatically load on login with: -        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} - -    Note on upgrading: -        We overwrite any existing #{plist_path.basename} in ~/Library/LaunchAgents -        if we are upgrading because previous versions of this brew created the -        plist with a version specific program argument. - -    Or start manually with: -        mysql.server start      EOS    end -  def startup_plist; <<-EOPLIST.undent +  plist_options :manual => "mysql.server start" + +  def plist; <<-EOS.undent      <?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"> @@ -149,7 +134,7 @@ class Mariadb < Formula        <string>#{var}</string>      </dict>      </plist> -    EOPLIST +    EOS    end  end diff --git a/Library/Formula/memcached.rb b/Library/Formula/memcached.rb index b45957413..b5a26fc60 100644 --- a/Library/Formula/memcached.rb +++ b/Library/Formula/memcached.rb @@ -19,46 +19,29 @@ class Memcached < Formula      system "make install"    end -  def caveats; <<-EOS.undent -    You can enable memcached to 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} - -    Or start it manually: -        #{HOMEBREW_PREFIX}/bin/memcached - -    Add "-d" to start it as a daemon. +  plist_options :manual => "#{HOMEBREW_PREFIX}/opt/memcached/bin/memcached" + +  def plist; <<-EOS.undent +    <?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>KeepAlive</key> +      <true/> +      <key>ProgramArguments</key> +      <array> +        <string>#{opt_prefix}/bin/memcached</string> +        <string>-l</string> +        <string>localhost</string> +      </array> +      <key>RunAtLoad</key> +      <true/> +      <key>WorkingDirectory</key> +      <string>#{HOMEBREW_PREFIX}</string> +    </dict> +    </plist>      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>KeepAlive</key> -  <true/> -  <key>ProgramArguments</key> -  <array> -    <string>#{HOMEBREW_PREFIX}/bin/memcached</string> -    <string>-l</string> -    <string>localhost</string> -  </array> -  <key>RunAtLoad</key> -  <true/> -  <key>WorkingDirectory</key> -  <string>#{HOMEBREW_PREFIX}</string> -</dict> -</plist> -    EOPLIST -  end  end diff --git a/Library/Formula/mongodb.rb b/Library/Formula/mongodb.rb index 76cfe4d90..962d19237 100644 --- a/Library/Formula/mongodb.rb +++ b/Library/Formula/mongodb.rb @@ -55,34 +55,6 @@ class Mongodb < Formula      etc.install prefix+'mongod.conf' unless File.exists? etc+"mongod.conf"    end -  def caveats -    bn = plist_path.basename -    la = Pathname.new("#{ENV['HOME']}/Library/LaunchAgents") -    prettypath = "~/Library/LaunchAgents/#{bn}" -    domain = plist_path.basename('.plist') -    load = "launchctl load -w #{prettypath}" -    s = [] - -    # we readlink because this path probably doesn't exist since caveats -    # occurs before the link step of installation -    if not (la/bn).file? -      s << "To have launchd start #{name} at login:" -      s << "    mkdir -p ~/Library/LaunchAgents" unless la.directory? -      s << "    ln -s #{HOMEBREW_PREFIX}/opt/#{name}/*.plist ~/Library/LaunchAgents/" -      s << "Then to load #{name} now:" -      s << "    #{load}" -      s << "Or, if you don't want/need launchctl, you can just run:" -      s << "    mongod" -    elsif Kernel.system "/bin/launchctl list #{domain} &>/dev/null" -      s << "You should reload #{name}:" -      s << "    launchctl unload -w #{prettypath}" -      s << "    #{load}" -    else -      s << "To load #{name}:" -      s << "    #{load}" -    end -  end -    def mongodb_conf; <<-EOS.undent      # Store data in #{var}/mongodb instead of the default /data/db      dbpath = #{var}/mongodb @@ -96,35 +68,36 @@ class Mongodb < Formula      EOS    end -  def startup_plist -    return <<-EOS -<?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>ProgramArguments</key> -  <array> -    <string>#{opt_prefix}/mongod</string> -    <string>run</string> -    <string>--config</string> -    <string>#{etc}/mongod.conf</string> -  </array> -  <key>RunAtLoad</key> -  <true/> -  <key>KeepAlive</key> -  <false/> -  <key>UserName</key> -  <string>#{`whoami`.chomp}</string> -  <key>WorkingDirectory</key> -  <string>#{HOMEBREW_PREFIX}</string> -  <key>StandardErrorPath</key> -  <string>#{var}/log/mongodb/output.log</string> -  <key>StandardOutPath</key> -  <string>#{var}/log/mongodb/output.log</string> -</dict> -</plist> -EOS +  plist_options :manual => "mongod" + +  def plist; <<-EOS.undent +    <?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>ProgramArguments</key> +      <array> +        <string>#{opt_prefix}/mongod</string> +        <string>run</string> +        <string>--config</string> +        <string>#{etc}/mongod.conf</string> +      </array> +      <key>RunAtLoad</key> +      <true/> +      <key>KeepAlive</key> +      <false/> +      <key>UserName</key> +      <string>#{`whoami`.chomp}</string> +      <key>WorkingDirectory</key> +      <string>#{HOMEBREW_PREFIX}</string> +      <key>StandardErrorPath</key> +      <string>#{var}/log/mongodb/output.log</string> +      <key>StandardOutPath</key> +      <string>#{var}/log/mongodb/output.log</string> +    </dict> +    </plist> +    EOS    end  end diff --git a/Library/Formula/mosquitto.rb b/Library/Formula/mosquitto.rb index ff123d539..c5850742b 100644 --- a/Library/Formula/mosquitto.rb +++ b/Library/Formula/mosquitto.rb @@ -33,19 +33,6 @@ class Mosquitto < Formula          You can make changes to the configuration by editing          #{etc}/mosquitto/mosquitto.conf -    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} - -    Start the broker manually by running: -        mosquitto -c #{etc}/mosquitto/mosquitto.conf -      Python client bindings can be installed from the Python Package Index          pip install mosquitto @@ -54,31 +41,31 @@ class Mosquitto < Formula        EOD    end -  def startup_plist -    return <<-EOS -<?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>ProgramArguments</key> -  <array> -    <string>#{HOMEBREW_PREFIX}/sbin/mosquitto</string> -    <string>-c</string> -    <string>#{etc}/mosquitto/mosquitto.conf</string> -  </array> -  <key>RunAtLoad</key> -  <true/> -  <key>KeepAlive</key> -  <false/> -  <key>UserName</key> -  <string>#{`whoami`.chomp}</string> -  <key>WorkingDirectory</key> -  <string>#{var}/mosquitto</string> -</dict> -</plist> -EOS -  end +  plist_options :manual => "mosquitto -c #{HOMEBREW_PREFIX}/etc/mosquitto/mosquitto.conf" +  def plist; <<-EOS.undent +    <?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>ProgramArguments</key> +      <array> +        <string>#{opt_prefix}/sbin/mosquitto</string> +        <string>-c</string> +        <string>#{etc}/mosquitto/mosquitto.conf</string> +      </array> +      <key>RunAtLoad</key> +      <true/> +      <key>KeepAlive</key> +      <false/> +      <key>UserName</key> +      <string>#{`whoami`.chomp}</string> +      <key>WorkingDirectory</key> +      <string>#{var}/mosquitto</string> +    </dict> +    </plist> +    EOS +  end  end diff --git a/Library/Formula/mysql-cluster.rb b/Library/Formula/mysql-cluster.rb index 5e4eeb5fc..0035dc024 100644 --- a/Library/Formula/mysql-cluster.rb +++ b/Library/Formula/mysql-cluster.rb @@ -206,7 +206,7 @@ class MysqlCluster < Formula      (extra) ? super().dirname+(plist_name(extra)+'.plist') : super()    end -  def mysqld_startup_plist(name); <<-EOPLIST.undent +  def mysqld_startup_plist(name); <<-EOS.undent      <?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"> @@ -228,10 +228,10 @@ class MysqlCluster < Formula        <string>#{var}</string>      </dict>      </plist> -    EOPLIST +    EOS    end -  def ndb_mgmd_startup_plist(name); <<-EOPLIST.undent +  def ndb_mgmd_startup_plist(name); <<-EOS.undent      <?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"> @@ -259,10 +259,10 @@ class MysqlCluster < Formula        <string>#{var}/mysql-cluster/#{name}.log</string>      </dict>      </plist> -    EOPLIST +    EOS    end -  def ndbd_startup_plist(name); <<-EOPLIST.undent +  def ndbd_startup_plist(name); <<-EOS.undent      <?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"> @@ -288,7 +288,7 @@ class MysqlCluster < Formula        <string>#{var}/mysql-cluster/#{name}.log</string>      </dict>      </plist> -    EOPLIST +    EOS    end  end diff --git a/Library/Formula/mysql.rb b/Library/Formula/mysql.rb index c3eb93f07..8d7ad600c 100644 --- a/Library/Formula/mysql.rb +++ b/Library/Formula/mysql.rb @@ -121,34 +121,17 @@ class Mysql < Formula      To run as, for instance, user "mysql", you may need to `sudo`:          sudo mysql_install_db ...options... -    Start mysqld manually with: -        mysql.server start - -        Note: if this fails, you probably forgot to run the first two steps up above -      A "/etc/my.cnf" from another install may interfere with a Homebrew-built      server starting up correctly.      To connect:          mysql -uroot - -    To launch on startup: -    * if this is your first install: -        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} - -    You may also need to edit the plist to use the correct "UserName". -      EOS    end -  def startup_plist; <<-EOPLIST.undent +  plist_options :manual => "mysql.server start" + +  def plist; <<-EOS.undent      <?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"> @@ -158,7 +141,7 @@ class Mysql < Formula        <key>Label</key>        <string>#{plist_name}</string>        <key>Program</key> -      <string>#{HOMEBREW_PREFIX}/bin/mysqld_safe</string> +      <string>#{opt_prefix}/bin/mysqld_safe</string>        <key>RunAtLoad</key>        <true/>        <key>UserName</key> @@ -167,6 +150,6 @@ class Mysql < Formula        <string>#{var}</string>      </dict>      </plist> -    EOPLIST +    EOS    end  end diff --git a/Library/Formula/nagios.rb b/Library/Formula/nagios.rb index 37a1c1886..da3743fbc 100644 --- a/Library/Formula/nagios.rb +++ b/Library/Formula/nagios.rb @@ -38,12 +38,12 @@ class Nagios < Formula      # Install config      system "make install-config"      system "make install-webconf" -    (share+plist_path).write startup_plist      mkdir HOMEBREW_PREFIX+'var/lib/nagios/rw' unless File.exists? HOMEBREW_PREFIX+'var/lib/nagios/rw'    end -  def startup_plist -    <<-EOS.undent +  plist_options :startup => true, :manual => "nagios #{HOMEBREW_PREFIX}/etc/nagios.cfg" + +  def plist; <<-EOS.undent      <?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"> @@ -54,7 +54,7 @@ class Nagios < Formula              <string>#{plist_name}</string>              <key>ProgramArguments</key>              <array> -                    <string>#{HOMEBREW_PREFIX}/bin/nagios</string> +                    <string>#{opt_prefix}/bin/nagios</string>                      <string>#{nagios_etc}/nagios.cfg</string>              </array>              <key>RunAtLoad</key> @@ -70,8 +70,7 @@ class Nagios < Formula      EOS    end -  def caveats -    <<-EOS.undent +  def caveats; <<-EOS.undent      First we need to create a command dir using superhuman powers:        mkdir -p #{nagios_var}/rw @@ -93,16 +92,7 @@ class Nagios < Formula          htpasswd -cs #{nagios_etc}/htpasswd.users nagiosadmin          sudo apachectl restart -    If you want to run nagios automatically at startup: - -      sudo cp #{share}/#{plist_path.basename} /Library/LaunchDaemons/ -      sudo launchctl load -w /Library/LaunchDaemons/#{plist_path.basename} - -    ...or simply run it on demand: - -      nagios #{nagios_etc}/nagios.cfg - -    Now log in with your web account (and don't forget to RTFM :-) +    Log in with your web account (and don't forget to RTFM :-)        open http://localhost/nagios diff --git a/Library/Formula/nginx.rb b/Library/Formula/nginx.rb index a05b9091e..178f09b10 100644 --- a/Library/Formula/nginx.rb +++ b/Library/Formula/nginx.rb @@ -81,7 +81,7 @@ class Nginx < Formula      EOS    end -  def startup_plist; <<-EOS.undent +  def plist; <<-EOS.undent      <?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"> diff --git a/Library/Formula/offline-imap.rb b/Library/Formula/offline-imap.rb index cc40b5cfe..26ffc9b40 100644 --- a/Library/Formula/offline-imap.rb +++ b/Library/Formula/offline-imap.rb @@ -21,23 +21,10 @@ class OfflineImap < Formula      * advanced configuration:          cp -n #{prefix}/offlineimap.conf ~/.offlineimaprc - - -    To launch on startup and run every 5 minutes: -    * if this is your first install: -        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 -  def startup_plist; <<-EOPLIST.undent +  def plist; <<-EOS.undent      <?xml version="1.0" encoding="UTF-8"?>      <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">      <plist version="1.0"> @@ -48,7 +35,7 @@ class OfflineImap < Formula          <string>#{plist_name}</string>          <key>ProgramArguments</key>          <array> -          <string>#{HOMEBREW_PREFIX}/bin/offlineimap</string> +          <string>#{opt_prefix}/bin/offlineimap</string>          </array>          <key>StartInterval</key>          <integer>300</integer> @@ -60,6 +47,6 @@ class OfflineImap < Formula          <string>/dev/null</string>        </dict>      </plist> -    EOPLIST +    EOS    end  end diff --git a/Library/Formula/openvpn.rb b/Library/Formula/openvpn.rb index b04633d27..54f231a53 100644 --- a/Library/Formula/openvpn.rb +++ b/Library/Formula/openvpn.rb @@ -36,64 +36,51 @@ class Openvpn < Formula      (var + 'run/openvpn').mkpath    end -  def caveats; <<-EOS -You may also wish to install tuntap: +  def caveats; <<-EOS.undent +    You may also wish to install tuntap: -  The TunTap project provides kernel extensions for Mac OS X that allow -  creation of virtual network interfaces. +      The TunTap project provides kernel extensions for Mac OS X that allow +      creation of virtual network interfaces. -  http://tuntaposx.sourceforge.net/ +      http://tuntaposx.sourceforge.net/ -Because these are kernel extensions, there is no Homebrew formula for tuntap. +    Because these are kernel extensions, there is no Homebrew formula for tuntap. - -For OpenVPN to work as a server, you will need to do the following: - -1) Create configuration file in #{etc}/openvpn, samples can be -   found in #{share}/doc/openvpn - -2) Install the launchd item in /Library/LaunchDaemons, like so: - -   sudo cp -vf #{plist_path} /Library/LaunchDaemons/. -   sudo chown -v root:wheel /Library/LaunchDaemons/#{plist_path.basename} - -3) Start the daemon using: - -   sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename} - -Next boot of system will automatically start OpenVPN. -EOS +    For OpenVPN to work as a server, you will need to create configuration file +    in #{etc}/openvpn, samples can be found in #{share}/doc/openvpn +    EOS    end -  def startup_plist -    return <<-EOS -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//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>ProgramArguments</key> -  <array> -    <string>#{HOMEBREW_PREFIX}/sbin/openvpn</string> -    <string>--config</string> -    <string>#{etc}/openvpn/openvpn.conf</string> -  </array> -  <key>OnDemand</key> -  <false/> -  <key>RunAtLoad</key> -  <true/> -  <key>TimeOut</key> -  <integer>90</integer> -  <key>WatchPaths</key> -  <array> -    <string>#{etc}/openvpn</string> -  </array> -  <key>WorkingDirectory</key> -  <string>#{etc}/openvpn</string> -</dict> -</plist> -EOS +  plist_options :startup => true + +  def plist; <<-EOS.undent +    <?xml version="1.0" encoding="UTF-8"?> +    <!DOCTYPE plist PUBLIC "-//Apple Computer//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>ProgramArguments</key> +      <array> +        <string>#{opt_prefix}/sbin/openvpn</string> +        <string>--config</string> +        <string>#{etc}/openvpn/openvpn.conf</string> +      </array> +      <key>OnDemand</key> +      <false/> +      <key>RunAtLoad</key> +      <true/> +      <key>TimeOut</key> +      <integer>90</integer> +      <key>WatchPaths</key> +      <array> +        <string>#{etc}/openvpn</string> +      </array> +      <key>WorkingDirectory</key> +      <string>#{etc}/openvpn</string> +    </dict> +    </plist> +    EOS    end  end diff --git a/Library/Formula/percona-server.rb b/Library/Formula/percona-server.rb index fd5e391bd..9dfc76eeb 100644 --- a/Library/Formula/percona-server.rb +++ b/Library/Formula/percona-server.rb @@ -118,34 +118,17 @@ class PerconaServer < Formula      To run as, for instance, user "mysql", you may need to `sudo`:          sudo mysql_install_db ...options... -    Start mysqld manually with: -        mysql.server start - -        Note: if this fails, you probably forgot to run the first two steps up above -      A "/etc/my.cnf" from another install may interfere with a Homebrew-built      server starting up correctly.      To connect:          mysql -uroot - -    To launch on startup: -    * if this is your first install: -        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} - -    You may also need to edit the plist to use the correct "UserName". -      EOS    end -  def startup_plist; <<-EOPLIST.undent +  plist_options :manual => 'mysql.server start' + +  def plist; <<-EOS.undent      <?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"> @@ -155,7 +138,7 @@ class PerconaServer < Formula        <key>Label</key>        <string>#{plist_name}</string>        <key>Program</key> -      <string>#{HOMEBREW_PREFIX}/bin/mysqld_safe</string> +      <string>#{opt_prefix}/bin/mysqld_safe</string>        <key>RunAtLoad</key>        <true/>        <key>UserName</key> @@ -164,6 +147,6 @@ class PerconaServer < Formula        <string>#{var}</string>      </dict>      </plist> -    EOPLIST +    EOS    end  end diff --git a/Library/Formula/perforce-proxy.rb b/Library/Formula/perforce-proxy.rb index 79752fd18..f2b9d84a9 100644 --- a/Library/Formula/perforce-proxy.rb +++ b/Library/Formula/perforce-proxy.rb @@ -22,24 +22,13 @@ class PerforceProxy < Formula      To use the Perforce proxy to access your Perforce server, set your P4PORT      environment variable to "localhost:1666". -    To launch on startup: -    * if this is your first install: -        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} -      Before starting the proxy server, you probably need to edit the plist to use      the correct host and port for your Perforce server (replacing the default      perforce:1666).      EOS    end -  def startup_plist; <<-EOPLIST.undent +  def plist; <<-EOS.undent      <?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"> @@ -48,7 +37,7 @@ class PerforceProxy < Formula        <string>#{plist_name}</string>        <key>ProgramArguments</key>        <array> -        <string>#{HOMEBREW_PREFIX}/sbin/p4p</string> +        <string>#{opt_prefix}/sbin/p4p</string>          <string>-p</string>          <string>1666</string>          <string>-r</string> @@ -66,6 +55,6 @@ class PerforceProxy < Formula        <string>#{var}/p4p</string>      </dict>      </plist> -    EOPLIST +    EOS    end  end diff --git a/Library/Formula/pgbouncer.rb b/Library/Formula/pgbouncer.rb index 3d332edda..1c891a678 100644 --- a/Library/Formula/pgbouncer.rb +++ b/Library/Formula/pgbouncer.rb @@ -21,56 +21,42 @@ class Pgbouncer < Formula      etc.install %w(etc/pgbouncer.ini etc/userlist.txt)    end -  def caveats -    s = <<-EOS -The config file: #{etc}/pgbouncer.ini is in the "ini" format and you -will need to edit it for your particular setup. See: -http://pgbouncer.projects.postgresql.org/doc/config.html +  def caveats; <<-EOS.undent +    The config file: #{etc}/pgbouncer.ini is in the "ini" format and you +    will need to edit it for your particular setup. See: +    http://pgbouncer.projects.postgresql.org/doc/config.html -The auth_file option should point to the #{etc}/userlist.txt file which -can be populated by the #{bin}/mkauth.py script. - -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} - -Or start manually with: -    pgbouncer -q #{etc}/pgbouncer.ini +    The auth_file option should point to the #{etc}/userlist.txt file which +    can be populated by the #{bin}/mkauth.py script.      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>KeepAlive</key> -  <true/> -  <key>Label</key> -  <string>#{plist_name}</string> -  <key>ProgramArguments</key> -  <array> -    <string>#{HOMEBREW_PREFIX}/bin/pgbouncer</string> -    <string>-d</string> -    <string>-q</string> -    <string>#{etc}/pgbouncer.ini</string> -  </array> -  <key>RunAtLoad</key> -  <true/> -  <key>UserName</key> -  <string>#{`whoami`.chomp}</string> -  <key>WorkingDirectory</key> -  <string>#{HOMEBREW_PREFIX}</string> -</dict> -</plist> -    EOPLIST +  plist_options :manual => "pgbouncer -q #{HOMEBREW_PREFIX}/etc/pgbouncer.ini" + +  def plist; <<-EOS.undent +      <?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>KeepAlive</key> +        <true/> +        <key>Label</key> +        <string>#{plist_name}</string> +        <key>ProgramArguments</key> +        <array> +          <string>#{opt_prefix}/bin/pgbouncer</string> +          <string>-d</string> +          <string>-q</string> +          <string>#{etc}/pgbouncer.ini</string> +        </array> +        <key>RunAtLoad</key> +        <true/> +        <key>UserName</key> +        <string>#{`whoami`.chomp}</string> +        <key>WorkingDirectory</key> +        <string>#{HOMEBREW_PREFIX}</string> +      </dict> +      </plist> +    EOS    end  end diff --git a/Library/Formula/pincaster.rb b/Library/Formula/pincaster.rb index 256aa5fb0..03f01c37d 100644 --- a/Library/Formula/pincaster.rb +++ b/Library/Formula/pincaster.rb @@ -18,43 +18,34 @@ class Pincaster < Formula      (var+"db/pincaster/").mkpath    end -  def caveats -    <<-EOS.undent -      Automatically load on login with: -        launchctl load -w #{plist_path} +  plist_options :manual => "pincaster #{HOMEBREW_PREFIX}/etc/pincaster.conf" -      To start pincaster manually: -        pincaster #{etc}/pincaster.conf +  def plist; <<-EOS.undent +    <?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>KeepAlive</key> +        <true/> +        <key>Label</key> +        <string>#{plist_name}</string> +        <key>ProgramArguments</key> +        <array> +          <string>#{opt_prefix}/bin/pincaster</string> +          <string>#{etc}/pincaster.conf</string> +        </array> +        <key>RunAtLoad</key> +        <true/> +        <key>UserName</key> +        <string>#{`whoami`.chomp}</string> +        <key>WorkingDirectory</key> +        <string>#{var}</string> +        <key>StandardErrorPath</key> +        <string>#{var}/log/pincaster.log</string> +        <key>StandardOutPath</key> +        <string>#{var}/log/pincaster.log</string> +      </dict> +    </plist>      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>KeepAlive</key> -    <true/> -    <key>Label</key> -    <string>#{plist_name}</string> -    <key>ProgramArguments</key> -    <array> -      <string>#{HOMEBREW_PREFIX}/bin/pincaster</string> -      <string>#{etc}/pincaster.conf</string> -    </array> -    <key>RunAtLoad</key> -    <true/> -    <key>UserName</key> -    <string>#{`whoami`.chomp}</string> -    <key>WorkingDirectory</key> -    <string>#{var}</string> -    <key>StandardErrorPath</key> -    <string>#{var}/log/pincaster.log</string> -    <key>StandardOutPath</key> -    <string>#{var}/log/pincaster.log</string> -  </dict> -</plist> -    EOPLIST -  end  end diff --git a/Library/Formula/polipo.rb b/Library/Formula/polipo.rb index b93d95382..0610563cf 100644 --- a/Library/Formula/polipo.rb +++ b/Library/Formula/polipo.rb @@ -21,39 +21,25 @@ class Polipo < Formula      system "make", "install", *args    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} +  def plist; <<-EOS.undent +    <?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>#{opt_prefix}/bin/polipo</string> +        </array> +      </dict> +    </plist>      EOS    end  end diff --git a/Library/Formula/postgresql.rb b/Library/Formula/postgresql.rb index a39e7a5a5..2b1b37a32 100644 --- a/Library/Formula/postgresql.rb +++ b/Library/Formula/postgresql.rb @@ -92,112 +92,113 @@ class Postgresql < Formula    end    def caveats -    s = <<-EOS -# Build Notes +    s = <<-EOS.undent +    # Build Notes -If builds of PostgreSQL 9 are failing and you have version 8.x installed, -you may need to remove the previous version first. See: -  https://github.com/mxcl/homebrew/issues/issue/2510 +    If builds of PostgreSQL 9 are failing and you have version 8.x installed, +    you may need to remove the previous version first. See: +      https://github.com/mxcl/homebrew/issues/issue/2510 -To build plpython against a specific Python, set PYTHON prior to brewing: -  PYTHON=/usr/local/bin/python  brew install postgresql -See: -  http://www.postgresql.org/docs/9.2/static/install-procedure.html +    To build plpython against a specific Python, set PYTHON prior to brewing: +      PYTHON=/usr/local/bin/python  brew install postgresql +    See: +      http://www.postgresql.org/docs/9.2/static/install-procedure.html -# Create/Upgrade a Database +    # Create/Upgrade a Database -If this is your first install, create a database with: -  initdb #{var}/postgres -E utf8 +    If this is your first install, create a database with: +      initdb #{var}/postgres -E utf8 -To migrate existing data from a previous major version (pre-9.2) of PostgreSQL, see: -  http://www.postgresql.org/docs/9.2/static/upgrading.html +    To migrate existing data from a previous major version (pre-9.2) of PostgreSQL, see: +      http://www.postgresql.org/docs/9.2/static/upgrading.html -# Start/Stop PostgreSQL +    # Start/Stop PostgreSQL -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 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} +    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} -Or start manually with: -  pg_ctl -D #{var}/postgres -l #{var}/postgres/server.log start +    Or start manually with: +      pg_ctl -D #{var}/postgres -l #{var}/postgres/server.log start -And stop with: -  pg_ctl -D #{var}/postgres stop -s -m fast +    And stop with: +      pg_ctl -D #{var}/postgres stop -s -m fast -# Loading Extensions +    # Loading Extensions -By default, Homebrew builds all available Contrib extensions.  To see a list of all -available extensions, from the psql command line, run: -  SELECT * FROM pg_available_extensions; +    By default, Homebrew builds all available Contrib extensions.  To see a list of all +    available extensions, from the psql command line, run: +      SELECT * FROM pg_available_extensions; -To load any of the extension names, navigate to the desired database and run: -  CREATE EXTENSION [extension name]; +    To load any of the extension names, navigate to the desired database and run: +      CREATE EXTENSION [extension name]; -For instance, to load the tablefunc extension in the current database, run: -  CREATE EXTENSION tablefunc; +    For instance, to load the tablefunc extension in the current database, run: +      CREATE EXTENSION tablefunc; -For more information on the CREATE EXTENSION command, see: -  http://www.postgresql.org/docs/9.2/static/sql-createextension.html -For more information on extensions, see: -  http://www.postgresql.org/docs/9.2/static/contrib.html +    For more information on the CREATE EXTENSION command, see: +      http://www.postgresql.org/docs/9.2/static/sql-createextension.html +    For more information on extensions, see: +      http://www.postgresql.org/docs/9.2/static/contrib.html -# Other +    # Other -Some machines may require provisioning of shared memory: -  http://www.postgresql.org/docs/9.2/static/kernel-resources.html#SYSVIPC -EOS +    Some machines may require provisioning of shared memory: +      http://www.postgresql.org/docs/9.2/static/kernel-resources.html#SYSVIPC +    EOS      if MacOS.prefer_64_bit? then -      s << <<-EOS +      s << <<-EOS.undent -To install postgresql (and ossp-uuid) in 32-bit mode: -   brew install postgresql --32-bit +      To install postgresql (and ossp-uuid) in 32-bit mode: +         brew install postgresql --32-bit -If you want to install the postgres gem, including ARCHFLAGS is recommended: -    env ARCHFLAGS="-arch x86_64" gem install pg +      If you want to install the postgres gem, including ARCHFLAGS is recommended: +          env ARCHFLAGS="-arch x86_64" gem install pg -To install gems without sudo, see the Homebrew wiki. +      To install gems without sudo, see the Homebrew wiki.        EOS      end      return s    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>KeepAlive</key> -  <true/> -  <key>Label</key> -  <string>#{plist_name}</string> -  <key>ProgramArguments</key> -  <array> -    <string>#{HOMEBREW_PREFIX}/bin/postgres</string> -    <string>-D</string> -    <string>#{var}/postgres</string> -    <string>-r</string> -    <string>#{var}/postgres/server.log</string> -  </array> -  <key>RunAtLoad</key> -  <true/> -  <key>UserName</key> -  <string>#{`whoami`.chomp}</string> -  <key>WorkingDirectory</key> -  <string>#{HOMEBREW_PREFIX}</string> -  <key>StandardErrorPath</key> -  <string>#{var}/postgres/server.log</string> -</dict> -</plist> -    EOPLIST +  plist_options :manual => "pg_ctl -D #{HOMEBREW_PREFIX}/var/postgres -l #{HOMEBREW_PREFIX}/var/postgres/server.log start" + +  def plist; <<-EOS.undent +    <?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>KeepAlive</key> +      <true/> +      <key>Label</key> +      <string>#{plist_name}</string> +      <key>ProgramArguments</key> +      <array> +        <string>#{opt_prefix}/bin/postgres</string> +        <string>-D</string> +        <string>#{var}/postgres</string> +        <string>-r</string> +        <string>#{var}/postgres/server.log</string> +      </array> +      <key>RunAtLoad</key> +      <true/> +      <key>UserName</key> +      <string>#{`whoami`.chomp}</string> +      <key>WorkingDirectory</key> +      <string>#{HOMEBREW_PREFIX}</string> +      <key>StandardErrorPath</key> +      <string>#{var}/postgres/server.log</string> +    </dict> +    </plist> +    EOS    end  end diff --git a/Library/Formula/pure-ftpd.rb b/Library/Formula/pure-ftpd.rb index d39abbe47..1c25caa92 100644 --- a/Library/Formula/pure-ftpd.rb +++ b/Library/Formula/pure-ftpd.rb @@ -31,48 +31,34 @@ class PureFtpd < Formula      system "make install"    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} +  plist_options :manual => 'pure-ftpd' -    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} - -    To start pure-ftpd manually: -      pure-ftpd <options> +  def plist; <<-EOS.undent +    <?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>KeepAlive</key> +        <true/> +        <key>Label</key> +        <string>#{plist_name}</string> +        <key>ProgramArguments</key> +        <array> +          <string>#{opt_prefix}/sbin/pure-ftpd</string> +          <string>-A -j -z</string> +        </array> +        <key>RunAtLoad</key> +        <true/> +        <key>UserName</key> +        <string>#{`whoami`.chomp}</string> +        <key>WorkingDirectory</key> +        <string>#{var}</string> +        <key>StandardErrorPath</key> +        <string>#{var}/log/pure-ftpd.log</string> +        <key>StandardOutPath</key> +        <string>#{var}/log/pure-ftpd.log</string> +      </dict> +    </plist>      EOS    end - -  def startup_plist; <<-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>KeepAlive</key> -    <true/> -    <key>Label</key> -    <string>#{plist_name}</string> -    <key>ProgramArguments</key> -    <array> -      <string>#{HOMEBREW_PREFIX}/sbin/pure-ftpd</string> -      <string>-A -j -z</string> -    </array> -    <key>RunAtLoad</key> -    <true/> -    <key>UserName</key> -    <string>#{`whoami`.chomp}</string> -    <key>WorkingDirectory</key> -    <string>#{var}</string> -    <key>StandardErrorPath</key> -    <string>#{var}/log/pure-ftpd.log</string> -    <key>StandardOutPath</key> -    <string>#{var}/log/pure-ftpd.log</string> -  </dict> -</plist> -    EOPLIST -  end  end diff --git a/Library/Formula/rabbitmq.rb b/Library/Formula/rabbitmq.rb index a2fc08cd0..443d361e5 100644 --- a/Library/Formula/rabbitmq.rb +++ b/Library/Formula/rabbitmq.rb @@ -36,65 +36,50 @@ class Rabbitmq < Formula    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} - +  def caveats; <<-EOS.undent      Management Plugin enabled by default at http://localhost:15672 - -    To start rabbitmq-server manually: -        rabbitmq-server      EOS    end -  def enabled_plugins -    return <<-EOS.undent +  def enabled_plugins; <<-EOS.undent        [rabbitmq_management,rabbitmq_management_visualiser].      EOS    end -  def rabbitmq_env -    return <<-EOS.undent +  def rabbitmq_env; <<-EOS.undent      CONFIG_FILE=#{etc}/rabbitmq/rabbitmq      NODE_IP_ADDRESS=127.0.0.1      NODENAME=rabbit@localhost      EOS    end -  def startup_plist -    return <<-EOPLIST -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//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>Program</key> -    <string>#{HOMEBREW_PREFIX}/sbin/rabbitmq-server</string> -    <key>RunAtLoad</key> -    <true/> -    <key>UserName</key> -    <string>#{`whoami`.chomp}</string> -    <key>EnvironmentVariables</key> -    <dict> -      <!-- need erl in the path --> -      <key>PATH</key> -      <string>/usr/local/sbin:/usr/bin:/bin:/usr/local/bin</string> -      <!-- specify the path to the rabbitmq-env.conf file --> -      <key>CONF_ENV_FILE</key> -      <string>#{etc}/rabbitmq/rabbitmq-env.conf</string> -    </dict> -  </dict> -</plist> -    EOPLIST +  plist_options :manual => 'rabbitmq-server' + +  def plist; <<-EOS.undent +    <?xml version="1.0" encoding="UTF-8"?> +    <!DOCTYPE plist PUBLIC "-//Apple Computer//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>Program</key> +        <string>#{opt_prefix}/sbin/rabbitmq-server</string> +        <key>RunAtLoad</key> +        <true/> +        <key>UserName</key> +        <string>#{`whoami`.chomp}</string> +        <key>EnvironmentVariables</key> +        <dict> +          <!-- need erl in the path --> +          <key>PATH</key> +          <string>/usr/local/sbin:/usr/bin:/bin:/usr/local/bin</string> +          <!-- specify the path to the rabbitmq-env.conf file --> +          <key>CONF_ENV_FILE</key> +          <string>#{etc}/rabbitmq/rabbitmq-env.conf</string> +        </dict> +      </dict> +    </plist> +    EOS    end  end diff --git a/Library/Formula/redis.rb b/Library/Formula/redis.rb index 77c53e02c..9f1323583 100644 --- a/Library/Formula/redis.rb +++ b/Library/Formula/redis.rb @@ -39,53 +39,34 @@ class Redis < Formula      etc.install 'redis.conf' unless (etc/'redis.conf').exist?    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} +  plist_options :manual => "redis-server #{HOMEBREW_PREFIX}/etc/redis.conf" -    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} - -      To start redis manually: -        redis-server #{etc}/redis.conf - -      To access the server: -        redis-cli +  def plist; <<-EOS.undent +    <?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>KeepAlive</key> +        <true/> +        <key>Label</key> +        <string>#{plist_name}</string> +        <key>ProgramArguments</key> +        <array> +          <string>#{opt_prefix}/bin/redis-server</string> +          <string>#{etc}/redis.conf</string> +        </array> +        <key>RunAtLoad</key> +        <true/> +        <key>UserName</key> +        <string>#{`whoami`.chomp}</string> +        <key>WorkingDirectory</key> +        <string>#{var}</string> +        <key>StandardErrorPath</key> +        <string>#{var}/log/redis.log</string> +        <key>StandardOutPath</key> +        <string>#{var}/log/redis.log</string> +      </dict> +    </plist>      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>KeepAlive</key> -    <true/> -    <key>Label</key> -    <string>#{plist_name}</string> -    <key>ProgramArguments</key> -    <array> -      <string>#{HOMEBREW_PREFIX}/bin/redis-server</string> -      <string>#{etc}/redis.conf</string> -    </array> -    <key>RunAtLoad</key> -    <true/> -    <key>UserName</key> -    <string>#{`whoami`.chomp}</string> -    <key>WorkingDirectory</key> -    <string>#{var}</string> -    <key>StandardErrorPath</key> -    <string>#{var}/log/redis.log</string> -    <key>StandardOutPath</key> -    <string>#{var}/log/redis.log</string> -  </dict> -</plist> -    EOPLIST -  end  end diff --git a/Library/Formula/scm-manager.rb b/Library/Formula/scm-manager.rb index 6328ea949..f954e6df5 100644 --- a/Library/Formula/scm-manager.rb +++ b/Library/Formula/scm-manager.rb @@ -39,38 +39,24 @@ class ScmManager < Formula      chmod 0755, scmCliClient    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} - -    Or start manually: -      scm-server start +  plist_options :manual => 'scm-server start' + +  def plist; <<-EOS.undent +    <?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>ProgramArguments</key> +        <array> +          <string>#{opt_prefix}/bin/scm-server</string> +          <string>start</string> +        </array> +        <key>RunAtLoad</key> +        <true/> +      </dict> +    </plist>      EOS    end - -def startup_plist; <<-EOS -<?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>ProgramArguments</key> -    <array> -      <string>#{bin}/scm-server</string> -      <string>start</string> -    </array> -    <key>RunAtLoad</key> -    <true/> -  </dict> -</plist> -EOS -  end  end diff --git a/Library/Formula/selenium-server-standalone.rb b/Library/Formula/selenium-server-standalone.rb index e0c6476eb..c40889b23 100644 --- a/Library/Formula/selenium-server-standalone.rb +++ b/Library/Formula/selenium-server-standalone.rb @@ -9,51 +9,35 @@ class SeleniumServerStandalone < Formula      prefix.install "selenium-server-standalone-#{version}.jar"    end -  def caveats; <<-EOS -    You can enable selenium-server to automatically load on login with: +  plist_options :manual => "java -jar #{HOMEBREW_PREFIX}/opt/selenium-server-standalone/selenium-server-standalone-#{version}.jar -p 4444" -      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} - -    Or start it manually with: -      java -jar #{prefix}/selenium-server-standalone-#{version}.jar -p 4444 -    EOS -  end - -  def startup_plist -    return <<-EOS -<?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> -        <false/> -        <key>ProgramArguments</key> -        <array> -                <string>/usr/bin/java</string> -                <string>-jar</string> -                <string>#{prefix}/selenium-server-standalone-#{version}.jar</string> -                <string>-port</string> -                <string>4444</string> -        </array> -        <key>ServiceDescription</key> -        <string>Selenium Server</string> -        <key>StandardErrorPath</key> -        <string>/var/log/selenium/selenium-error.log</string> -        <key>StandardOutPath</key> -        <string>/var/log/selenium/selenium-output.log</string> -</dict> -</plist> +  def plist; <<-EOS.undent +    <?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> +            <false/> +            <key>ProgramArguments</key> +            <array> +                    <string>/usr/bin/java</string> +                    <string>-jar</string> +                    <string>#{prefix}/selenium-server-standalone-#{version}.jar</string> +                    <string>-port</string> +                    <string>4444</string> +            </array> +            <key>ServiceDescription</key> +            <string>Selenium Server</string> +            <key>StandardErrorPath</key> +            <string>/var/log/selenium/selenium-error.log</string> +            <key>StandardOutPath</key> +            <string>/var/log/selenium/selenium-output.log</string> +    </dict> +    </plist>      EOS    end  end diff --git a/Library/Formula/ser2net.rb b/Library/Formula/ser2net.rb index 8c98439da..054de638e 100644 --- a/Library/Formula/ser2net.rb +++ b/Library/Formula/ser2net.rb @@ -19,49 +19,35 @@ class Ser2net < Formula    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 +  plist_options :manual => 'ser2net -p 12345' + +  def plist; <<-EOS.undent +    <?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>#{opt_prefix}/sbin/ser2net</string> +            <string>-p</string> +            <string>12345</string> +        </array> +        <key>WorkingDirectory</key> +        <string>#{HOMEBREW_PREFIX}</string> +      </dict> +    </plist> +    EOS    end  end diff --git a/Library/Formula/sickbeard.rb b/Library/Formula/sickbeard.rb index bb292c8ab..8aa747850 100644 --- a/Library/Formula/sickbeard.rb +++ b/Library/Formula/sickbeard.rb @@ -14,7 +14,9 @@ class Sickbeard < Formula      (bin+"sickbeard").write(startup_script)    end -  def startup_plist; <<-EOS.undent +  plist_options :manual => 'sickbeard' + +  def plist; <<-EOS.undent      <?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"> @@ -23,7 +25,7 @@ class Sickbeard < Formula        <string>#{plist_name}</string>        <key>ProgramArguments</key>        <array> -           <string>#{HOMEBREW_PREFIX}/bin/sickbeard</string> +           <string>#{opt_prefix}/bin/sickbeard</string>             <string>-q</string>             <string>--nolaunch</string>             <string>-p</string> @@ -60,20 +62,7 @@ class Sickbeard < Formula    end    def caveats; <<-EOS.undent -    SickBeard will start up and launch http://localhost:8081/ when you run: - -        sickbeard - -    To launch automatically on startup, copy and paste the following into a terminal: - -        mkdir -p ~/Library/LaunchAgents -        (launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename} 2>/dev/null || true) -        ln -sf #{plist_path} ~/Library/LaunchAgents/#{plist_path.basename} -        launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - -    You may want to edit: -      #{plist_path} -    to change the port (default: 8081) or user (default: #{`whoami`.chomp}). +    SickBeard defaults to port 8081.      EOS    end  end diff --git a/Library/Formula/sonar.rb b/Library/Formula/sonar.rb index 983c9dd6a..15bc5be2c 100644 --- a/Library/Formula/sonar.rb +++ b/Library/Formula/sonar.rb @@ -26,38 +26,24 @@ class Sonar < Formula      end    end -  def caveats; <<-EOS.undent -    If this is your first install, automatically load on login with: -      mkdir -p ~/Library/LaunchAgents -      ln -nfs #{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} -      launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - -    Or start it manually: -      #{HOMEBREW_PREFIX}/bin/sonar console +  plist_options :manual => "#{HOMEBREW_PREFIX}/opt/sonar/bin/sonar console" + +  def plist; <<-EOS.undent +    <?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>ProgramArguments</key> +        <array> +        <string>#{opt_prefix}/bin/sonar</string> +        <string>start</string> +        </array> +        <key>RunAtLoad</key> +        <true/> +    </dict> +    </plist>      EOS    end - -  def startup_plist -    return <<-EOS -<?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>ProgramArguments</key> -    <array> -    <string>#{HOMEBREW_PREFIX}/bin/sonar</string> -    <string>start</string> -    </array> -    <key>RunAtLoad</key> -    <true/> -</dict> -</plist> -EOS -  end  end diff --git a/Library/Formula/squid.rb b/Library/Formula/squid.rb index 8a775857a..650c8561c 100644 --- a/Library/Formula/squid.rb +++ b/Library/Formula/squid.rb @@ -35,24 +35,7 @@ class Squid < Formula      system "make install"    end -  def caveats; <<-EOS.undent - -    To launch on startup: - -      * if this is your first install: -          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 - -  def startup_plist; <<-EOPLIST.undent +  def plist; <<-EOS.undent      <?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"> @@ -63,7 +46,7 @@ class Squid < Formula        <string>#{plist_name}</string>        <key>ProgramArguments</key>        <array> -        <string>/usr/local/sbin/squid</string> +        <string>#{opt_prefix}/sbin/squid</string>          <string>-N</string>          <string>-d 1</string>          <string>-D</string> @@ -76,6 +59,6 @@ class Squid < Formula        <string>#{var}</string>      </dict>      </plist> -    EOPLIST +    EOS    end  end diff --git a/Library/Formula/sshguard.rb b/Library/Formula/sshguard.rb index 9c22848bc..52de534dc 100644 --- a/Library/Formula/sshguard.rb +++ b/Library/Formula/sshguard.rb @@ -19,40 +19,27 @@ class Sshguard < Formula      system "make install"    end -  def caveats; <<-EOS -1) Install the launchd item in /Library/LaunchDaemons, like so: - -   sudo cp -vf #{plist_path} /Library/LaunchDaemons/ -   sudo chown -v root:wheel /Library/LaunchDaemons/#{plist_path.basename} - -2) Start the daemon using: - -   sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename} - -   Next boot of system will automatically start sshguard. -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>KeepAlive</key> -  <true/> -  <key>ProgramArguments</key> -  <array> -    <string>#{HOMEBREW_PREFIX}/sbin/sshguard</string> -    <string>-l</string> -    <string>/var/log/secure.log</string> -  </array> -  <key>RunAtLoad</key> -  <true/> -</dict> -</plist> -EOPLIST +  plist_options :startup => true + +  def plist; <<-EOS +    <?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>KeepAlive</key> +      <true/> +      <key>ProgramArguments</key> +      <array> +        <string>#{opt_prefix}/sbin/sshguard</string> +        <string>-l</string> +        <string>/var/log/secure.log</string> +      </array> +      <key>RunAtLoad</key> +      <true/> +    </dict> +    </plist> +    EOS    end  end diff --git a/Library/Formula/tor.rb b/Library/Formula/tor.rb index 750938601..b94f78b54 100644 --- a/Library/Formula/tor.rb +++ b/Library/Formula/tor.rb @@ -12,36 +12,27 @@ class Tor < Formula      system "make install"    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}/bin/tor</string> -    </array> -    <key>WorkingDirectory</key> -    <string>#{HOMEBREW_PREFIX}</string> -  </dict> -</plist> -    EOPLIST -  end - -  def caveats; <<-EOS.undent -    You can start tor automatically on login with: -      mkdir -p ~/Library/LaunchAgents -      cp #{plist_path} ~/Library/LaunchAgents/ -      launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} +  def plist; <<-EOS.undent +    <?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>#{opt_prefix}/bin/tor</string> +        </array> +        <key>WorkingDirectory</key> +        <string>#{HOMEBREW_PREFIX}</string> +      </dict> +    </plist>      EOS    end  end diff --git a/Library/Formula/varnish.rb b/Library/Formula/varnish.rb index 83e4e4c74..c36669148 100644 --- a/Library/Formula/varnish.rb +++ b/Library/Formula/varnish.rb @@ -16,32 +16,7 @@ class Varnish < Formula      (var+'varnish').mkpath    end -  def caveats; <<-EOS.undent -    To launch on startup (port > 1024): -    * if this is your first install: -        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} - -    To launch on startup (port < 1024): -    * if this is your first install: -        sudo cp #{plist_path} /Library/LaunchAgents/ -        sudo launchctl load -w /Library/LaunchAgents/#{plist_path.basename} - -    * if this is an upgrade and you already have the #{plist_path.basename} loaded: -        sudo launchctl unload -w /Library/LaunchAgents/#{plist_path.basename} -        sudo cp #{plist_path} /Library/LaunchAgents/ -        sudo launchctl load -w /Library/LaunchAgents/#{plist_path.basename} - -    EOS -  end - -  def startup_plist; <<-EOPLIST.undent +  def plist; <<-EOS.undent        <?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"> @@ -50,7 +25,7 @@ class Varnish < Formula          <string>#{plist_name}</string>          <key>ProgramArguments</key>          <array> -          <string>#{HOMEBREW_PREFIX}/sbin/varnishd</string> +          <string>#{opt_prefix}/sbin/varnishd</string>            <string>-n</string>            <string>#{var}/varnish</string>            <string>-f</string> @@ -74,6 +49,6 @@ class Varnish < Formula          <string>#{var}/varnish/varnish.log</string>        </dict>        </plist> -    EOPLIST +    EOS    end  end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index b09dfb1c3..3f5f83ced 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -139,10 +139,13 @@ class Formula    def var; HOMEBREW_PREFIX+'var' end    # override this to provide a plist -  def startup_plist; nil; end +  def plist; nil; end +  alias :startup_plist :plist    # plist name, i.e. the name of the launchd service    def plist_name; 'homebrew.mxcl.'+name end    def plist_path; prefix+(plist_name+'.plist') end +  def plist_manual; self.class.plist_manual end +  def plist_startup; self.class.plist_startup end    def build      self.class.build @@ -633,6 +636,7 @@ private      end      attr_rw :homepage, :keg_only_reason, :skip_clean_all, :cc_failures +    attr_rw :plist_startup, :plist_manual      Checksum::TYPES.each do |cksum|        class_eval %Q{ @@ -717,6 +721,11 @@ private        build.add name, description      end +    def plist_options options +      @plist_startup = options[:startup] +      @plist_manual = options[:manual] +    end +      def conflicts_with formula, opts={}        dependencies.add ConflictRequirement.new(formula, name, opts)      end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 06c12ced6..4d25ead56 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -160,7 +160,6 @@ class FormulaInstaller      end      keg = Keg.new(f.prefix) -      if keg.completion_installed? :bash        ohai 'Caveats', <<-EOS.undent          Bash completion has been installed to: @@ -174,6 +173,45 @@ class FormulaInstaller            #{HOMEBREW_PREFIX}/share/zsh/site-functions          EOS      end + +    if f.plist or keg.plist_installed? +      if f.plist_startup and false +        destination = '/Library/LaunchDaemons' +      else +        destination = '~/Library/LaunchAgents' +      end + +      plist_filename = f.plist_path.basename +      plist_link = "#{destination}/#{plist_filename}" +      plist_domain = f.plist_path.basename('.plist') +      launchctl_load = "launchctl load -w #{plist_link}" +      destination_path = Pathname.new File.expand_path destination +      plist_path = destination_path/plist_filename +      s = [] + +      # we readlink because this path probably doesn't exist since caveats +      # occurs before the link step of installation +      if not (plist_path).file? and not (plist_path).symlink? +        s << "To have launchd start #{f.name} at login:" +        s << "    mkdir -p #{destination}" unless destination_path.directory? +        s << "    ln -sfv #{HOMEBREW_PREFIX}/opt/#{f.name}/*.plist #{destination}" #sudo +        s << "Then to load #{f.name} now:" +        s << "    #{launchctl_load}" +        if f.plist_manual +          s << "Or, if you don't want/need launchctl, you can just run:" +          s << "    #{f.plist_manual}" +        end +      elsif Kernel.system "/bin/launchctl list #{plist_domain} &>/dev/null" +        s << "You should reload #{f.name}:" +        s << "    launchctl unload -w #{plist_link}" +        s << "    #{launchctl_load}" +      else +        s << "To load #{f.name}:" +        s << "    #{launchctl_load}" +      end + +      ohai 'Caveats', s +    end    end    def finish @@ -288,12 +326,11 @@ class FormulaInstaller    end    def install_plist -    if f.startup_plist -      # A plist may already exist if we are installing from a bottle -      f.plist_path.unlink if f.plist_path.exist? -      f.plist_path.write f.startup_plist -      f.plist_path.chmod 0644 -    end +    return unless f.plist +    # A plist may already exist if we are installing from a bottle +    f.plist_path.unlink if f.plist_path.exist? +    f.plist_path.write f.plist +    f.plist_path.chmod 0644    end    def fix_install_names diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index d968a2fc4..0560b6f26 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -76,6 +76,12 @@ class Keg < Pathname      dir.directory? and not dir.children.length.zero?    end +  def plist_installed? +    Dir.chdir self do +      not Dir.glob("*.plist").empty? +    end +  end +    def version      require 'version'      Version.new(basename.to_s) | 
