From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7148049090165604352 X-Received: by 2002:a05:6808:10d4:b0:350:9a8d:d411 with SMTP id s20-20020a05680810d400b003509a8dd411mr2752610ois.221.1664313277310; Tue, 27 Sep 2022 14:14:37 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a54:4f94:0:b0:34f:7989:33d with SMTP id g20-20020a544f94000000b0034f7989033dls1015027oiy.6.-pod-prod-gmail; Tue, 27 Sep 2022 14:14:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fMOUDxK/llISZqu5UdyFKgl8l4YvgqCLguF75+AIDukxS3ViGNqrKrBBgLpkSapssqASg X-Received: by 2002:a05:6808:f8e:b0:351:a39:e7ca with SMTP id o14-20020a0568080f8e00b003510a39e7camr2670210oiw.269.1664313276758; Tue, 27 Sep 2022 14:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664313276; cv=none; d=google.com; s=arc-20160816; b=kcODTeFsJIIRItUXUH4a2G1kRYm8Pse2wENVgvjR/42KI5xKL0KophIz1nBOTjfCzb WsUUTCwkAM301jH/qEtFGPK6G/YzGj1u5wzFRC4N2cVc1wZ7SGZex0I/mvVZYj8lypFW mQKYv8BHJGi5/zIub5OMT/PkCdZ21ZBfw1VREl5WU4G3rlm/GEz1T9c7rRHFHzkKaANt 04PTap3vDQUhlxk9W7Ek1I+O1nbwS5yz5jScOwmE5nsrE9UqUPe+2bKTqLLZX5LmJnV3 HxhIZbYQCH6sbmLsGEfMg+tSwQYjKFb4sXPBx3sRS9i4n5CWrxqf6sYd0YYp+eMXstQW aYrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ILSSSSgtlSWdPJ2dByKM6L/MsWzjtMWaeNFtLgpW30w=; b=RV4VPtDlB0rDe2/3UxwH2uDb5pFF4pCLBFXKO5IWXh8D+Aq88Ur36yGZk1rl1cF4Ta Ht+7vYR+ILr6H7Khwi/9vgpr3mFIgXdvYKkJpUgA//2iD90rRgYwknDViHDpo6maH6t5 WIzTtquy9uKaPdPdNkp1xkEOwqw9hhj0OCahSqY9NgoGJ8+SEu+vO5i5qMC4MvF6ODWs Yc49raq11uysXoDSoeXgF8ImSFcaXBz/vACXYt8L7fafi3BAX2WZW4X3OVZ9XjZgt4VC pNVDKfgEj/i64z0qycGCA6RATiEOnb75J44C+p+34T0NkoF4JuEX53rghcip6cF9Q+vp ADTw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jFReCsEv; spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::d30 as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com. [2607:f8b0:4864:20::d30]) by gmr-mx.google.com with ESMTPS id o2-20020aca5a02000000b003504d4fcb12si122454oib.0.2022.09.27.14.14.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Sep 2022 14:14:36 -0700 (PDT) Received-SPF: pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::d30 as permitted sender) client-ip=2607:f8b0:4864:20::d30; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jFReCsEv; spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::d30 as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: by mail-io1-xd30.google.com with SMTP id n192so7578948iod.3 for ; Tue, 27 Sep 2022 14:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date; bh=ILSSSSgtlSWdPJ2dByKM6L/MsWzjtMWaeNFtLgpW30w=; b=jFReCsEvI8GmzyDi6Gvf4mioAyxjBoXitrwIu5pTPhMHmtwJaD4IoPrCtWSxNJIxXX 1mCsrC6VvdYNmGWbcJczbAD9bjtIUeLvPYplEniDtyN3kLSELwjB9WUNmpkHukbCyu+d EUISveOyVoYctMrzjwbrDXnJ7Q1+Ku9THj0Nuh3KOivTKUHTXT547F5sRXifayADoxSi IVGoQTgfUXg8i0lKUWrzwNbage2DuW/wplJOCYVnLcGAygmaefrUtz0A2Mq3LIlZoPcK ObHmdvehjVziNgUPWqkoI27YUFguQKE1dswt+FqkiVvg1qwdDjPyx+yvqYgxVVvkxlww anhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date; bh=ILSSSSgtlSWdPJ2dByKM6L/MsWzjtMWaeNFtLgpW30w=; b=rE/uOIF109bqCcunEOyTukcD+BlemNx+X1gByfhpAEz5mUwKgKNRfhH3Y+doQMA3WX wJBnxN+w7c9keXr5SUG07vmiKVvKvHDN0K40EbgaxaBvx3us8Nt6T1ZVewaqy/VpXltq gi2tv+uBuTY4CUsoeS3FGtuzBlZ0qaWrqvLMOacRiYun9ydcWBk8fyB8Gug8ruD4na33 DYm+kKrzLnjPi0x3aOW583kj+H1fdwfYgamc75GYIxKlK78fswwS07YFgWY9FLP4Xi1l ekso/TS3NSlOro8Aqar/4aoFqIS9DlnaNMcczOznoTTeKWnMAHNy1ilniJS8Qmi8i2qZ cgJA== X-Gm-Message-State: ACrzQf26+41jihwbgc5oeGjsN6/IXUHH3dyS6y8NSi54tNm9qoqPSlxj Qv+a3rJgygk6sC7PP8wcX1bs19OWrYLIcZxGspCDuEMTkQHc X-Received: by 2002:a05:6638:24d6:b0:35a:632a:f8a2 with SMTP id y22-20020a05663824d600b0035a632af8a2mr16448677jat.262.1664313276130; Tue, 27 Sep 2022 14:14:36 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Roberto A. Foglietta" Date: Tue, 27 Sep 2022 23:13:59 +0200 Message-ID: Subject: Re: rules.tmpl how to exec a cmd as root To: isar-users@googlegroups.com Content-Type: multipart/alternative; boundary="0000000000009e6ac905e9af215b" X-TUID: +rw2z4fB7EDz --0000000000009e6ac905e9af215b Content-Type: text/plain; charset="UTF-8" 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: :-) diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass index c92ea7d..a8b4823 100644 --- a/meta/classes/dpkg.bbclass +++ b/meta/classes/dpkg.bbclass @@ -92,6 +92,7 @@ dpkg_runbuild() { --no-run-lintian --no-run-piuparts --no-run-autopkgtest --resolve-alternatives \ --chroot-setup-commands="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 -arf /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" \ Best, R- --0000000000009e6ac905e9af215b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Il giorno mar 27 set 2022 alle ore 16:59 Roberto A. Foglie= tta <roberto.foglietta@gm= ail.com> ha scritto:
>
> Il Mar 27 Set 2022, 15:20 Rober= to A. Foglietta <roberto.= foglietta@gmail.com> ha scritto:
>>
>> Dear all,>>
>> =C2=A0I found another corner case about compiling a = 3rd party driver into ISAR and I need to execute a command at make level bu= t as root. Unfortunately su cannot authenticate seamlessly and without the = root permission the command fails. Suggestions?
>>
>> ove= rride_dh_auto_build:
>> =C2=A0 =C2=A0 =C2=A0 sudo cp -arf /usr/lib= /modules/*/source/* /usr/lib/modules/*/build/
>> =C2=A0 =C2=A0 =C2= =A0 =C2=A0cp -arf /usr/lib/modules/*/source/* /usr/lib/modules/*/build/
= >> =C2=A0 =C2=A0 =C2=A0 =C2=A0$(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 at= tached, in the commented line a generalisation).


This single cha= nge open a wild wide playground of possibilities in running arbitrary stuff= as root in sbuild/make environment:
:-)

diff --git a/meta/classe= s/dpkg.bbclass b/meta/classes/dpkg.bbclass
index c92ea7d..a8b4823 100644=
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@= @ -92,6 +92,7 @@ dpkg_runbuild() {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--n= o-run-lintian --no-run-piuparts --no-run-autopkgtest --resolve-alternatives= \
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--chroot-setup-commands=3D"rm = -f /var/log/dpkg.log" \
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--chroot-= setup-commands=3D"cp -n --no-preserve=3Downer ${ext_deb_dir}/*.deb -t = ${deb_dir}/ || :" \
+=C2=A0 =C2=A0 =C2=A0 =C2=A0--chroot-setup-comm= ands=3D"cp -arf /bin/chmod /bin/s.chmod; chmod +s /bin/s.chmod" \=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--finished-build-commands=3D"rm = -f ${deb_dir}/sbuild-build-depends-main-dummy_*.deb" \
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0--finished-build-commands=3D"cp -n --no-preser= ve=3Downer ${deb_dir}/*.deb -t ${ext_deb_dir}/ || :" \
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0--finished-build-commands=3D"cp /var/log/dpkg.= log ${ext_root}/dpkg_partial.log" \

Best, R-
--0000000000009e6ac905e9af215b--