From 558ade747b1b410b517595aab1e63db0461e4195 Mon Sep 17 00:00:00 2001 From: Mohd Husaam Mehdi Date: Wed, 27 Mar 2024 21:32:00 +0530 Subject: [PATCH 1/2] atftpd: update init script to use procd * update init script to use procd Signed-off-by: Mohd Husaam Mehdi --- net/atftp/files/atftpd.init | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/net/atftp/files/atftpd.init b/net/atftp/files/atftpd.init index 502ccbe192ee45..b05beee4dfc3af 100755 --- a/net/atftp/files/atftpd.init +++ b/net/atftp/files/atftpd.init @@ -2,9 +2,11 @@ # Copyright (C) 2020 OpenWrt.org START=95 -PIDFILE=/tmp/run/atftpd.pid -start() { +USE_PROCD=1 +BIN=atftpd + +start_service() { local enable local srv local port @@ -17,9 +19,8 @@ start() { 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) + procd_open_instance + procd_set_param command $BIN "--no-fork" "--daemon" "--user" "root.root" "--port" "$port" "$srv" + procd_set_param respawn + procd_close_instance } From 19e38ac94354c9a2518bb08c5c7e30abf0d3b483 Mon Sep 17 00:00:00 2001 From: Mohd Husaam Mehdi Date: Fri, 29 Mar 2024 22:49:37 +0530 Subject: [PATCH 2/2] atftpd: update init script to publish tftp service update init script to announce tftp service over mdns Signed-off-by: Mohd Husaam Mehdi --- net/atftp/Makefile | 2 +- net/atftp/files/atftpd.init | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/net/atftp/Makefile b/net/atftp/Makefile index c7cf408812b8ae..0e57c8815d2fa3 100644 --- a/net/atftp/Makefile +++ b/net/atftp/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=atftp PKG_VERSION:=0.8.0 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/$(PKG_NAME) diff --git a/net/atftp/files/atftpd.init b/net/atftp/files/atftpd.init index b05beee4dfc3af..369c6bc778d47f 100755 --- a/net/atftp/files/atftpd.init +++ b/net/atftp/files/atftpd.init @@ -10,6 +10,7 @@ start_service() { local enable local srv local port + local mdns config_load atftpd @@ -18,9 +19,11 @@ start_service() { config_get srv service path "/srv/tftp" config_get port service port 69 + config_get mdns service mdns 0 procd_open_instance procd_set_param command $BIN "--no-fork" "--daemon" "--user" "root.root" "--port" "$port" "$srv" + [ "${mdns}" -ne 0 ] && procd_add_mdns "tftp" "udp" "$port" "daemon=atftpd" procd_set_param respawn procd_close_instance }