atftp: add init script and config file
authorRussell Senior <russell@personaltelco.net>
Fri, 18 Sep 2020 04:35:18 +0000 (21:35 -0700)
committerRussell Senior <russell@personaltelco.net>
Fri, 18 Sep 2020 17:22:56 +0000 (10:22 -0700)
Signed-off-by: Russell Senior <russell@personaltelco.net>
net/atftp/Makefile
net/atftp/files/atftpd.conf [new file with mode: 0644]
net/atftp/files/atftpd.init [new file with mode: 0755]

index 72362c60488c671c5edd71d9913f5d1ce0eb2e78..5f1d434016453c0be56fcd26d8267c2c9f016739 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=atftp
 PKG_VERSION:=0.7.2
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/$(PKG_NAME)
@@ -53,6 +53,11 @@ endef
 
 define Package/atftpd/install
        $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/atftpd.init $(1)/etc/init.d/atftpd
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_BIN) ./files/atftpd.conf $(1)/etc/config/atftpd
+       $(INSTALL_DIR) $(1)/srv/tftp
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)//usr/sbin/atftpd $(1)/usr/sbin/
 endef
diff --git a/net/atftp/files/atftpd.conf b/net/atftp/files/atftpd.conf
new file mode 100644 (file)
index 0000000..6bd66e9
--- /dev/null
@@ -0,0 +1,3 @@
+
+config service 'service'
+       option path '/srv/tftp'
diff --git a/net/atftp/files/atftpd.init b/net/atftp/files/atftpd.init
new file mode 100755 (executable)
index 0000000..83573f9
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2020 OpenWrt.org
+
+START=95
+PIDFILE=/tmp/run/atftpd.pid
+
+start() {
+       config_load atftpd
+       config_get SRV service path "/srv/tftp"
+       config_get PORT service port 69
+
+       atftpd --pidfile $PIDFILE --user root.root --port $PORT --daemon $SRV
+}
+
+stop() {
+       kill $(cat $PIDFILE)
+}