contrib/package/freifunk-watchdog: add sysupgrade hook to terminate ffwatchd before...
[project/luci.git] / contrib / package / freifunk-watchdog / Makefile
1 #
2 # Copyright (C) 2009 Jo-Philipp Wich <xm@subsignal.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:=freifunk-watchdog
11 PKG_RELEASE:=2
12
13 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
14 PKG_BUILD_DEPENDS := uci
15
16 include $(INCLUDE_DIR)/package.mk
17
18 define Package/freifunk-watchdog
19   SECTION:=utils
20   CATEGORY:=Utilities
21   TITLE:=Freifunk Ad-Hoc watchdog daemon
22   DEPENDS:=libuci
23 endef
24
25 define Package/freifunk-watchdog/description
26   A watchdog daemon that monitors wireless interfaces to ensure the correct bssid and channel.
27   The process will initiate a wireless restart as soon as it detects a bssid or channel mismatch.
28 endef
29
30 define Build/Prepare
31         mkdir -p $(PKG_BUILD_DIR)
32         $(CP) ./src/* $(PKG_BUILD_DIR)/
33 endef
34
35 define Build/Configure
36 endef
37
38 define Build/Compile
39         $(MAKE) -C $(PKG_BUILD_DIR) \
40                 CC="$(TARGET_CC)" \
41                 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
42                 LDFLAGS="$(TARGET_LDFLAGS)"
43 endef
44
45 define Package/freifunk-watchdog/install
46         $(INSTALL_DIR) $(1)/etc/init.d
47         $(INSTALL_BIN) ./files/freifunk-watchdog.init $(1)/etc/init.d/freifunk-watchdog
48         $(INSTALL_DIR) $(1)/usr/sbin
49         $(INSTALL_BIN) $(PKG_BUILD_DIR)/ffwatchd $(1)/usr/sbin/
50         $(INSTALL_DIR) $(1)/lib/upgrade
51         $(INSTALL_DATA) ./files/sysupgrade.hook $(1)/lib/upgrade/kill-ffwatchd.sh
52 endef
53
54 $(eval $(call BuildPackage,freifunk-watchdog))