From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7148049090165604352 X-Received: by 2002:a05:620a:2683:b0:6cf:3a7e:e006 with SMTP id c3-20020a05620a268300b006cf3a7ee006mr19312024qkp.474.1664316272163; Tue, 27 Sep 2022 15:04:32 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:622a:2585:b0:344:94bf:7994 with SMTP id cj5-20020a05622a258500b0034494bf7994ls2624335qtb.0.-pod-prod-gmail; Tue, 27 Sep 2022 15:04:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4sYTO01CjEvhDWyCPcCH77rX8nECtpVX7zXGDeVvlz2pZ7X6LWYGr0/D9fGxrJlfbqttDP X-Received: by 2002:a05:622a:28e:b0:35d:498f:583a with SMTP id z14-20020a05622a028e00b0035d498f583amr6895938qtw.176.1664316271502; Tue, 27 Sep 2022 15:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664316271; cv=none; d=google.com; s=arc-20160816; b=eop60Nv5oVw8pvw/gyr8HZyiJpYJIz79LYzzTCov/2uC2PCh2bzyVKuA3xdjNlypZS YlvWUy8qR0KGQ3GvxXN3kFu8vNyNH8PJdoDlwd6sNutfow8vSJaCCWQbHOe0Ip38ZaZ6 I8FyvwMOnMasVw5TdCDE9+k3iWQejR8lX2NJlQYHSX2G+SANF8QMk2rL4xCxY1l5uhSM SjlmJTQ/DmuSfATMeEfQxPwzElYx9CMo7djh0LD6/zztyfmbYdOpJWzjFNpOkk3vtTDS Qimfkbu1yI2C836M8velYQ4RevdOx1gUlSXMpia27aAQLRWnJNPfJBsg5QFEWR+MmrRV tWTw== 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=vhgEb/t6swiYCr07VSlAF7BjZ0bc4sfNIj0vCSgwXXc=; b=g7RmnjCCva70IZVbm86lDczvqmtcgeAZGlsZATvH+sNDBh5nZj0yPSRLYMhK/bBO67 Plg1Fnck75RfOFc11kQIEzZdcGNVwaviF0a8a2u+0qauHxTnYH4PBOrlG9IgJgBQBXu0 0I1Tl4hkDRgdfb0eoT6/+Bryma8I3dGNV5o6urdTCne2OYOriBKDbbepcPSH5xe520ym 7jfROng1l9pghvu8OBWdsUne800QXCATTtMsV4NGW39pFGNxsm1kCKRRVrLFa6oaebn4 cDIVjYSurERTBtLgGuzw+p/NyCdI4dqDZX/UHbKotrk707dJTHvrorU2f2pNvZ7oLv/9 wRXw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Yqul0NRO; spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::134 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-il1-x134.google.com (mail-il1-x134.google.com. [2607:f8b0:4864:20::134]) by gmr-mx.google.com with ESMTPS id bt11-20020ac8690b000000b0031ecf06e367si123024qtb.1.2022.09.27.15.04.31 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Sep 2022 15:04:31 -0700 (PDT) Received-SPF: pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::134 as permitted sender) client-ip=2607:f8b0:4864:20::134; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Yqul0NRO; spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::134 as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: by mail-il1-x134.google.com with SMTP id r5so4361614ilm.10 for ; Tue, 27 Sep 2022 15:04:31 -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=vhgEb/t6swiYCr07VSlAF7BjZ0bc4sfNIj0vCSgwXXc=; b=Yqul0NROzD2HqvOvalltACF9Ly1USWgJcT5m1gSAZlh4X/m1VqiKxbhsdNGzShuEeG 2JbxHRSDMZd0IM5T69/xWHnOCTmmx8zTBPE1ZakBH2CB7Popb2IwRIPCLZQBlgbETQp6 uXuzwXVHerYiiRkJ6OOJk+0J3P5+dEmGththCngDl0PUD1wyUJvDwdTTdovJKzyfCdFG a/0lGcUcwR4FBiTIT/FCrETDFuAbYqdk0BHyNZW1CY1JaHG32idfVFPxF2j/GxNfPlnH rFvRDicxJm7Pyl3Ke0kGiCG2GOabHnFm3kXLGRwga4a/xKvSJuY2M0v3hF/UNcZFZS4R v2LA== 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=vhgEb/t6swiYCr07VSlAF7BjZ0bc4sfNIj0vCSgwXXc=; b=TbVMQfLxdjLVwIM9PrjtPYrr9+QbMuq8pLr5mxIhytZmnGkgwx3lhVBnn00gp0Ctdy 3oWrs2fW1PgZJl5sFfCHfDDzQnRE/9NKaCJY5D35sOBjGPBJBV/uknOTYJpJjwmt/3OH MpI77G7eNEO7wRQaqTeYqCkj11unhbjPyZX5v877bxMLATK01icj/NoHPbV5OYTEvGHE GXbSevevfyL9eFGKL+Yf5zGdb0vYxktSSMv3p8xOuqnLIlD71xmoNDCre6zTQ0dmjlHU bmYdCXCxPiHsw/kyc529TJlM+GUv/ZwogCOm6j0XhoJbB9lakiA3YXmxxDb9kymBS/L2 Lv/A== X-Gm-Message-State: ACrzQf2Rm3cXpHABxSe3xA14uaAg0FeTtY6UYYmfWWHviJOoxGp2qkH4 +3ufht0UtlV3+XCIq+9MCR1t2bWQKJh09Pr3Xb/zNXhlAeb3 X-Received: by 2002:a05:6e02:1e06:b0:2f6:2666:e8ca with SMTP id g6-20020a056e021e0600b002f62666e8camr13169687ila.173.1664316270627; Tue, 27 Sep 2022 15:04:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Roberto A. Foglietta" Date: Wed, 28 Sep 2022 00:03:54 +0200 Message-ID: Subject: Re: rules.tmpl how to exec a cmd as root To: isar-users@googlegroups.com Content-Type: multipart/alternative; boundary="0000000000001acff905e9afd4e6" X-TUID: vq7iX74aMSuZ --0000000000001acff905e9afd4e6 Content-Type: text/plain; charset="UTF-8" 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- --0000000000001acff905e9afd4e6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
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 scrit= to:
>
> Il Mar 27 Set 2022, 15:20 Roberto A. Foglietta <roberto.foglie= tta@gmail.com> ha scritto:
>>
>> Dear all,
>= >
>> =C2=A0I found another corner case about compiling a 3rd pa= rty driver into ISAR and I need to execute a command at make level but as r= oot. Unfortunately su cannot authenticate seamlessly and without the root p= ermission the command fails. Suggestions?
>>
>> override_= dh_auto_build:
>> =C2=A0 =C2=A0 =C2=A0 sudo cp -arf /usr/lib/modul= es/*/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 attach= ed, 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. I= n fact, trying to use "su" - which is not configured to be used w= ithout password - a lacks of ldconfig emerges

diff= --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index c92= ea7d..8aad4fb 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/class= es/dpkg.bbclass
@@ -90,8 +90,9 @@ dpkg_runbuild() {
=C2=A0 =C2=A0 =C2= =A0sbuild -A -n -c ${SBUILD_CHROOT} --extra-repository=3D"${ISAR_APT_R= EPO}" \
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--host=3D${PACKAGE_ARCH} = --build=3D${SBUILD_HOST_ARCH} ${profiles} \
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0--no-run-lintian --no-run-piuparts --no-run-autopkgtest --resolve-alt= ernatives \
- =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--chroot-s= etup-commands=3D"ldconfig; rm -f /var/log/dpkg.log" \
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0--chroot-setup-commands=3D"cp -n --no-prese= rve=3Downer ${ext_deb_dir}/*.deb -t ${deb_dir}/ || :" \
+ =C2=A0 = =C2=A0 =C2=A0 =C2=A0--chroot-setup-commands=3D"cp -paf /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-buil= d-depends-main-dummy_*.deb" \
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--f= inished-build-commands=3D"cp -n --no-preserve=3Downer ${deb_dir}/*.deb= -t ${ext_deb_dir}/ || :" \
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--fin= ished-build-commands=3D"cp /var/log/dpkg.log ${ext_root}/dpkg_partial.= log" \

Cheers, R-
--0000000000001acff905e9afd4e6--