[packages] dosfstools: update to 3.0.9
[openwrt/svn-archive/archive.git] / admin / zabbix / Makefile
1 #
2 # Copyright (C) 2006-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=zabbix
11 PKG_VERSION:=1.6
12 PKG_RELEASE:=2
13 PKG_MD5SUM:=39d4c871439b1b4f0429964b4abbfc45
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=@SF/zabbix
17
18 PKG_BUILD_DEPENDS:=libsqlite3
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/zabbix/Default
23 SECTION:=admin
24 CATEGORY:=Administration
25 TITLE:=Zabbix
26 URL:=http://www.zabbix.com/
27 SUBMENU:=zabbix
28 DEPENDS:=+libcurl
29 endef
30
31 define Package/zabbix-agent
32 $(call Package/zabbix/Default)
33 TITLE+= agent
34 endef
35
36 define Package/zabbix-sender
37 $(call Package/zabbix/Default)
38 TITLE+= sender
39 endef
40
41 define Package/zabbix-server
42 $(call Package/zabbix/Default)
43 TITLE+= server
44 DEPENDS += +libsqlite3
45 endef
46
47
48 ifneq ($(SDK),)
49 CONFIG_PACKAGE_zabbix-server:=m
50 endif
51
52 PKG_CONFIGURE_OPTIONS:= \
53 --bindir="/usr/sbin" \
54 --enable-agent
55
56 ifneq ($(CONFIG_PACKAGE_zabbix-server),)
57 PKG_CONFIGURE_OPTIONS+= \
58 --enable-server \
59 --with-sqlite3="$(STAGING_DIR)/usr"
60 endif
61
62 define Build/Configure
63 $(call Build/Configure/Default, \
64 $(PKG_CONFIGURE_OPTIONS) \
65 )
66 endef
67
68 define Build/Compile
69 $(MAKE) -C $(PKG_BUILD_DIR) \
70 DESTDIR="$(PKG_INSTALL_DIR)" \
71 all install
72 endef
73
74 define Package/zabbix-agent/conffiles
75 /etc/zabbix/zabbix_agentd.conf
76 endef
77
78 define Package/zabbix-agent/install
79 $(INSTALL_DIR) $(1)/usr/sbin
80 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zabbix_agentd $(1)/usr/sbin/
81 $(INSTALL_DIR) $(1)/etc/zabbix
82 $(INSTALL_CONF) ./files/zabbix_agentd.conf $(1)/etc/zabbix/
83 $(INSTALL_DIR) $(1)/etc/init.d
84 $(INSTALL_BIN) ./files/zabbix_agentd.init $(1)/etc/init.d/zabbix_agentd
85 endef
86
87 define Package/zabbix-agent/postinst
88 #!/bin/sh
89
90 name=zabbix
91 id=53
92
93 # do not change below
94 # check if we are on real system
95 if [ -z "$${IPKG_INSTROOT}" ]; then
96 # create copies of passwd and group, if we use squashfs
97 rootfs=`mount |awk '/root/ { print $$5 }'`
98 if [ "$$rootfs" = "squashfs" ]; then
99 if [ -h /etc/group ]; then
100 rm /etc/group
101 cp /rom/etc/group /etc/group
102 fi
103 if [ -h /etc/passwd ]; then
104 rm /etc/passwd
105 cp /rom/etc/passwd /etc/passwd
106 fi
107 fi
108 fi
109
110 echo ""
111 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
112 echo "adding group $$name to /etc/group"
113 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
114 fi
115
116 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
117 echo "adding user $$name to /etc/passwd"
118 echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
119 fi
120
121 chown $${name} $${IPKG_INSTROOT}/etc/zabbix/zabbix_agentd.conf
122
123 endef
124
125 define Package/zabbix-sender/install
126 $(INSTALL_DIR) $(1)/usr/sbin
127 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zabbix_sender $(1)/usr/sbin/
128 $(INSTALL_DIR) $(1)/etc/zabbix
129 endef
130
131 define Package/zabbix-server/conffiles
132 /etc/zabbix/zabbix_server.conf
133 endef
134
135 define Package/zabbix-server/install
136 $(INSTALL_DIR) $(1)/usr/sbin
137 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zabbix_server $(1)/usr/sbin/
138 $(INSTALL_DIR) $(1)/etc/zabbix
139 $(INSTALL_CONF) $(PKG_BUILD_DIR)/misc/conf/zabbix_server.conf $(1)/etc/zabbix/
140 endef
141
142 $(eval $(call BuildPackage,zabbix-agent))
143 $(eval $(call BuildPackage,zabbix-sender))
144 $(eval $(call BuildPackage,zabbix-server))