netifd: read udhcpc user scripts from directory

Placeholder DHCP user scripts were added recently.

These files make package-based installations of such scripts more difficult.
Pull user callbacks from directories instead to allow packages and users to
install co-existing scripts more easily.

References:
130118f7a netifd: add a udhcpc.user placeholder script

Signed-off-by: Leon M. George <leon@georgemail.eu>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE increase]
(cherry picked from commit 467c32600c)
This commit is contained in:
Leon M. George 2021-03-23 11:02:36 +01:00 committed by Rafał Miłecki
parent f3a0f906b5
commit ef14916947
2 changed files with 6 additions and 1 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=netifd PKG_NAME:=netifd
PKG_RELEASE:=2 PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
@ -27,6 +27,7 @@ endef
define Package/netifd/conffiles define Package/netifd/conffiles
/etc/udhcpc.user /etc/udhcpc.user
/etc/udhcpc.user.d/
endef endef
TARGET_CFLAGS += \ TARGET_CFLAGS += \
@ -44,6 +45,7 @@ define Package/netifd/install
$(INSTALL_DIR) $(1)/sbin $(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/netifd $(1)/sbin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/netifd $(1)/sbin/
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d/
$(CP) $(PKG_BUILD_DIR)/scripts/* $(1)/lib/netifd/ $(CP) $(PKG_BUILD_DIR)/scripts/* $(1)/lib/netifd/
endef endef

View File

@ -112,5 +112,8 @@ esac
# user rules # user rules
[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user "$@" [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user "$@"
for f in /etc/udhcpc.user.d/*; do
[ -f "$f" ] && (. "$f" "$@")
done
exit 0 exit 0