From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Henning Schild <henning@hennsch.de>,
Henning Schild <henning.schild@siemens.com>
Subject: [PATCH 1/2] buildchroot: Enter buildchroot with right user:group directly
Date: Thu, 22 Nov 2018 10:38:17 +0100 [thread overview]
Message-ID: <20181122093818.21909-1-henning.schild@siemens.com> (raw)
From: Henning Schild <henning@hennsch.de>
Instead of using "su" use "chroot --userspec". That should also be the
pattern for other chroot users that do not need root. i.e. kernel build
and upcoming "apt-get source" fetcher.
This way we can skip all the chowning we had/have to do otherwise.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/dpkg.bbclass | 2 +-
meta/recipes-devtools/buildchroot/files/build.sh | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index f74c9c9..24b9fe3 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -19,5 +19,5 @@ do_install_builddeps[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
# Build package from sources using build script
dpkg_runbuild() {
E="${@ bb.utils.export_proxies(d)}"
- sudo -E chroot ${BUILDCHROOT_DIR} /isar/build.sh ${PP}/${PPS} ${DISTRO_ARCH}
+ sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} /isar/build.sh ${PP}/${PPS} ${DISTRO_ARCH}
}
diff --git a/meta/recipes-devtools/buildchroot/files/build.sh b/meta/recipes-devtools/buildchroot/files/build.sh
index f977b16..1ba394c 100644
--- a/meta/recipes-devtools/buildchroot/files/build.sh
+++ b/meta/recipes-devtools/buildchroot/files/build.sh
@@ -14,5 +14,4 @@ for i in configure aclocal.m4 Makefile.am Makefile.in; do
fi
done
-# Build the package as user "builder"
-su builder -c "cd $1; dpkg-buildpackage -a$target_arch -d --source-option=-I"
+dpkg-buildpackage -a$target_arch -d --source-option=-I
--
2.19.1
next reply other threads:[~2018-11-22 9:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-22 9:38 Henning Schild [this message]
2018-11-22 9:38 ` [PATCH 2/2] buildchroot: Assert that we are one of the two valid users Henning Schild
2018-11-23 10:24 ` Maxim Yu. Osipov
2018-11-22 10:13 ` [PATCH 1/2] buildchroot: Enter buildchroot with right user:group directly chombourger
2018-11-22 12:03 ` Henning Schild
2018-11-22 13:58 ` Henning Schild
2018-11-23 10:24 ` Maxim Yu. Osipov
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=20181122093818.21909-1-henning.schild@siemens.com \
--to=henning.schild@siemens.com \
--cc=henning@hennsch.de \
--cc=isar-users@googlegroups.com \
/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