################################################################################
#
# acsreader
#
################################################################################

ACSREADER_VERSION = $(shell git ls-remote https://git.SDNsupport.nl:4000/ACS/ACSreader.git master | awk '{print$$1}')
ACSREADER_SITE = https://git.SDNsupport.nl:4000/ACS/ACSreader.git
ACSREADER_SITE_METHOD = git
ACSREADER_LICENSE = Copyright sdn
ACSREADER_LICENSE_FILES = README

ACSREADER_DEPENDENCIES = libcurl libconfuse logrotate rsync dcron cjson

ACSREADER_GIT_VERSION = $(shell git --git-dir $(ACSREADER_DL_DIR)/git/.git describe --always --tags)

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

define ACSREADER_INSTALL_TARGET_CMDS
	$(INSTALL) -D -m 0755 $(@D)/acsreader $(TARGET_DIR)/bin
	$(INSTALL) -d $(TARGET_DIR)/etc/acsreader
	cp $(@D)/acsreader.conf $(TARGET_DIR)/etc/acsreader/
	$(INSTALL) -D -m 444 $(@D)/scripts/logrotate.conf $(TARGET_DIR)/etc/acsreader/
	$(INSTALL) -d $(TARGET_DIR)/acsreader-log
	$(INSTALL) -D -m 0755 $(@D)/scripts/acsloggingscript $(TARGET_DIR)/etc/acsreader/
	$(INSTALL) -D -m 0644 $(@D)/scripts/acslogging $(TARGET_DIR)/etc/cron.d
	$(INSTALL) -D -m 0644 $(@D)/scripts/acsstatus $(TARGET_DIR)/etc/cron.d
	$(INSTALL) -D -m 0755 $(@D)/scripts/acsstatusscript $(TARGET_DIR)/etc/acsreader/
        $(INSTALL) -D -m 0644 $(@D)/scripts/acsconnection $(TARGET_DIR)/etc/cron.d
        $(INSTALL) -D -m 0755 $(@D)/scripts/acsconnectionscript $(TARGET_DIR)/etc/acsreader/
endef

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

$(eval $(generic-package))
