From: Luca Ceresoli <luca@lucaceresoli.net>
To: buildroot@busybox.net
Subject: [Buildroot] Creation of /etc/dropbear
Date: Thu, 06 Nov 2014 16:19:15 +0100 [thread overview]
Message-ID: <545B9173.9080502@lucaceresoli.net> (raw)
Hi,
I have a Buildroot-based project where the target rootfs is read-only,
and there is a writable partition mounted on /mnt/user.
When it is first started, dropbear creates keys in /etc/dropbear. In
order to make this possible, in my board rootfs additions I create
/etc/dropbear as a a symlink to /mnt/user/etc/dropbear, which is an
initially empty directory in the writable partition.
It all works just fine, except when I rebuild a project without doing
'make clean' and dropbear is built (this could happen because its
version was bumped, or because I do make dropbear-rebuild or whatever
else). Here the dropbear install step calls
mkdir -p $(TARGET_DIR)/etc/dropbear
And fails, because $(TARGET_DIR)/etc/dropbear already exists but is not
a directory: it is a broken symlink.
I'd like to solve this issue in an upstream-friendly way, but I'm not
sure which way is the best. Nothing can be done in a post-build or
post-image script, because the issue is raised way before, when
building the dropbear package.
A simple option would be to remove the directory before creating it,
assuming there's no valuable info in there:
+ rm -fr $(TARGET_DIR)/etc/dropbear
mkdir -p $(TARGET_DIR)/etc/dropbear
A safer way would be to check if it exists either as a directory or
as a symlink:
+ if [ ! -d $(TARGET_DIR)/etc/dropbear ] && \
+ [ ! -L $(TARGET_DIR)/etc/dropbear ] ; then
mkdir -p $(TARGET_DIR)/etc/dropbear
+ fi
Both would work, but what if the same problem happens in other places?
There would be the risk to sprinkling similar ifs here and there in the
Buildroot codebase.
Moreover neither of these solutions looks very clean.
Any better ideas?
Thanks,
--
Luca
next reply other threads:[~2014-11-06 15:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 15:19 Luca Ceresoli [this message]
2014-11-06 15:29 ` [Buildroot] Creation of /etc/dropbear Thomas De Schampheleire
2014-11-06 16:16 ` Gustavo Zacarias
2014-11-07 13:31 ` Luca Ceresoli
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=545B9173.9080502@lucaceresoli.net \
--to=luca@lucaceresoli.net \
--cc=buildroot@busybox.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox