Message ID | 1390073027-14239-9-git-send-email-s.martin49@gmail.com |
---|---|
State | Rejected |
Headers | show |
>>>>> "Samuel" == Samuel Martin <s.martin49@gmail.com> writes: > 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. Why not just fix it to always use our mkpasswd? E.G. something like adding host-mkpasswd to dependencies in fs/common.mk if PACKAGE_USERS isn't empty? > 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 > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
Peter, All, On 2014-01-19 21:29 +0100, Peter Korsgaard spake thusly: > >>>>> "Samuel" == Samuel Martin <s.martin49@gmail.com> writes: > > > 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. > > Why not just fix it to always use our mkpasswd? E.G. something like > adding host-mkpasswd to dependencies in fs/common.mk if PACKAGE_USERS > isn't empty? We've already spoke about it with Samuel on IRC, and I was rather leaning toward this: if the user uses a custom skeleton, lets just rely on him to provide a proper set of users. As an afterthought, I think this would not be correct from us, and that we should indeed continue to generate those users. So, agreed with Peter on that one. Sorry Samuel... :-) Regards, Yann E. MORIN.
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}" }
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(+)