packages/monit: use new service functions, fix /etc/monitrc permissions
[packages.git] / admin / monit / Makefile
1 #
2 # Copyright (C) 2006-2011 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:=monit
11 PKG_VERSION:=5.2.5
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://mmonit.com/monit/dist
16 PKG_MD5SUM:=862fb7939ad6f73fc0cc82096c2309c7
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
19 PKG_INSTALL:=1
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/monit/Default
24   SECTION:=admin
25   CATEGORY:=Administration
26   DEPENDS:= +libpthread
27   TITLE:=System services monitoring utility
28   URL:=http://mmonit.com/monit/
29 endef
30
31 define Package/monit/Default/description
32         An utility for monitoring services on a Unix system
33 endef
34
35 define Package/monit
36 $(call Package/monit/Default)
37   DEPENDS+= +libopenssl
38   TITLE+= (with SSL support)
39   VARIANT:=ssl
40 endef
41
42 define Package/monit/description
43 $(call Package/monit/Default/description)
44         This package is built with SSL support.
45 endef
46
47 define Package/monit-nossl
48 $(call Package/monit/Default)
49   TITLE+= (without SSL support)
50   VARIANT:=nossl
51 endef
52
53 define Package/monit-nossl/description
54 $(call Package/monit/Default/description)
55         This package is built without SSL support.
56 endef
57
58 ifeq ($(BUILD_VARIANT),ssl)
59         CONFIGURE_ARGS += \
60                 --with-ssl \
61                 --with-ssl-dir="$(STAGING_DIR)/usr"
62 endif
63
64 ifeq ($(BUILD_VARIANT),nossl)
65         CONFIGURE_ARGS += \
66                 --without-ssl
67 endif
68
69 define Package/monit/conffiles
70 /etc/monitrc
71 endef
72
73 define Package/monit/install
74         $(INSTALL_DIR) $(1)/etc
75         $(INSTALL_CONF) $(PKG_BUILD_DIR)/monitrc $(1)/etc/
76         $(INSTALL_DIR) $(1)/etc/init.d
77         $(INSTALL_BIN) ./files/monit.init $(1)/etc/init.d/monit
78         $(INSTALL_DIR) $(1)/usr/bin
79         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/monit $(1)/usr/bin/
80 endef
81
82 Package/monit-nossl/conffiles = $(Package/monit/conffiles)
83 Package/monit-nossl/install = $(Package/monit/install)
84
85 $(eval $(call BuildPackage,monit))
86 $(eval $(call BuildPackage,monit-nossl))