htpdate: modify init scripts to use procd and uci configuration

Modify init script to use standard uci configuration and procd for
process management. We benefit from:
- use of standard LEDE configuration with its ability to revert and
  commit changes
- validation of configuration variables
- procd taking care of restarting daemon when config changes and user
  wants to reload it
- automatic respawning of daemon process in case it dies

The source is patched to make it possible to run as a daemon in
foreground.

Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>
This commit is contained in:
Marcin Jurkowski
2017-07-25 23:37:57 +02:00
parent df1f3a41c8
commit 73dbc6cf92
5 changed files with 103 additions and 17 deletions
+7 -6
View File
@@ -9,11 +9,11 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=htpdate
PKG_VERSION:=1.1.1
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://www.vervest.org/htp/archive/c/
PKG_MD5SUM:=c612f63282e3f23b709f37a5c81d4739
PKG_HASH:=0d75f91cb61f8869c8298d198fa52b9a139ae505b366e9d4d331af8bc1c04880
PKG_LICENSE:=GPL-2.0+
PKG_LICENSE_FILES:=
@@ -26,7 +26,8 @@ define Package/htpdate
CATEGORY:=Network
TITLE:=an HTP (Hypertext Time Protocol) implementation
URL:=http://www.vervest.com/htp/
MAINTAINER:=Tijs Van Buggenhout <tvbuggen@netzerk.be>
MAINTAINER:=Tijs Van Buggenhout <tvbuggen@netzerk.be>, \
Marcin Jurkowski <marcin1j@gmail.com>
endef
define Package/htpdate/description
@@ -38,7 +39,7 @@ define Package/htpdate/description
endef
define Package/htpdate/conffiles
/etc/default/htpdate
/etc/config/htpdate
endef
define Build/Compile
@@ -50,8 +51,8 @@ endef
define Package/htpdate/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/htpdate $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/default/
$(INSTALL_CONF) ./files/htpdate.default $(1)/etc/default/htpdate
$(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_CONF) ./files/htpdate.conf $(1)/etc/config/htpdate
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) ./files/htpdate.init $(1)/etc/init.d/htpdate
endef