diff mbox

[1/1] USE_busybox_udhcpc_scripts will enable/disable installing udhcpc-scripts. Use this when providing your own script

Message ID 314472b4736e63eca96f60fc37875d18d0634a7f.1372075399.git.kibo@prevas.dk
State Changes Requested
Delegated to: Esben Haabendal
Headers show

Commit Message

Kim Bøndergaard June 24, 2013, 12:04 p.m. UTC
From: Christian Rasmussen <chor@prevas.dk>

---
 recipes/busybox/busybox-install.inc | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

Comments

Esben Haabendal July 3, 2013, 7:26 a.m. UTC | #1
Kim Bøndergaard <kibo@prevas.dk> writes:

> From: Christian Rasmussen <chor@prevas.dk>
>
> ---
>  recipes/busybox/busybox-install.inc | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/recipes/busybox/busybox-install.inc b/recipes/busybox/busybox-install.inc
> index bfb0c11..27e1ab4 100644
> --- a/recipes/busybox/busybox-install.inc
> +++ b/recipes/busybox/busybox-install.inc
> @@ -8,6 +8,22 @@ INETD_CONF_FILES = "${SRCDIR}/inetd.conf.d"
>  #
>  busybox_suid_root = ""
>  
> +RECIPE_FLAGS += "busybox_udhcpc_scripts"
> +DEFAULT_USE_busybox_udhcpc_scripts = "1"
> +DO_INSTALL_POSTFUNCS:>USE_busybox_udhcpc_scripts = " do_install_busybox_udhcpc_scripts"
> +do_install[postfuncs] += "${DO_INSTALL_POSTFUNCS}"
> +
> +do_install_busybox_udhcpc_scripts () {
> +	if grep "CONFIG_UDHCPC=y" ${S}/.config; then
> +		install -d ${D}${sysconfdir}/udhcpc.d
> +		install -d ${D}${datadir}/udhcpc
> +		install -m 0755 ${S}/examples/udhcp/simple.script \
> +			${D}${sysconfdir}/udhcpc.d/50default
> +		install -m 0755 ${SRCDIR}/default.script \
> +			${D}${datadir}/udhcpc/default.script
> +	fi
> +}
> +
>  do_install () {
>  	if grep "CONFIG_INIT=y" ${S}/.config; then
>  		install -d ${D}${sysconfdir}/init.d
> @@ -37,15 +53,6 @@ do_install () {
>  		install -m 0644 ${SRCDIR}/mdev.conf ${D}${sysconfdir}/
>  	fi
>  
> -	if grep "CONFIG_UDHCPC=y" ${S}/.config; then
> -		install -d ${D}${sysconfdir}/udhcpc.d
> -		install -d ${D}${datadir}/udhcpc
> -		install -m 0755 ${S}/examples/udhcp/simple.script \
> -			${D}${sysconfdir}/udhcpc.d/50default
> -		install -m 0755 ${SRCDIR}/default.script \
> -			${D}${datadir}/udhcpc/default.script
> -	fi
> -
>  	if grep "CONFIG_INETD=y" ${S}/.config; then
>  		install -m 0644 ${SRCDIR}/inetd.conf ${D}${sysconfdir}/
>  	fi

This is different from the approach usually taken.

For recipes where you might want to replace part of the result with your
own configuration files, scripts, or whatever, the parts should be
packaged in separate packages, with proper dependencies in place, and
then you can simply add a custom recipe which builds a package providing
this, and give it a higher DEFAULT_PREFERENCE, so it is used instead of
the package from the original recipe.

Take a look at fx. vsftpd-config and vsftpd-init in the vsftpd recipe,
and netbase-init, netbase-hosts and so on in the netbase recipe.

So, add a busybox-udhcpc-scripts package, package all the scripts in it,
and add it to RDEPENDS_${PN}.  The busybox-udhcpc-scripts packages
should probably be conditionally appended to PACKAGES, like

PACKAGES:>USE_busybox_udhcpc = " ${PN}-udhcpc-scripts"

/Esben
diff mbox

Patch

diff --git a/recipes/busybox/busybox-install.inc b/recipes/busybox/busybox-install.inc
index bfb0c11..27e1ab4 100644
--- a/recipes/busybox/busybox-install.inc
+++ b/recipes/busybox/busybox-install.inc
@@ -8,6 +8,22 @@  INETD_CONF_FILES = "${SRCDIR}/inetd.conf.d"
 #
 busybox_suid_root = ""
 
+RECIPE_FLAGS += "busybox_udhcpc_scripts"
+DEFAULT_USE_busybox_udhcpc_scripts = "1"
+DO_INSTALL_POSTFUNCS:>USE_busybox_udhcpc_scripts = " do_install_busybox_udhcpc_scripts"
+do_install[postfuncs] += "${DO_INSTALL_POSTFUNCS}"
+
+do_install_busybox_udhcpc_scripts () {
+	if grep "CONFIG_UDHCPC=y" ${S}/.config; then
+		install -d ${D}${sysconfdir}/udhcpc.d
+		install -d ${D}${datadir}/udhcpc
+		install -m 0755 ${S}/examples/udhcp/simple.script \
+			${D}${sysconfdir}/udhcpc.d/50default
+		install -m 0755 ${SRCDIR}/default.script \
+			${D}${datadir}/udhcpc/default.script
+	fi
+}
+
 do_install () {
 	if grep "CONFIG_INIT=y" ${S}/.config; then
 		install -d ${D}${sysconfdir}/init.d
@@ -37,15 +53,6 @@  do_install () {
 		install -m 0644 ${SRCDIR}/mdev.conf ${D}${sysconfdir}/
 	fi
 
-	if grep "CONFIG_UDHCPC=y" ${S}/.config; then
-		install -d ${D}${sysconfdir}/udhcpc.d
-		install -d ${D}${datadir}/udhcpc
-		install -m 0755 ${S}/examples/udhcp/simple.script \
-			${D}${sysconfdir}/udhcpc.d/50default
-		install -m 0755 ${SRCDIR}/default.script \
-			${D}${datadir}/udhcpc/default.script
-	fi
-
 	if grep "CONFIG_INETD=y" ${S}/.config; then
 		install -m 0644 ${SRCDIR}/inetd.conf ${D}${sysconfdir}/
 	fi