All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Hardin <ckhardin@gmail.com>
To: buildroot@buildroot.org
Cc: Charles Hardin <ckhardin@gmail.com>
Subject: [Buildroot] [PATCH 1/1] package/dhcp: fix dhcp symlink in target/var/lib/dhcp
Date: Tue, 20 Jun 2023 10:07:26 -0700	[thread overview]
Message-ID: <20230620170726.3644-1-ckhardin@gmail.com> (raw)

In a readonly fs configuration the skeleton-init-fs will move
the var directories to the usr/share/factory and the run a command
like this:

   mv $(TARGET_DIR)/var $(TARGET_DIR)/usr/share/factory/var
   mkdir -p $(TARGET_DIR)/var
   for i in $(TARGET_DIR)/usr/share/factory/var/* \
            $(TARGET_DIR)/usr/share/factory/var/lib/* \
            $(TARGET_DIR)/usr/share/factory/var/lib/systemd/*; do

If the symlink is to the /tmp directory the glob compare on the
dhcp link will evaluate and result in an incorrect entry being
created in the resulting tmpfs mount on var.

    L+! /var/lib/dhcp - - - - ../usr/share/factory//var/lib/dhcp

So, make the link relative and the result of the configuration
doesn't get impacted.

Signed-off-by: Charles Hardin <ckhardin@gmail.com>
---
 package/dhcp/dhcp.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/dhcp/dhcp.mk b/package/dhcp/dhcp.mk
index 7be40191c8..edbc6a0d2a 100644
--- a/package/dhcp/dhcp.mk
+++ b/package/dhcp/dhcp.mk
@@ -103,7 +103,7 @@ define DHCP_INSTALL_CTL_LIBS
 endef
 define DHCP_INSTALL_SERVER
 	mkdir -p $(TARGET_DIR)/var/lib
-	(cd $(TARGET_DIR)/var/lib; ln -snf /tmp dhcp)
+	(cd $(TARGET_DIR)/var/lib; ln -snf ../../tmp dhcp)
 	$(MAKE) -C $(@D)/server DESTDIR=$(TARGET_DIR) install-sbinPROGRAMS
 	$(INSTALL) -m 0644 -D package/dhcp/dhcpd.conf \
 		$(TARGET_DIR)/etc/dhcp/dhcpd.conf
@@ -113,7 +113,7 @@ endif
 ifeq ($(BR2_PACKAGE_DHCP_RELAY),y)
 define DHCP_INSTALL_RELAY
 	mkdir -p $(TARGET_DIR)/var/lib
-	(cd $(TARGET_DIR)/var/lib; ln -snf /tmp dhcp)
+	(cd $(TARGET_DIR)/var/lib; ln -snf ../../tmp dhcp)
 	$(MAKE) -C $(@D)/relay DESTDIR=$(TARGET_DIR) install-sbinPROGRAMS
 endef
 endif
@@ -121,7 +121,7 @@ endif
 ifeq ($(BR2_PACKAGE_DHCP_CLIENT),y)
 define DHCP_INSTALL_CLIENT
 	mkdir -p $(TARGET_DIR)/var/lib
-	(cd $(TARGET_DIR)/var/lib; ln -snf /tmp dhcp)
+	(cd $(TARGET_DIR)/var/lib; ln -snf ../../tmp dhcp)
 	$(MAKE) -C $(@D)/client DESTDIR=$(TARGET_DIR) sbindir=/sbin \
 		install-sbinPROGRAMS
 	$(INSTALL) -m 0644 -D package/dhcp/dhclient.conf \
-- 
2.39.2 (Apple Git-143)

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2023-06-20 17:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 17:07 Charles Hardin [this message]
2023-07-10 18:47 ` [Buildroot] [PATCH 1/1] package/dhcp: fix dhcp symlink in target/var/lib/dhcp Thomas Petazzoni via buildroot
2023-07-10 19:49   ` Yann E. MORIN
2023-07-10 19:17 ` Thomas Petazzoni via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230620170726.3644-1-ckhardin@gmail.com \
    --to=ckhardin@gmail.com \
    --cc=buildroot@buildroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.