diff mbox series

busybox: Don't overwrite existing inittab

Message ID 20191206123154.26102-1-paul@crapouillou.net
State Accepted
Headers show
Series busybox: Don't overwrite existing inittab | expand

Commit Message

Paul Cercueil Dec. 6, 2019, 12:31 p.m. UTC
If a inittab file was already provided in the skeleton, don't overwrite
it with the one that comes with the busybox package.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 package/busybox/busybox.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni Dec. 8, 2019, 3:53 p.m. UTC | #1
On Fri,  6 Dec 2019 13:31:54 +0100
Paul Cercueil <paul@crapouillou.net> wrote:

> If a inittab file was already provided in the skeleton, don't overwrite
> it with the one that comes with the busybox package.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  package/busybox/busybox.mk | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
> index 301e72bdd2..e5d2f1bd0c 100644
> --- a/package/busybox/busybox.mk
> +++ b/package/busybox/busybox.mk
> @@ -277,7 +277,9 @@ endif
>  
>  ifeq ($(BR2_INIT_BUSYBOX),y)
>  define BUSYBOX_INSTALL_INITTAB
> -	$(INSTALL) -D -m 0644 package/busybox/inittab $(TARGET_DIR)/etc/inittab
> +	if test ! -r $(TARGET_DIR)/etc/inittab; then \

We more commonly use test -e and not test -r for this kind of tests, so
I've changed to use test -e, and applied to master. Thanks!

Note that we normally recommend to override such files using a rootfs
overlay instead of a skeleton, as a rootfs overlay always wins over
whatever Buildroot packages might do.

Best regards,

Thomas
Peter Korsgaard Dec. 22, 2019, 8:15 p.m. UTC | #2
>>>>> "Paul" == Paul Cercueil <paul@crapouillou.net> writes:

 > If a inittab file was already provided in the skeleton, don't overwrite
 > it with the one that comes with the busybox package.

 > Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Committed to 2019.02.x and 2019.11.x, thanks.
diff mbox series

Patch

diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
index 301e72bdd2..e5d2f1bd0c 100644
--- a/package/busybox/busybox.mk
+++ b/package/busybox/busybox.mk
@@ -277,7 +277,9 @@  endif
 
 ifeq ($(BR2_INIT_BUSYBOX),y)
 define BUSYBOX_INSTALL_INITTAB
-	$(INSTALL) -D -m 0644 package/busybox/inittab $(TARGET_DIR)/etc/inittab
+	if test ! -r $(TARGET_DIR)/etc/inittab; then \
+		$(INSTALL) -D -m 0644 package/busybox/inittab $(TARGET_DIR)/etc/inittab; \
+	fi
 endef
 endif