diff options
| author | Björn Albers | 2012-11-27 08:05:27 +0100 |
|---|---|---|
| committer | Adam Vandenberg | 2013-01-06 21:12:42 -0800 |
| commit | ed11be446b7aec7b999b30ae453ed3fcd2c6c8a0 (patch) | |
| tree | 3d7ea34031b0051c64ef84f3d64128c76e56d83a | |
| parent | 4900ad83b973f0db32f8808193f2ec55ffd4f412 (diff) | |
| download | homebrew-ed11be446b7aec7b999b30ae453ed3fcd2c6c8a0.tar.bz2 | |
Zabbix: Add options --with-mysql and --agent-only
- Build with PostgreSQL support by default.
- Allow to use MySQL optionally when installing `--with-mysql`.
- Prefer brewed over shipped DB, so switching between them is easier.
- Install only relevant schema for the selected DB.
- Allow to build only the Zabbix Agent with `--agent-only`.
Closes #16260.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
| -rw-r--r-- | Library/Formula/zabbix.rb | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/Library/Formula/zabbix.rb b/Library/Formula/zabbix.rb index e5fab3a8a..ec8a731de 100644 --- a/Library/Formula/zabbix.rb +++ b/Library/Formula/zabbix.rb @@ -5,25 +5,51 @@ class Zabbix < Formula url 'http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.0.4/zabbix-2.0.4.tar.gz' sha1 '26ffd4616a96434b3c357146780f66058f6fbd80' - depends_on :mysql - depends_on 'fping' - depends_on 'libssh2' + option 'with-mysql', 'Use Zabbix Server with MySQL library instead PostgreSQL.' + option 'agent-only', 'Install only the Zabbix Agent without Server and Proxy.' + + unless build.include?('agent-only') + depends_on (build.include?('with-mysql') ? :mysql : :postgresql) + depends_on 'fping' + depends_on 'libssh2' + end + + def brewed_or_shipped(db_config) + brewed_db_config = "#{HOMEBREW_PREFIX}/bin/#{db_config}" + (File.exists?(brewed_db_config) && brewed_db_config) || which(db_config) + end def install - which_mysql = which('mysql_config') || "#{HOMEBREW_PREFIX}/bin/mysql_config" - system "./configure", "--disable-dependency-tracking", - "--prefix=#{prefix}", - "--enable-server", - "--enable-proxy", - "--enable-agent", - "--with-mysql=#{which_mysql}", - "--enable-ipv6", - "--with-net-snmp", - "--with-libcurl", - "--with-ssh2" + args = %W{ + --disable-dependency-tracking + --prefix=#{prefix} + --enable-agent + } + + unless build.include?('agent-only') + db_adapter = if build.include?('with-mysql') + "--with-mysql=#{brewed_or_shipped('mysql_config')}" + else + "--with-postgresql=#{brewed_or_shipped('pg_config')}" + end + args += %W{ + --enable-server + --enable-proxy + #{db_adapter} + --enable-ipv6 + --with-net-snmp + --with-libcurl + --with-ssh2 + } + end + system "./configure", *args system "make install" - (share/'zabbix').install 'frontends/php', 'database/mysql' + + unless build.include?('agent-only') + (share/'zabbix').install 'frontends/php', + "database/#{build.include?('with-mysql') ? :mysql : :postgresql}" + end end def caveats; <<-EOS.undent @@ -36,6 +62,6 @@ class Zabbix < Formula end def test - system "#{sbin}/zabbix_agent", "--print" + system "#{sbin}/zabbix_agentd", "--print" end end |
