Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add and use plist helper methods

These will be used to unify the label namespaces in embedded plists,
i.e. 'homebrew.mxcl.<formula>'.

plist_path returns the full path to a plist file located at the top
level of the keg; plist_path.basename can be used if just the filename
is needed.

c.f. #9346.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
  • Loading branch information...
commit b5a5217ba3117dfbfcad63532c2054d83d3249c0 1 parent 95e379f
@jacknagel jacknagel authored
Showing with 205 additions and 202 deletions.
  1. +5 −5 Library/Formula/cassandra.rb
  2. +6 −6 Library/Formula/couchdb-lucene.rb
  3. +9 −9 Library/Formula/ddclient.rb
  4. +4 −5 Library/Formula/denyhosts.rb
  5. +5 −5 Library/Formula/dnsmasq.rb
  6. +3 −3 Library/Formula/dovecot.rb
  7. +10 −10 Library/Formula/elasticsearch.rb
  8. +14 −14 Library/Formula/isc-dhcp.rb
  9. +9 −9 Library/Formula/jenkins.rb
  10. +10 −10 Library/Formula/mariadb.rb
  11. +9 −9 Library/Formula/memcached.rb
  12. +9 −9 Library/Formula/mongodb.rb
  13. +9 −9 Library/Formula/mysql.rb
  14. +4 −4 Library/Formula/nagios.rb
  15. +5 −5 Library/Formula/nginx.rb
  16. +9 −9 Library/Formula/offline-imap.rb
  17. +6 −6 Library/Formula/openvpn.rb
  18. +8 −8 Library/Formula/percona-server.rb
  19. +9 −9 Library/Formula/pgbouncer.rb
  20. +4 −4 Library/Formula/pincaster.rb
  21. +9 −9 Library/Formula/postgresql.rb
  22. +9 −9 Library/Formula/pure-ftpd.rb
  23. +9 −9 Library/Formula/rabbitmq.rb
  24. +9 −9 Library/Formula/redis.rb
  25. +7 −7 Library/Formula/sickbeard.rb
  26. +6 −6 Library/Formula/sshguard.rb
  27. +5 −5 Library/Formula/tor.rb
  28. +4 −0 Library/Homebrew/formula.rb
View
10 Library/Formula/cassandra.rb
@@ -31,15 +31,15 @@ def install
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 @@ def startup_plist; <<-EOPLIST
<true/>
<key>Label</key>
- <string>org.apache.cassandra</string>
+ <string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
View
12 Library/Formula/couchdb-lucene.rb
@@ -15,16 +15,16 @@ def install
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 @@ def ini_file
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 @@ def plist_file
<plist version="1.0">
<dict>
<key>Label</key>
- <string>couchdb-lucene</string>
+ <string>#{plist_name}</string>
<key>EnvironmentVariables</key>
<dict>
<key>HOME</key>
View
18 Library/Formula/ddclient.rb
@@ -36,8 +36,8 @@ def install
(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 @@ def caveats; <<-EOS
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 @@ def startup_plist
<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>
View
9 Library/Formula/denyhosts.rb
@@ -43,9 +43,8 @@ def install
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 @@ def cron_plist
<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 @@ def caveats
/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
View
10 Library/Formula/dnsmasq.rb
@@ -31,8 +31,8 @@ def install
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 @@ def caveats; <<-EOS.undent
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 @@ def startup_plist; <<-EOS.undent
<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>
View
6 Library/Formula/dovecot.rb
@@ -24,13 +24,13 @@ def caveats; <<-EOS
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 @@ def caveats; <<-EOS
</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
View
20 Library/Formula/elasticsearch.rb
@@ -48,24 +48,24 @@ def install
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 @@ def startup_plist
<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>
View
28 Library/Formula/isc-dhcp.rb
@@ -71,30 +71,30 @@ def install
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 @@ def caveats
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 @@ def dhcpd_plist
"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 @@ def dhcpd6_plist
"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>
View
18 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 @@ def startup_plist
<plist version="1.0">
<dict>
<key>Label</key>
- <string>Jenkins</string>
+ <string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
View
20 Library/Formula/mariadb.rb
@@ -65,8 +65,8 @@ def install
(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 @@ def caveats; <<-EOS.undent
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 @@ def startup_plist; <<-EOPLIST.undent
<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>
View
18 Library/Formula/memcached.rb
@@ -22,20 +22,20 @@ def install
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 @@ def startup_plist
<plist version="1.0">
<dict>
<key>Label</key>
- <string>com.danga.memcached</string>
+ <string>#{plist_name}</string>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
View
18 Library/Formula/mongodb.rb
@@ -43,8 +43,8 @@ def install
# 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 @@ def caveats
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 @@ def startup_plist
<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>
View
18 Library/Formula/mysql.rb
@@ -75,8 +75,8 @@ def install
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 @@ def caveats; <<-EOS.undent
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 @@ def startup_plist; <<-EOPLIST.undent
<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>
View
8 Library/Formula/nagios.rb
@@ -37,7 +37,7 @@ def install
# 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 @@ def startup_plist
<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 @@ def caveats
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:
View
10 Library/Formula/nginx.rb
@@ -56,8 +56,8 @@ def install
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 @@ def caveats; <<-EOS.undent
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 @@ def startup_plist
<plist version="1.0">
<dict>
<key>Label</key>
- <string>org.nginx.nginx</string>
+ <string>#{plist_name}</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
View
18 Library/Formula/offline-imap.rb
@@ -12,8 +12,8 @@ def install
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 @@ def caveats; <<-EOS.undent
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 @@ def startup_plist; <<-EOPLIST.undent
<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>
View
12 Library/Formula/openvpn.rb
@@ -36,8 +36,8 @@ def install
(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 @@ def caveats; <<-EOS
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 @@ def startup_plist
<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>
View
16 Library/Formula/percona-server.rb
@@ -73,7 +73,7 @@ def install
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 @@ def caveats; <<-EOS.undent
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 @@ def startup_plist; <<-EOPLIST.undent
<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>
View
18 Library/Formula/pgbouncer.rb
@@ -16,8 +16,8 @@ def install
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 @@ def caveats
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 @@ def startup_plist
<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>
View
8 Library/Formula/pincaster.rb
@@ -16,14 +16,14 @@ def install
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 @@ def startup_plist
<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>
View
18 Library/Formula/postgresql.rb
@@ -56,8 +56,8 @@ def install
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 @@ def caveats
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 @@ def startup_plist
<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>
View
18 Library/Formula/pure-ftpd.rb
@@ -27,21 +27,21 @@ def install
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 @@ def startup_plist
<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>
View
18 Library/Formula/rabbitmq.rb
@@ -35,21 +35,21 @@ def install
# 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 @@ def startup_plist
<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>
View
18 Library/Formula/redis.rb
@@ -30,21 +30,21 @@ def install
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 @@ def startup_plist
<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>
View
14 Library/Formula/sickbeard.rb
@@ -13,8 +13,8 @@ def install
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 @@ def startup_plist; <<-EOS.undent
<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 @@ def caveats; <<-EOS.undent
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
View
12 Library/Formula/sshguard.rb
@@ -18,19 +18,19 @@ def install
"--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 @@ def startup_plist
<plist version="1.0">
<dict>
<key>Label</key>
- <string>net.sshguard</string>
+ <string>#{plist_name}</string>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
View
10 Library/Formula/tor.rb
@@ -12,8 +12,8 @@ def install
"--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 @@ def startup_plist
<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 @@ def startup_plist
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
View
4 Library/Homebrew/formula.rb
@@ -208,6 +208,10 @@ def etc; HOMEBREW_PREFIX+'etc' end
# 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
Please sign in to comment.
Something went wrong with that request. Please try again.