diff mbox

[OpenWrt-Devel,package] busybox: Add option to install example udhcpc script

Message ID 20160513081744.GA11948@workbook.ipv6.hrusecky.net
State Changes Requested
Delegated to: John Crispin
Headers show

Commit Message

Michal Hrusecky May 13, 2016, 8:17 a.m. UTC
When building very minimal system, people might be interested in using udhcpc.
To be able to use it, it needs script to actually set addresses. There is an
example script provided in examples directory which might be good enough for
some purposes. This patch makes it possible to select it in menuconfig and
enable it's installation.

Signed-off-by: Michal Hrusecky <michal.hrusecky@nic.cz>
---
 package/utils/busybox/Makefile                          | 5 +++++
 package/utils/busybox/config/networking/udhcp/Config.in | 7 +++++++
 2 files changed, 12 insertions(+)

Comments

Felix Fietkau May 13, 2016, 2:52 p.m. UTC | #1
On 2016-05-13 10:17, Michal Hrusecky wrote:
> When building very minimal system, people might be interested in using udhcpc.
> To be able to use it, it needs script to actually set addresses. There is an
> example script provided in examples directory which might be good enough for
> some purposes. This patch makes it possible to select it in menuconfig and
> enable it's installation.
> 
> Signed-off-by: Michal Hrusecky <michal.hrusecky@nic.cz>
Why? The netifd package already has a /usr/share/udhcpc/default.script
which sets addresses and routes. It could be moved to the busybox
package though...

- Felix
Michal Hrusecky May 13, 2016, 3:19 p.m. UTC | #2
Felix Fietkau - 16:52 13.05.16 wrote:
> On 2016-05-13 10:17, Michal Hrusecky wrote:
> > When building very minimal system, people might be interested in using udhcpc.
> > To be able to use it, it needs script to actually set addresses. There is an
> > example script provided in examples directory which might be good enough for
> > some purposes. This patch makes it possible to select it in menuconfig and
> > enable it's installation.
> > 
> > Signed-off-by: Michal Hrusecky <michal.hrusecky@nic.cz>
> Why? The netifd package already has a /usr/share/udhcpc/default.script
> which sets addresses and routes. It could be moved to the busybox
> package though...

Probably not entirely mainstream use-case, but I'm using the OpenWRT tree to
build also very minimalistic recovery system - without procd, netifd, ubus just
few basic utilities and simple script. I could make script part of my recovery
image, but as it is already there in busybox...
diff mbox

Patch

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index 24c064c..1f60257 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -115,6 +115,11 @@  define Package/busybox/install
 	$(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
 	$(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
 	$(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
+	$(INSTALL_DIR) $(1)/etc/init.d
+ ifeq ($(CONFIG_BUSYBOX_CONFIG_UDHCP_INSTALL_SIMPLE_SCRIPT),y)
+	$(INSTALL_DIR) $(1)$(shell dirname $(CONFIG_BUSYBOX_CONFIG_UDHCPC_DEFAULT_SCRIPT))
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/examples/udhcp/simple.script $(1)$(CONFIG_BUSYBOX_CONFIG_UDHCPC_DEFAULT_SCRIPT)
+ endif
 	-rm -rf $(1)/lib64
 endef
 
diff --git a/package/utils/busybox/config/networking/udhcp/Config.in b/package/utils/busybox/config/networking/udhcp/Config.in
index 4f48400..371adc4 100644
--- a/package/utils/busybox/config/networking/udhcp/Config.in
+++ b/package/utils/busybox/config/networking/udhcp/Config.in
@@ -147,6 +147,13 @@  config BUSYBOX_CONFIG_UDHCPC_DEFAULT_SCRIPT
 	  examples/udhcp for a working example. Normally it is safe
 	  to leave this untouched.
 
+config BUSYBOX_CONFIG_UDHCP_INSTALL_SIMPLE_SCRIPT
+	bool "Install simple config script"
+	default n
+	depends on BUSYBOX_CONFIG_UDHCPC
+	help
+	  Installs example configuration script so udhcpc can be used out of the box.
+
 config BUSYBOX_CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS
 	int "DHCP options slack buffer size"
 	default BUSYBOX_DEFAULT_UDHCPC_SLACK_FOR_BUGGY_SERVERS