From: Samuel Martin <s.martin49@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 08/10] support: mkusers: add warning when using mkpasswd from the host system
Date: Sat, 18 Jan 2014 20:23:45 +0100 [thread overview]
Message-ID: <1390073027-14239-9-git-send-email-s.martin49@gmail.com> (raw)
In-Reply-To: <1390073027-14239-1-git-send-email-s.martin49@gmail.com>
Because the mkpasswd provided by some distribution does not support all
options used in the mkusers script, mkpasswd has been integrated as a
package.
However, using a custom rootfs skeleton, the host-mkpasswd target is not
automatically built, even if some packages add users.
In this case, to help the Buildroot users understanding what happen when
the mkpasswd from the host system is used (so, might fail), mkusers now
print a warning message explaining how to solve this.
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
support/scripts/mkusers | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/support/scripts/mkusers b/support/scripts/mkusers
index 3b287b8..dd011eb 100755
--- a/support/scripts/mkusers
+++ b/support/scripts/mkusers
@@ -52,6 +52,22 @@ PASSWD_METHOD="$( sed -r -e '/^BR2_TARGET_GENERIC_PASSWD_METHOD="(.*)"$/!d;'
)"
#----------------------------------------------------------------------------
+check_mkpasswd() {
+ local mkpasswd_path="$(readlink -f $(which mkpasswd 2>/dev/null))"
+ local host_dir="$(readlink -f "${HOST_DIR}")"
+ case "${mkpasswd_path}" in
+ "${host_dir}"*) ;;
+ *)
+ error \
+ "WARNING: using mkpasswd from the host system: '%s'. %s%s%s\n" \
+ "${mkpasswd_path}" \
+ "To avoid build failures because of unsupported options by " \
+ "your host system's mkpasswd, make sure to use the one " \
+ "Buildroot provides, by building the 'host-mkpasswd' target."
+ ;;
+ esac
+}
+#----------------------------------------------------------------------------
get_uid() {
local username="${1}"
@@ -264,6 +280,7 @@ add_user_to_group() {
encode_password() {
local passwd="${1}"
+ check_mkpasswd
mkpasswd -m "${PASSWD_METHOD}" "${passwd}"
}
--
1.8.5.3
next prev parent reply other threads:[~2014-01-18 19:23 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-18 19:23 [Buildroot] [PATCH 00/10] Misc fixes Samuel Martin
2014-01-18 19:23 ` [Buildroot] [PATCH 01/10] eigen: add C++ toolchain dependency Samuel Martin
2014-01-18 19:49 ` Yann E. MORIN
2014-01-19 20:16 ` Peter Korsgaard
2014-01-18 19:23 ` [Buildroot] [PATCH 02/10] transmission: add url in Config.in Samuel Martin
2014-01-18 19:50 ` Yann E. MORIN
2014-01-19 20:16 ` Peter Korsgaard
2014-01-18 19:23 ` [Buildroot] [PATCH 03/10] transmission: use <PKG>_INSTALL_INIT_SYSV infra instead of custom hook Samuel Martin
2014-01-18 19:52 ` Yann E. MORIN
2014-01-19 20:19 ` Peter Korsgaard
2014-01-18 19:23 ` [Buildroot] [PATCH 04/10] pkg-cmake.mk: build shared library when !BR2_PREFER_STATIC_LIB Samuel Martin
2014-01-19 20:28 ` Peter Korsgaard
2014-01-24 0:08 ` Yann E. MORIN
2014-01-18 19:23 ` [Buildroot] [PATCH 05/10] qt: add an option to install the test module Samuel Martin
2014-02-11 20:06 ` Samuel Martin
2014-01-18 19:23 ` [Buildroot] [PATCH 06/10] opencv: fix qt selection when highgui is enable Samuel Martin
2014-02-11 20:07 ` Samuel Martin
2014-01-18 19:23 ` [Buildroot] [PATCH 07/10] connman: add systemd unit file Samuel Martin
2014-01-18 19:56 ` Yann E. MORIN
2014-01-18 22:19 ` Lucas De Marchi
2014-01-18 19:23 ` Samuel Martin [this message]
2014-01-19 20:29 ` [Buildroot] [PATCH 08/10] support: mkusers: add warning when using mkpasswd from the host system Peter Korsgaard
2014-01-19 21:29 ` Yann E. MORIN
2014-01-18 19:23 ` [Buildroot] [PATCH 09/10] urg: make sdl support optional Samuel Martin
2014-01-18 20:00 ` Yann E. MORIN
2014-01-19 20:31 ` Peter Korsgaard
2014-01-18 19:23 ` [Buildroot] [PATCH 10/10] hostapd: fix static build failure Samuel Martin
2014-01-18 20:05 ` Yann E. MORIN
2014-02-10 11:53 ` Samuel Martin
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=1390073027-14239-9-git-send-email-s.martin49@gmail.com \
--to=s.martin49@gmail.com \
--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