diff options
author | Chen Qi <qi.chen@windriver.com> | 2013-10-21 10:42:29 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-10-26 15:59:17 +0100 |
commit | 7a2de0091db65bc8cacbf7b71f2301e8f113dc3a (patch) | |
tree | 7f0852988ba85e656832942dfc3dacd0f652afd3 | |
parent | e0152db7651a43b34e1ad390f07d6f3a559c861d (diff) | |
download | poky-7a2de0091db65bc8cacbf7b71f2301e8f113dc3a.tar.gz |
runqemu-extract-sdk: add --numeric-owner option to tar command
If the same username exists on both target and the build host, but
the uids differ, and we start target via NFS, then the uid for the
user will be incorrect on target.
For example, if postfix's uid on host is 119 and on target is 1024,
then if we start target via NFS, the uid for postfix will be 119.
The root cause is that when we use runqemu-extract-sdk to generate
the NFS rootfs for later use, the tar command will respect the username
instead of uid. So if PSEUDO_PASSWD environment is not set correctly,
the host /etc/passwd will be used, resulting in wrong uids.
The situation for gid is completely analogous to that of uid.
It's almost impossible for the runqemu-extract-sdk to guess the correct
location of the needed password file merely based on the target tarball
name.
This patch solves this problem by adding the '--numeric-owner' option
to the tar command so that the uid/gid will be used when extracting the
tarball using runqemu-extract-sdk. In this situation, we'll always get
the correct uid/gid after extracting the tarball.
[YOCTO #5364]
(From OE-Core rev: acce6ff1a77cfd29e3868faa89b120becb58bbbf)
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/runqemu-extract-sdk | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/runqemu-extract-sdk b/scripts/runqemu-extract-sdk index 509af66216..4ce906aef0 100755 --- a/scripts/runqemu-extract-sdk +++ b/scripts/runqemu-extract-sdk | |||
@@ -54,13 +54,13 @@ fi | |||
54 | 54 | ||
55 | TAR_OPTS="" | 55 | TAR_OPTS="" |
56 | if [[ "$ROOTFS_TARBALL" =~ tar\.bz2$ ]]; then | 56 | if [[ "$ROOTFS_TARBALL" =~ tar\.bz2$ ]]; then |
57 | TAR_OPTS="-xjf" | 57 | TAR_OPTS="--numeric-owner -xjf" |
58 | fi | 58 | fi |
59 | if [[ "$ROOTFS_TARBALL" =~ tar\.gz$ ]]; then | 59 | if [[ "$ROOTFS_TARBALL" =~ tar\.gz$ ]]; then |
60 | TAR_OPTS="-xzf" | 60 | TAR_OPTS="--numeric-owner -xzf" |
61 | fi | 61 | fi |
62 | if [[ "$ROOTFS_TARBALL" =~ \.tar$ ]]; then | 62 | if [[ "$ROOTFS_TARBALL" =~ \.tar$ ]]; then |
63 | TAR_OPTS="-xf" | 63 | TAR_OPTS="--numeric-owner -xf" |
64 | fi | 64 | fi |
65 | if [ -z "$TAR_OPTS" ]; then | 65 | if [ -z "$TAR_OPTS" ]; then |
66 | echo "Error: Unable to determine sdk tarball format" | 66 | echo "Error: Unable to determine sdk tarball format" |