added nrpe from #2498
[openwrt/svn-archive/archive.git] / net / nrpe / Makefile
1 #
2 # Copyright (C) 2007 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
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=nrpe
12 PKG_VERSION:=2.8.1
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=@SF/nagios
17 PKG_MD5SUM:=
18
19 include $(INCLUDE_DIR)/package.mk
20
21 define Package/nrpe
22 SECTION:=net
23 CATEGORY:=Network
24 DEPENDS:=+libopenssl
25 TITLE:=Daemon to execute Nagios check commands on remote hosts
26 URL:=http://www.nagios.org/download
27 endef
28
29 define Package/nrpe/description
30 NOTE: several assumptions are made:
31 1) As openssl is used to generate some stuff during "configure" it is
32 assumed that openssl is installed on compiling PC in its default
33 location (i.e. accessible as /usr/bin/openssl).
34 2) "nagios" user and group should exist on your openwrt installation.
35 endef
36
37 define Package/nrpe/postinst
38 #!/bin/sh
39
40 id=50
41 name=nagios
42 home=/var/run/nagios
43 shell=/bin/false
44
45 # do not change below
46 # check if we are on real system
47 if [ -z "$${IPKG_INSTROOT}" ]; then
48 # create copies of passwd and group, if we use squashfs
49 rootfs=`mount |awk '/root/ { print $$5 }'`
50 if [ "$$rootfs" = "squashfs" ]; then
51 if [ -h /etc/group ]; then
52 rm /etc/group
53 cp -p /rom/etc/group /etc/group
54 fi
55 if [ -h /etc/passwd ]; then
56 rm /etc/passwd
57 cp -p /rom/etc/passwd /etc/passwd
58 fi
59 fi
60 fi
61
62 echo ""
63 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
64 echo "adding group $$name to /etc/group"
65 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
66 fi
67 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
68 echo "adding user $$name to /etc/passwd"
69 echo "$${name}:x:$${id}:$${id}:$${name}:$${home}:$${shell}" >> $${IPKG_INSTROOT}/etc/passwd
70 fi
71 endef
72
73 CONFIGURE_ARGS += \
74 --with-ssl="$(STAGING_DIR)/usr" \
75
76 define Package/nrpe/install
77 $(INSTALL_DIR) $(1)/usr/sbin
78 $(INSTALL_DIR) $(1)/etc
79 $(INSTALL_DIR) $(1)/etc/init.d
80 $(INSTALL_DATA) ./files/nrpe.cfg $(1)/etc/nrpe.cfg
81 $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/nrpe $(1)/usr/sbin
82 $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
83 endef
84
85 $(eval $(call BuildPackage,nrpe))