public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
To: isar-users@googlegroups.com
Subject: Re: rules.tmpl how to exec a cmd as root
Date: Wed, 28 Sep 2022 00:03:54 +0200	[thread overview]
Message-ID: <CAJGKYO5S0nC4xiSvBXGNz5oYOszWGtd=SO6tdAHWk533Cm9DYg@mail.gmail.com> (raw)
In-Reply-To: <CAJGKYO4T3wHgOGKVnv9QRHomt56fYiKR2Lf0NGA5=VUYGJzrjw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2383 bytes --]

Il giorno mar 27 set 2022 alle ore 23:13 Roberto A. Foglietta <
roberto.foglietta@gmail.com> ha scritto:

> Il giorno mar 27 set 2022 alle ore 16:59 Roberto A. Foglietta <
> roberto.foglietta@gmail.com> ha scritto:
> >
> > Il Mar 27 Set 2022, 15:20 Roberto A. Foglietta <
> roberto.foglietta@gmail.com> ha scritto:
> >>
> >> Dear all,
> >>
> >>  I found another corner case about compiling a 3rd party driver into
> ISAR and I need to execute a command at make level but as root.
> Unfortunately su cannot authenticate seamlessly and without the root
> permission the command fails. Suggestions?
> >>
> >> override_dh_auto_build:
> >>       sudo cp -arf /usr/lib/modules/*/source/* /usr/lib/modules/*/build/
> >>        cp -arf /usr/lib/modules/*/source/* /usr/lib/modules/*/build/
> >>        $(MAKE) -n modules ${PARALLEL_MAKE}
> >
> >
> > The problem of Executing commands with root priviledge in the sbuild, I
> have solved using chmod +s the command (cfr. the patch attached, in the
> commented line a generalisation).
>
>
> This single change open a wild wide playground of possibilities in running
> arbitrary stuff as root in sbuild/make environment:
> :-)
>

Also a ldconfig is appreciated. In fact, trying to use "su" - which is not
configured to be used without password - a lacks of ldconfig emerges

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index c92ea7d..8aad4fb 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -90,8 +90,9 @@ dpkg_runbuild() {
     sbuild -A -n -c ${SBUILD_CHROOT} --extra-repository="${ISAR_APT_REPO}"
\
         --host=${PACKAGE_ARCH} --build=${SBUILD_HOST_ARCH} ${profiles} \
         --no-run-lintian --no-run-piuparts --no-run-autopkgtest
--resolve-alternatives \
-        --chroot-setup-commands="rm -f /var/log/dpkg.log" \
+        --chroot-setup-commands="ldconfig; rm -f /var/log/dpkg.log" \
         --chroot-setup-commands="cp -n --no-preserve=owner
${ext_deb_dir}/*.deb -t ${deb_dir}/ || :" \
+        --chroot-setup-commands="cp -paf /bin/chmod /bin/s.chmod && chmod
+s /bin/s.chmod" \
         --finished-build-commands="rm -f
${deb_dir}/sbuild-build-depends-main-dummy_*.deb" \
         --finished-build-commands="cp -n --no-preserve=owner
${deb_dir}/*.deb -t ${ext_deb_dir}/ || :" \
         --finished-build-commands="cp /var/log/dpkg.log
${ext_root}/dpkg_partial.log" \

Cheers, R-

[-- Attachment #2: Type: text/html, Size: 3194 bytes --]

  reply	other threads:[~2022-09-27 22:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AM0PR10MB20205FF67C22F88DC3BE525BAA559@AM0PR10MB2020.EURPRD10.PROD.OUTLOOK.COM>
2022-09-27 13:20 ` Roberto A. Foglietta
2022-09-27 14:59   ` Roberto A. Foglietta
2022-09-27 21:13     ` Roberto A. Foglietta
2022-09-27 22:03       ` Roberto A. Foglietta [this message]
2022-09-28  9:37   ` Henning Schild
2022-09-28 14:45     ` Roberto A. Foglietta

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='CAJGKYO5S0nC4xiSvBXGNz5oYOszWGtd=SO6tdAHWk533Cm9DYg@mail.gmail.com' \
    --to=roberto.foglietta@gmail.com \
    --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