diff options
Diffstat (limited to 'Library')
28 files changed, 205 insertions, 202 deletions
diff --git a/Library/Formula/cassandra.rb b/Library/Formula/cassandra.rb index b9810bfb3..70357b02d 100644 --- a/Library/Formula/cassandra.rb +++ b/Library/Formula/cassandra.rb @@ -31,15 +31,15 @@ class Cassandra < Formula prefix.install Dir["*.txt"] + Dir["{bin,interface,javadoc,lib/licenses}"] prefix.install Dir["lib/*.jar"] - (prefix+'org.apache.cassandra.plist').write startup_plist - (prefix+'org.apache.cassandra.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats; <<-EOS.undent If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/org.apache.cassandra.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.apache.cassandra.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} EOS end @@ -52,7 +52,7 @@ class Cassandra < Formula <true/> <key>Label</key> - <string>org.apache.cassandra</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> diff --git a/Library/Formula/couchdb-lucene.rb b/Library/Formula/couchdb-lucene.rb index 7b4d71dd8..c31088ee3 100644 --- a/Library/Formula/couchdb-lucene.rb +++ b/Library/Formula/couchdb-lucene.rb @@ -15,16 +15,16 @@ class CouchdbLucene < Formula system "mv couchdb-lucene-#{version}/* #{prefix}" (etc + "couchdb/local.d/couchdb-lucene.ini").write ini_file - (prefix+"couchdb-lucene.plist").write plist_file - (prefix+"couchdb-lucene.plist").chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats; <<-EOS.undent You can enable couchdb-lucene to automatically load on login with: mkdir -p ~/Library/LaunchAgents - cp "#{prefix}/couchdb-lucene.plist" ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/couchdb-lucene.plist + cp "#{plist_path}" ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} Or start it manually with: #{bin}/run @@ -44,7 +44,7 @@ _fti = {couch_httpd_external, handle_external_req, <<"fti">>} EOS end - def plist_file + def startup_plist return <<-EOS <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" @@ -52,7 +52,7 @@ EOS <plist version="1.0"> <dict> <key>Label</key> - <string>couchdb-lucene</string> + <string>#{plist_name}</string> <key>EnvironmentVariables</key> <dict> <key>HOME</key> diff --git a/Library/Formula/ddclient.rb b/Library/Formula/ddclient.rb index 5bba3ef76..64ed85254 100644 --- a/Library/Formula/ddclient.rb +++ b/Library/Formula/ddclient.rb @@ -36,8 +36,8 @@ class Ddclient < Formula (var + 'run/ddclient').mkpath # Write the launchd script - (prefix + 'org.ddclient.plist').write startup_plist - (prefix + 'org.ddclient.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats; <<-EOS @@ -51,21 +51,21 @@ For ddclient to work, you will need to do the following: 2) Install the launchd item in /Library/LaunchDaemons, like so: - sudo cp -vf #{prefix}/org.ddclient.plist /Library/LaunchDaemons/ - sudo chown -v root:wheel /Library/LaunchDaemons/org.ddclient.plist + 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/org.ddclient.plist + 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/org.ddclient.plist, +StartInterval (in seconds) in /Library/LaunchDaemons/#{plist_path.basename}, and then - sudo launchctl unload /Library/LaunchDaemons/org.ddclient.plist - sudo launchctl load /Library/LaunchDaemons/org.ddclient.plist + sudo launchctl unload /Library/LaunchDaemons/#{plist_path.basename} + sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename} EOS end @@ -76,7 +76,7 @@ EOS <plist version="1.0"> <dict> <key>Label</key> - <string>org.ddclient</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/sbin/ddclient</string> diff --git a/Library/Formula/denyhosts.rb b/Library/Formula/denyhosts.rb index 2527de54a..ad80f0e36 100644 --- a/Library/Formula/denyhosts.rb +++ b/Library/Formula/denyhosts.rb @@ -43,9 +43,8 @@ class Denyhosts < Formula ln_s libexec + 'denyhosts.py', sbin + 'denyhosts' ln_s libexec + 'daemon-control', sbin + 'daemon-control' - plist = prefix + 'org.denyhosts.cron.plist' - plist.write cron_plist - plist.chmod 0644 + plist_path.write cron_plist + plist_path.chmod 0644 end def cron_plist @@ -55,7 +54,7 @@ class Denyhosts < Formula <plist version="1.0"> <dict> <key>Label</key> - <string>org.denyhosts.cron</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/sbin/denyhosts</string> @@ -83,7 +82,7 @@ class Denyhosts < Formula /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 #{prefix}/org.denyhosts.cron.plist /Library/LaunchDaemons/ + sudo cp #{plist_path} /Library/LaunchDaemons/ EOS end diff --git a/Library/Formula/dnsmasq.rb b/Library/Formula/dnsmasq.rb index afc21c4da..681262de2 100644 --- a/Library/Formula/dnsmasq.rb +++ b/Library/Formula/dnsmasq.rb @@ -31,8 +31,8 @@ class Dnsmasq < Formula system "make install PREFIX=#{prefix}" prefix.install "dnsmasq.conf.example" - (prefix + "uk.org.thekelleys.dnsmasq.plist").write startup_plist - (prefix + "uk.org.thekelleys.dnsmasq.plist").chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats; <<-EOS.undent @@ -44,8 +44,8 @@ class Dnsmasq < Formula To load dnsmasq automatically on startup, install and load the provided launchd item as follows: - sudo cp #{prefix}/uk.org.thekelleys.dnsmasq.plist /Library/LaunchDaemons - sudo launchctl load -w /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist + sudo cp #{plist_path} /Library/LaunchDaemons + sudo launchctl load -w /Library/LaunchDaemons/#{plist_path.basename} EOS end @@ -55,7 +55,7 @@ class Dnsmasq < Formula <plist version="1.0"> <dict> <key>Label</key> - <string>uk.org.thekelleys.dnsmasq</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/sbin/dnsmasq</string> diff --git a/Library/Formula/dovecot.rb b/Library/Formula/dovecot.rb index d0908328b..d80124ff4 100644 --- a/Library/Formula/dovecot.rb +++ b/Library/Formula/dovecot.rb @@ -24,13 +24,13 @@ For Dovecot to work, you will need to do the following: 2) If required by the configuration above, create a dovecot user and group -3) possibly create a launchd item in /Library/LaunchDaemons/org.dovecot.plist, like so: +3) possibly create a launchd item in /Library/LaunchDaemons/#{plist_path.basename}, like so: <?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>org.dovecot</string> + <string>#{plist_name}</string> <key>OnDemand</key> <false/> <key>ProgramArguments</key> @@ -46,7 +46,7 @@ For Dovecot to work, you will need to do the following: </plist> Source: http://wiki.dovecot.org/LaunchdInstall -4) start the server using: sudo launchctl load /Library/LaunchDaemons/org.dovecot.plist +4) start the server using: sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename} EOS end end diff --git a/Library/Formula/elasticsearch.rb b/Library/Formula/elasticsearch.rb index 358d1d183..069c61571 100644 --- a/Library/Formula/elasticsearch.rb +++ b/Library/Formula/elasticsearch.rb @@ -48,24 +48,24 @@ class Elasticsearch < Formula end # Write .plist file for `launchd` - (prefix+'org.elasticsearch.plist').write startup_plist - (prefix+'org.elasticsearch.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats <<-EOS.undent If this is your first install, automatically load ElasticSearch on login with: mkdir -p ~/Library/LaunchAgents - ln -nfs #{prefix}/org.elasticsearch.plist ~/Library/LaunchAgents/ - launchctl load -wF ~/Library/LaunchAgents/org.elasticsearch.plist + ln -nfs #{plist_path} ~/Library/LaunchAgents/ + launchctl load -wF ~/Library/LaunchAgents/#{plist_path.basename} - If this is an upgrade and you already have the org.elasticsearch.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/org.elasticsearch.plist - ln -nfs #{prefix}/org.elasticsearch.plist ~/Library/LaunchAgents/ - launchctl load -wF ~/Library/LaunchAgents/org.elasticsearch.plist + If this is an upgrade and you already have the #{plist_path} loaded: + launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename} + ln -nfs #{plist_path} ~/Library/LaunchAgents/ + launchctl load -wF ~/Library/LaunchAgents/#{plist_path.basename} To stop the ElasticSearch daemon: - launchctl unload -wF ~/Library/LaunchAgents/org.elasticsearch.plist + launchctl unload -wF ~/Library/LaunchAgents/#{plist_path.basename} To start ElasticSearch manually: elasticsearch -f -D es.config=#{prefix}/config/elasticsearch.yml @@ -93,7 +93,7 @@ class Elasticsearch < Formula <key>KeepAlive</key> <true/> <key>Label</key> - <string>org.elasticsearch</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/bin/elasticsearch</string> diff --git a/Library/Formula/isc-dhcp.rb b/Library/Formula/isc-dhcp.rb index e857b63ed..8e480bb59 100644 --- a/Library/Formula/isc-dhcp.rb +++ b/Library/Formula/isc-dhcp.rb @@ -71,30 +71,30 @@ class IscDhcp < Formula end # sample launchd plists - (prefix+'org.isc.dhcpd.plist').write dhcpd_plist - (prefix+'org.isc.dhcpd.plist').chmod 0644 - (prefix+'org.isc.dhcpd6.plist').write dhcpd6_plist - (prefix+'org.isc.dhcpd6.plist').chmod 0644 + plist_path.write dhcpd_plist + plist_path.chmod 0644 + (prefix+'homebrew.mxcl.dhcpd6.plist').write dhcpd6_plist + (prefix+'homebrew.mxcl.dhcpd6.plist').chmod 0644 end def caveats <<-EOCAVEATS.undent - This install of dhcpd expects config files to be in /usr/local/etc. - All state files (leases and pids) are stored in /usr/local/var/dhcpd. + 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: - #{prefix}/org.isc.dhcpd.plist + #{plist_path} and: - #{prefix}/org.isc.dhcpd6.plist + #{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 org.isc.dhcpd.plist - launchctl load -w org.isc.dhcpd6.plist + 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. @@ -103,8 +103,8 @@ class IscDhcp < Formula Sample config files may be found in #{etc}. If you change the config, restart dhcpd with one or both of - launchctl stop org.isc.dhcpd - launchctl stop org.isc.dhcpd6 + launchctl stop #{plist_name} + launchctl stop homebrew.mxcl.dhcpd6 EOCAVEATS end @@ -115,7 +115,7 @@ class IscDhcp < Formula "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version='1.0'> <dict> - <key>Label</key><string>org.isc.dhcpd</string> + <key>Label</key><string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/sbin/dhcpd</string> @@ -137,7 +137,7 @@ class IscDhcp < Formula "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version='1.0'> <dict> - <key>Label</key><string>org.isc.dhcpd</string> + <key>Label</key><string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/sbin/dhcpd</string> diff --git a/Library/Formula/jenkins.rb b/Library/Formula/jenkins.rb index 31ccf11a2..e6af417cf 100644 --- a/Library/Formula/jenkins.rb +++ b/Library/Formula/jenkins.rb @@ -10,20 +10,20 @@ class Jenkins < Formula def install system "mvn clean install -pl war -am -DskipTests && mv war/target/jenkins.war ." if ARGV.build_head? lib.install "jenkins.war" - (prefix+'org.jenkins-ci.plist').write startup_plist - (prefix+'org.jenkins-ci.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats; <<-EOS If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/org.jenkins-ci.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.jenkins-ci.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} -If this is an upgrade and you already have the org.jenkins-ci.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/org.jenkins-ci.plist - cp #{prefix}/org.jenkins-ci.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.jenkins-ci.plist +If this is an upgrade and you already have the #{plist_path} 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: java -jar #{lib}/jenkins.war @@ -42,7 +42,7 @@ EOS <plist version="1.0"> <dict> <key>Label</key> - <string>Jenkins</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>/usr/bin/java</string> diff --git a/Library/Formula/mariadb.rb b/Library/Formula/mariadb.rb index e0727d27f..9473fb17f 100644 --- a/Library/Formula/mariadb.rb +++ b/Library/Formula/mariadb.rb @@ -65,8 +65,8 @@ class Mariadb < Formula (prefix+'mysql-test').rmtree unless ARGV.include? '--with-tests' # save 121MB! (prefix+'sql-bench').rmtree unless ARGV.include? '--with-bench' - (prefix+'com.mysql.mysqld.plist').write startup_plist - (prefix+'com.mysql.mysqld.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats; <<-EOS.undent @@ -75,16 +75,16 @@ class Mariadb < Formula mysql_install_db If this is your first install, automatically load on login with: - cp #{prefix}/com.mysql.mysqld.plist ~/Library/LaunchAgents - launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist + cp #{plist_path} ~/Library/LaunchAgents + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - If this is an upgrade and you already have the com.mysql.mysqld.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist - cp #{prefix}/com.mysql.mysqld.plist ~/Library/LaunchAgents - launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist + If this is an upgrade and you already have the #{plist_path} 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 com.mysql.mysqld.plist in ~/Library/LaunchAgents + We overwrite any existing #{plist_path} in ~/Library/LaunchAgents if we are upgrading because previous versions of this brew created the plist with a version specific program argument. @@ -101,7 +101,7 @@ class Mariadb < Formula <key>KeepAlive</key> <true/> <key>Label</key> - <string>com.mysql.mysqld</string> + <string>#{plist_name}</string> <key>Program</key> <string>#{HOMEBREW_PREFIX}/bin/mysqld_safe</string> <key>RunAtLoad</key> diff --git a/Library/Formula/memcached.rb b/Library/Formula/memcached.rb index a78f3bfaf..a347a19b7 100644 --- a/Library/Formula/memcached.rb +++ b/Library/Formula/memcached.rb @@ -22,20 +22,20 @@ class Memcached < Formula system "./configure", *args system "make install" - (prefix+'com.danga.memcached.plist').write startup_plist - (prefix+'com.danga.memcached.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats; <<-EOS.undent You can enable memcached to automatically load on login with: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/com.danga.memcached.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/com.danga.memcached.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - If this is an upgrade and you already have the com.danga.memcached.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/com.danga.memcached.plist - cp #{prefix}/com.danga.memcached.plist ~/Library/LaunchAgents/com.danga.memcached.plist - launchctl load -w ~/Library/LaunchAgents/com.danga.memcached.plist + If this is an upgrade and you already have the #{plist_path} loaded: + launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename} + cp #{plist_path} ~/Library/LaunchAgents/#{plist_path.basename} + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} Or start it manually: #{HOMEBREW_PREFIX}/bin/memcached @@ -51,7 +51,7 @@ class Memcached < Formula <plist version="1.0"> <dict> <key>Label</key> - <string>com.danga.memcached</string> + <string>#{plist_name}</string> <key>KeepAlive</key> <true/> <key>ProgramArguments</key> diff --git a/Library/Formula/mongodb.rb b/Library/Formula/mongodb.rb index cf3b66b6f..e9392b527 100644 --- a/Library/Formula/mongodb.rb +++ b/Library/Formula/mongodb.rb @@ -43,8 +43,8 @@ class Mongodb < Formula # Write the configuration files and launchd script (prefix+'mongod.conf').write mongodb_conf - (prefix+'org.mongodb.mongod.plist').write startup_plist - (prefix+'org.mongodb.mongod.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats @@ -52,13 +52,13 @@ class Mongodb < Formula s += <<-EOS.undent If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/org.mongodb.mongod.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - If this is an upgrade and you already have the org.mongodb.mongod.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plist - cp #{prefix}/org.mongodb.mongod.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist + If this is an upgrade and you already have the #{plist_path} 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: mongod run --config #{prefix}/mongod.conf @@ -118,7 +118,7 @@ class Mongodb < Formula <plist version="1.0"> <dict> <key>Label</key> - <string>org.mongodb.mongod</string> + <string>#{plist_path}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/bin/mongod</string> diff --git a/Library/Formula/mysql.rb b/Library/Formula/mysql.rb index 538a7c1c2..ed7fbb70c 100644 --- a/Library/Formula/mysql.rb +++ b/Library/Formula/mysql.rb @@ -75,8 +75,8 @@ class Mysql < Formula system "make" system "make install" - (prefix+'com.mysql.mysqld.plist').write startup_plist - (prefix+'com.mysql.mysqld.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 # Don't create databases inside of the prefix! # See: https://github.com/mxcl/homebrew/issues/4975 @@ -121,13 +121,13 @@ class Mysql < Formula To launch on startup: * if this is your first install: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/com.mysql.mysqld.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - * if this is an upgrade and you already have the com.mysql.mysqld.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist - cp #{prefix}/com.mysql.mysqld.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist + * if this is an upgrade and you already have the #{plist_path} 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". @@ -142,7 +142,7 @@ class Mysql < Formula <key>KeepAlive</key> <true/> <key>Label</key> - <string>com.mysql.mysqld</string> + <string>#{plist_name}</string> <key>Program</key> <string>#{HOMEBREW_PREFIX}/bin/mysqld_safe</string> <key>RunAtLoad</key> diff --git a/Library/Formula/nagios.rb b/Library/Formula/nagios.rb index 00554a26d..f047920d8 100644 --- a/Library/Formula/nagios.rb +++ b/Library/Formula/nagios.rb @@ -37,7 +37,7 @@ class Nagios < Formula # Install config system "make install-config" system "make install-webconf" - (share+'org.nagios.plist').write startup_plist + (share+plist_path).write startup_plist # Symlink plugins libexec.rmdir @@ -53,7 +53,7 @@ class Nagios < Formula <key>KeepAlive</key> <true/> <key>Label</key> - <string>org.nagios</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/bin/nagios</string> @@ -97,8 +97,8 @@ class Nagios < Formula If you want to run nagios automatically at startup: - sudo cp #{share}/org.nagios.plist /Library/LaunchDaemons/ - sudo launchctl load -w /Library/LaunchDaemons/org.nagios.plist + sudo cp #{share}/#{plist_path.basename} /Library/LaunchDaemons/ + sudo launchctl load -w /Library/LaunchDaemons/#{plist_path.basename} ...or simply run it on demand: diff --git a/Library/Formula/nginx.rb b/Library/Formula/nginx.rb index 112fea5d7..411c0f191 100644 --- a/Library/Formula/nginx.rb +++ b/Library/Formula/nginx.rb @@ -56,8 +56,8 @@ class Nginx < Formula system "make install" man8.install "objs/nginx.8" - (prefix+'org.nginx.nginx.plist').write startup_plist - (prefix+'org.nginx.nginx.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats; <<-EOS.undent @@ -70,8 +70,8 @@ class Nginx < Formula You can start nginx automatically on login running as your user with: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/org.nginx.nginx.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.nginx.nginx.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} Though note that if running as your user, the launch agent will fail if you try to use a port below 1024 (such as http's default of 80.) @@ -85,7 +85,7 @@ class Nginx < Formula <plist version="1.0"> <dict> <key>Label</key> - <string>org.nginx.nginx</string> + <string>#{plist_name}</string> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> diff --git a/Library/Formula/offline-imap.rb b/Library/Formula/offline-imap.rb index 0396d3a5d..93ea87dc7 100644 --- a/Library/Formula/offline-imap.rb +++ b/Library/Formula/offline-imap.rb @@ -12,8 +12,8 @@ class OfflineImap < Formula prefix.install [ 'offlineimap.conf', 'offlineimap.conf.minimal' ] bin.mkpath ln_s libexec+'offlineimap.py', bin+'offlineimap' - (prefix+'org.offlineimap.plist').write startup_plist - (prefix+'org.offlineimap.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats; <<-EOS.undent @@ -28,13 +28,13 @@ class OfflineImap < Formula To launch on startup and run every 5 minutes: * if this is your first install: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/org.offlineimap.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.offlineimap.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - * if this is an upgrade and you already have the org.offlineimap.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/org.offlineimap.plist - cp #{prefix}/org.offlineimap.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.offlineimap.plist + * if this is an upgrade and you already have the #{plist_path} loaded: + launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename} + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} EOS end @@ -47,7 +47,7 @@ class OfflineImap < Formula <key>KeepAlive</key> <false/> <key>Label</key> - <string>org.offlineimap</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/bin/offlineimap</string> diff --git a/Library/Formula/openvpn.rb b/Library/Formula/openvpn.rb index 9d0732fce..308a1c500 100644 --- a/Library/Formula/openvpn.rb +++ b/Library/Formula/openvpn.rb @@ -36,8 +36,8 @@ class Openvpn < Formula (var + 'run/openvpn').mkpath # Write the launchd script - (prefix + 'org.openvpn.plist').write startup_plist - (prefix + 'org.openvpn.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats; <<-EOS @@ -58,12 +58,12 @@ For OpenVPN to work as a server, you will need to do the following: 2) Install the launchd item in /Library/LaunchDaemons, like so: - sudo cp -vf #{prefix}/org.openvpn.plist /Library/LaunchDaemons/. - sudo chown -v root:wheel /Library/LaunchDaemons/org.openvpn.plist + 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/org.openvpn.plist + sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename} Next boot of system will automatically start OpenVPN. EOS @@ -76,7 +76,7 @@ EOS <plist version="1.0"> <dict> <key>Label</key> - <string>org.openvpn</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/sbin/openvpn</string> diff --git a/Library/Formula/percona-server.rb b/Library/Formula/percona-server.rb index 77d3be8ee..5faf277df 100644 --- a/Library/Formula/percona-server.rb +++ b/Library/Formula/percona-server.rb @@ -73,7 +73,7 @@ class PerconaServer < Formula system "make" system "make install" - (prefix+'com.percona.mysqld.plist').write startup_plist + plist_path.write startup_plist # Don't create databases inside of the prefix! # See: https://github.com/mxcl/homebrew/issues/4975 @@ -118,13 +118,13 @@ class PerconaServer < Formula To launch on startup: * if this is your first install: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/com.percona.mysqld.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/com.percona.mysqld.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - * if this is an upgrade and you already have the com.percona.mysqld.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/com.percona.mysqld.plist - cp #{prefix}/com.percona.mysqld.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/com.percona.mysqld.plist + * if this is an upgrade and you already have the #{plist_path} 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". @@ -139,7 +139,7 @@ class PerconaServer < Formula <key>KeepAlive</key> <true/> <key>Label</key> - <string>com.percona.mysqld</string> + <string>#{plist_name}</string> <key>Program</key> <string>#{HOMEBREW_PREFIX}/bin/mysqld_safe</string> <key>RunAtLoad</key> diff --git a/Library/Formula/pgbouncer.rb b/Library/Formula/pgbouncer.rb index 92abe87d9..971835532 100644 --- a/Library/Formula/pgbouncer.rb +++ b/Library/Formula/pgbouncer.rb @@ -16,8 +16,8 @@ class Pgbouncer < Formula bin.install "etc/mkauth.py" etc.install %w(etc/pgbouncer.ini etc/userlist.txt) - (prefix+'org.postgresql.pgbouncer.plist').write startup_plist - (prefix+'org.postgresql.pgbouncer.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats @@ -31,14 +31,14 @@ 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 #{prefix}/org.postgresql.pgbouncer.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.postgresql.pgbouncer.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} -If this is an upgrade and you already have the org.postgresql.pgbouncer.plist +If this is an upgrade and you already have the #{plist_path} loaded: - launchctl unload -w ~/Library/LaunchAgents/org.postgresql.pgbouncer.plist - cp #{prefix}/org.postgresql.pgbouncer.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.postgresql.pgbouncer.plist + 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 @@ -54,7 +54,7 @@ Or start manually with: <key>KeepAlive</key> <true/> <key>Label</key> - <string>org.postgresql.pgbouncer</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/bin/pgbouncer</string> diff --git a/Library/Formula/pincaster.rb b/Library/Formula/pincaster.rb index 7ddafcef3..f2d82e91d 100644 --- a/Library/Formula/pincaster.rb +++ b/Library/Formula/pincaster.rb @@ -16,14 +16,14 @@ class Pincaster < Formula etc.install "pincaster.conf" (var+"db/pincaster/").mkpath - (prefix+'com.github.pincaster.plist').write startup_plist - (prefix+'com.github.pincaster.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats <<-EOS.undent Automatically load on login with: - launchctl load -w #{prefix}/com.github.pincaster.plist + launchctl load -w #{plist_path} To start pincaster manually: pincaster #{etc}/pincaster.conf @@ -39,7 +39,7 @@ class Pincaster < Formula <key>KeepAlive</key> <true/> <key>Label</key> - <string>com.github.pincaster</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/bin/pincaster</string> diff --git a/Library/Formula/postgresql.rb b/Library/Formula/postgresql.rb index ce1694209..9f57f2419 100644 --- a/Library/Formula/postgresql.rb +++ b/Library/Formula/postgresql.rb @@ -56,8 +56,8 @@ class Postgresql < Formula system "./configure", *args system "make install-world" - (prefix+'org.postgresql.postgres.plist').write startup_plist - (prefix+'org.postgresql.postgres.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def check_python_arch @@ -110,13 +110,13 @@ To migrate existing data from a previous major version (pre-9.1) of PostgreSQL, If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/org.postgresql.postgres.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} -If this is an upgrade and you already have the org.postgresql.postgres.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist - cp #{prefix}/org.postgresql.postgres.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist +If this is an upgrade and you already have the #{plist_path} 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 @@ -152,7 +152,7 @@ To install gems without sudo, see the Homebrew wiki. <key>KeepAlive</key> <true/> <key>Label</key> - <string>org.postgresql.postgres</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/bin/postgres</string> diff --git a/Library/Formula/pure-ftpd.rb b/Library/Formula/pure-ftpd.rb index a0481d6af..feb52a2ed 100644 --- a/Library/Formula/pure-ftpd.rb +++ b/Library/Formula/pure-ftpd.rb @@ -27,21 +27,21 @@ class PureFtpd < Formula system "./configure", *args system "make install" - (prefix+'org.pureftpd.pure-ftpd.plist').write startup_plist - (prefix+'org.pureftpd.pure-ftpd.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats <<-EOS.undent If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/org.pureftpd.pure-ftpd.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.pureftpd.pure-ftpd.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - If this is an upgrade and you already have the org.pureftpd.pure-ftpd.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/org.pureftpd.pure-ftpd.plist - cp #{prefix}/org.pureftpd.pure-ftpd.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.pureftpd.pure-ftpd.plist + 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> @@ -57,7 +57,7 @@ class PureFtpd < Formula <key>KeepAlive</key> <true/> <key>Label</key> - <string>org.pureftpd.pure-ftpd</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/sbin/pure-ftpd</string> diff --git a/Library/Formula/rabbitmq.rb b/Library/Formula/rabbitmq.rb index f90aeeb8e..18752d7e2 100644 --- a/Library/Formula/rabbitmq.rb +++ b/Library/Formula/rabbitmq.rb @@ -35,21 +35,21 @@ class Rabbitmq < Formula # therefore need to add this path for erl -pa inreplace sbin+'rabbitmq-env', '${SCRIPT_DIR}/..', target_dir - (prefix+'com.rabbitmq.rabbitmq-server.plist').write startup_plist - (prefix+'com.rabbitmq.rabbitmq-server.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats <<-EOS.undent If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/com.rabbitmq.rabbitmq-server.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/com.rabbitmq.rabbitmq-server.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - If this is an upgrade and you already have the com.rabbitmq.rabbitmq-server.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/com.rabbitmq.rabbitmq-server.plist - cp #{prefix}/com.rabbitmq.rabbitmq-server.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/com.rabbitmq.rabbitmq-server.plist + If this is an upgrade and you already have the #{plist_path} loaded: + launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename} + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} To start rabbitmq-server manually: rabbitmq-server @@ -64,7 +64,7 @@ class Rabbitmq < Formula <plist version="1.0"> <dict> <key>Label</key> - <string>com.rabbitmq.rabbitmq-server</string> + <string>#{plist_name}</string> <key>Program</key> <string>#{HOMEBREW_PREFIX}/sbin/rabbitmq-server</string> <key>RunAtLoad</key> diff --git a/Library/Formula/redis.rb b/Library/Formula/redis.rb index f2a3e7c6f..f1995511e 100644 --- a/Library/Formula/redis.rb +++ b/Library/Formula/redis.rb @@ -30,21 +30,21 @@ class Redis < Formula doc.install Dir["doc/*"] etc.install "redis.conf" - (prefix+'io.redis.redis-server.plist').write startup_plist - (prefix+'io.redis.redis-server.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats <<-EOS.undent If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/io.redis.redis-server.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/io.redis.redis-server.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - If this is an upgrade and you already have the io.redis.redis-server.plist loaded: - launchctl unload -w ~/Library/LaunchAgents/io.redis.redis-server.plist - cp #{prefix}/io.redis.redis-server.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/io.redis.redis-server.plist + If this is an upgrade and you already have the #{plist_path} 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 @@ -63,7 +63,7 @@ class Redis < Formula <key>KeepAlive</key> <true/> <key>Label</key> - <string>io.redis.redis-server</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/bin/redis-server</string> diff --git a/Library/Formula/sickbeard.rb b/Library/Formula/sickbeard.rb index 7796b4256..4eed36f69 100644 --- a/Library/Formula/sickbeard.rb +++ b/Library/Formula/sickbeard.rb @@ -13,8 +13,8 @@ class Sickbeard < Formula prefix.install Dir['*'] bin.mkpath (bin+"sickbeard").write(startup_script) - (prefix+"com.sickbeard.sickbeard.plist").write(startup_plist) - (prefix+"com.sickbeard.sickbeard.plist").chmod 0644 + plist_path.write(startup_plist) + plist_path.chmod 0644 end def startup_plist; <<-EOS.undent @@ -23,7 +23,7 @@ class Sickbeard < Formula <plist version="1.0"> <dict> <key>Label</key> - <string>com.sickbeard.sickbeard</string> + <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{HOMEBREW_PREFIX}/bin/sickbeard</string> @@ -70,12 +70,12 @@ class Sickbeard < Formula To launch automatically on startup, copy and paste the following into a terminal: mkdir -p ~/Library/LaunchAgents - (launchctl unload -w ~/Library/LaunchAgents/com.sickbeard.sickbeard.plist 2>/dev/null || true) - ln -sf #{prefix}/com.sickbeard.sickbeard.plist ~/Library/LaunchAgents/com.sickbeard.sickbeard.plist - launchctl load -w ~/Library/LaunchAgents/com.sickbeard.sickbeard.plist + (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: - #{prefix}/com.sickbeard.sickbeard.plist + #{plist_path} to change the port (default: 8081) or user (default: #{`whoami`.chomp}). EOS end diff --git a/Library/Formula/sshguard.rb b/Library/Formula/sshguard.rb index 166fde815..65ee7fe97 100644 --- a/Library/Formula/sshguard.rb +++ b/Library/Formula/sshguard.rb @@ -18,19 +18,19 @@ class Sshguard < Formula "--with-firewall=ipfw" system "make install" - (prefix+'net.sshguard.plist').write startup_plist - (prefix+'net.sshguard.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def caveats; <<-EOS 1) Install the launchd item in /Library/LaunchDaemons, like so: - sudo cp -vf #{prefix}/net.sshguard.plist /Library/LaunchDaemons/ - sudo chown -v root:wheel /Library/LaunchDaemons/net.sshguard.plist + 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/net.sshguard.plist + sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename} Next boot of system will automatically start sshguard. EOS @@ -43,7 +43,7 @@ EOS <plist version="1.0"> <dict> <key>Label</key> - <string>net.sshguard</string> + <string>#{plist_name}</string> <key>KeepAlive</key> <true/> <key>ProgramArguments</key> diff --git a/Library/Formula/tor.rb b/Library/Formula/tor.rb index d25fc4b7c..c3654391a 100644 --- a/Library/Formula/tor.rb +++ b/Library/Formula/tor.rb @@ -12,8 +12,8 @@ class Tor < Formula "--prefix=#{prefix}" system "make install" - (prefix+'org.tor.plist').write startup_plist - (prefix+'org.tor.plist').chmod 0644 + plist_path.write startup_plist + plist_path.chmod 0644 end def startup_plist @@ -23,7 +23,7 @@ class Tor < Formula <plist version="1.0"> <dict> <key>Label</key> - <string>org.tor</string> + <string>#{plist_name}</string> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> @@ -44,8 +44,8 @@ class Tor < Formula def caveats; <<-EOS.undent You can start tor automatically on login with: mkdir -p ~/Library/LaunchAgents - cp #{prefix}/org.tor.plist ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/org.tor.plist + cp #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} EOS end end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 576be6889..4072d594e 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -208,6 +208,10 @@ class Formula # generally we don't want var stuff inside the keg def var; HOMEBREW_PREFIX+'var' end + # 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 + # Use the @spec_to_use to detect the download strategy. # Can be overriden to force a custom download strategy def download_strategy |
