################################################################################
#
# wsen
#
################################################################################

WSEN_VERSION = $(shell git ls-remote https://git.SDNsupport.nl:4000/H1502/WSEN.git master | awk '{print$$1}')
WSEN_SITE = https://git.SDNsupport.nl:4000/H1502/WSEN.git
WSEN_SITE_METHOD = git
WSEN_LICENSE = Copyright sdn
WSEN_DEPENDENCIES = libcurl logrotate rsync dcron cjson libconfuse

WSEN_GIT_VERSION = $(shell git --git-dir $(WSEN_DL_DIR)/git/.git describe --always --tags)

define WSEN_BUILD_CMDS
	$(MAKE) CC=$(TARGET_CC) LD=$(TARGET_LD) GIT_VERSION=$(WSEN_GIT_VERSION) -C $(@D) all
endef

define WSEN_INSTALL_TARGET_CMDS
	$(INSTALL) -D -m 0755 $(@D)/wsen $(TARGET_DIR)/bin
	$(INSTALL) -d $(TARGET_DIR)/etc/wsen
	cp $(@D)/scripts/wsenconfig.conf $(TARGET_DIR)/etc/wsen
	$(INSTALL) -D -m 444 $(@D)/scripts/logrotate.conf $(TARGET_DIR)/etc/wsen/
	$(INSTALL) -d $(TARGET_DIR)/wsen-log
	$(INSTALL) -D -m 0755 $(@D)/scripts/wsenloggingscript $(TARGET_DIR)/etc/wsen/
	$(INSTALL) -D -m 0644 $(@D)/scripts/wsenlogging $(TARGET_DIR)/etc/cron.d
endef

define WSEN_INSTALL_INIT_SYSV
	$(INSTALL) -D -m 755 $(@D)/scripts/S51wsen $(TARGET_DIR)/etc/init.d/S51wsen
endef

$(eval $(generic-package))
