From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6558749580291211264 X-Received: by 2002:a19:9f8f:: with SMTP id i137-v6mr87039lfe.3.1527251161090; Fri, 25 May 2018 05:26:01 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:97cd:: with SMTP id m13-v6ls2839820ljj.8.gmail; Fri, 25 May 2018 05:26:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKY9k0hIv/FrR/rw6eHsV6G1WhDY0yqTkRuKvGOxGlD65y0s88oyvUv674MoFU0YGabrXpn X-Received: by 2002:a2e:8049:: with SMTP id p9-v6mr98143ljg.39.1527251160653; Fri, 25 May 2018 05:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527251160; cv=none; d=google.com; s=arc-20160816; b=hjucUT/eSJld4T12Xm3cbHKB3d5lXdWG+7KZEA7tpzLzDmgAaGGNJlNraq0Msh1LK3 OWqs4NDKiuY8eRWy957egce267BneptNSagA2ewA3Gi9VB8OGKXhobBX3SCWaft+/Gor WRFE9BL4fYNQVUmbBiLaLVFXPTjqqy7EPSB1XRGpkXJJ1K7hG03rYFvqYeL3pC3SReEN +ahSN4JcbF97DmsTKTJTU+870PyxC0IVXnNWxpxy7SSBVGPI6X8xX+yJr7S2OUWfgx3S O3UmLeqVEOLTAaTl+dNV2jhiAE9lQtwhCnFsThbKy50jU8cEQMWC8M7iO6RP02fJIeKA /GyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:references:cc:to :subject:arc-authentication-results; bh=lLqWRCqb75HGy0OM6TrFAakYebo17V0X25s3ePTriEQ=; b=eVBBYIzu70KdBWy0/AJ7ANCPnaLzJZUDpPJ/HDBZ0K8ZwSsM6BcAO93/TA+/XlLjpc c3zMKwxWGwc9OWhmS4pY29tTfQC17zOTP/9lN5y/q2nM6Mdj0Yl7GETbLlvJ2b/D5rsK kJsXi1oJL2q5/77roDOuCn2y8kOcdx9LVtKJVoPvUauhy8zYs2DkW+NMAJE4ZlU9ZT8x lCJA3kL+tMi70PM7xYHIzrPs6iNmkZYdvOOFfR50rXVBzN+F/eP2h02/rUdIST30P+nX Nir+SoaifOZKHylx3Ypfklw9WnARGGMiwQbhaZS4Jd2Ps4+946nC3MCq2/g4LYo1cX1U STcg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id y205-v6si749317lfa.0.2018.05.25.05.26.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 05:26:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Received: from [192.168.50.163] (d51A48A80.access.telenet.be [81.164.138.128]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id w4PCPuxQ013869 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 25 May 2018 14:25:57 +0200 Subject: Re: [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option To: Henning Schild , "[ext] claudius.heine.ext@siemens.com" Cc: isar-users@googlegroups.com, Claudius Heine References: <20180524142635.5814-1-claudius.heine.ext@siemens.com> <20180524142635.5814-2-claudius.heine.ext@siemens.com> <20180524174529.7571e20e@md1pvb1c.ad001.siemens.net> From: "Maxim Yu. Osipov" Organization: ilbers GmbH Message-ID: Date: Fri, 25 May 2018 14:25:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180524174529.7571e20e@md1pvb1c.ad001.siemens.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: haZLw4o/Wv+V Hi Claudius, I've a short question and suggestion before I can start procedure of testing/applying this patch set to the tree. Are you going to correct looping order when purging (as Henning pointed out see his email below) in the next version of series or provide this later as a separate patch? In any case it would be better to rename IMAGE_CFG_PACKAGE to IMAGE_CFG_PACKAGES and add short description (like purpose of this variable) to definition of IMAGE_CFG_PACKAGE(S) in isar-bootstrap-helper.bbclass. Let's improve code readability for other people. Kind regards, Maxim. On 05/24/2018 05:45 PM, Henning Schild wrote: > Am Thu, 24 May 2018 16:26:33 +0200 > schrieb "[ext] claudius.heine.ext@siemens.com" > : > >> From: Claudius Heine >> >> Some configuration tasks on the image require certain other packages, >> but those packages might not be required on the final image. >> >> One way to solve this is use a special package that is installed to >> the image and then removed again. When installing it makes certain >> that all required packages are installed to the image as well. Then >> the image can be configured in the postinst hook. When this package >> is removed and all unused dependencies are removed as well, no not >> required packages used by this package should remain on the image. >> >> Signed-off-by: Claudius Heine >> --- >> .../images/files/debian-configscript.sh | 1 - >> .../images/files/raspbian-configscript.sh | 1 - >> meta/classes/isar-bootstrap-helper.bbclass | 23 >> +++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) >> >> diff --git >> a/meta-isar/recipes-core/images/files/debian-configscript.sh >> b/meta-isar/recipes-core/images/files/debian-configscript.sh index >> 7ca0562..9b3ff30 100755 --- >> a/meta-isar/recipes-core/images/files/debian-configscript.sh +++ >> b/meta-isar/recipes-core/images/files/debian-configscript.sh @@ -40,4 >> +40,3 @@ fi # Purge unused locale and installed packages' .deb files >> localepurge >> -apt-get clean >> diff --git >> a/meta-isar/recipes-core/images/files/raspbian-configscript.sh >> b/meta-isar/recipes-core/images/files/raspbian-configscript.sh index >> b240de9..448dea5 100644 --- >> a/meta-isar/recipes-core/images/files/raspbian-configscript.sh +++ >> b/meta-isar/recipes-core/images/files/raspbian-configscript.sh @@ >> -40,4 +40,3 @@ kernel=$KERNEL_IMAGE EOF >> localepurge >> -apt-get clean >> diff --git a/meta/classes/isar-bootstrap-helper.bbclass >> b/meta/classes/isar-bootstrap-helper.bbclass index 4284d02..1d21831 >> 100644 --- a/meta/classes/isar-bootstrap-helper.bbclass >> +++ b/meta/classes/isar-bootstrap-helper.bbclass >> @@ -5,15 +5,17 @@ >> # >> # SPDX-License-Identifier: MIT >> >> +IMAGE_CFG_PACKAGE ??= "" >> + >> setup_root_file_system() { >> ROOTFSDIR="$1" >> - CLEANHOSTLEAK="$2" >> + CLEAN="$2" >> shift >> shift >> PACKAGES="$@" >> APT_ARGS="install --yes --allow-unauthenticated \ >> -o Debug::pkgProblemResolver=yes" >> - CLEANHOSTLEAK_FILES="${ROOTFSDIR}/etc/hostname >> ${ROOTFSDIR}/etc/resolv.conf" >> + CLEAN_FILES="${ROOTFSDIR}/etc/hostname >> ${ROOTFSDIR}/etc/resolv.conf" >> sudo cp -Trpfx \ >> "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${DISTRO}-${DISTRO_ARCH}/" >> \ @@ -41,8 +43,21 @@ setup_root_file_system() { >> -o Dir::Etc::sourceparts="-" \ >> -o APT::Get::List-Cleanup="0" >> sudo -E chroot "$ROOTFSDIR" \ >> - /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES >> - [ "clean" = ${CLEANHOSTLEAK} ] && sudo rm -f >> ${CLEANHOSTLEAK_FILES} >> + /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES \ >> + ${IMAGE_CFG_PACKAGE} >> + [ "clean" = ${CLEAN} ] && sudo rm -f ${CLEAN_FILES} >> sudo -E chroot "$ROOTFSDIR" \ >> /usr/bin/apt-get ${APT_ARGS} $PACKAGES >> + for pkg in ${IMAGE_CFG_PACKAGE}; do >> + sudo -E chroot "$ROOTFSDIR" \ >> + /usr/bin/apt-get ${APT_ARGS} $pkg >> + sudo -E chroot "$ROOTFSDIR" \ >> + /usr/bin/apt-get purge --yes $pkg >> + done > > Sorry for not pointing that out the first time. But if we loop we > should probably do that twice, on the purge in reverse order. > > Henning > >> + if [ "clean" = ${CLEAN} ]; then >> + sudo -E chroot "$ROOTFSDIR" \ >> + /usr/bin/apt-get autoremove --purge --yes >> + sudo -E chroot "$ROOTFSDIR" \ >> + /usr/bin/apt-get clean >> + fi >> } > -- Maxim Osipov ilbers GmbH Maria-Merian-Str. 8 85521 Ottobrunn Germany +49 (151) 6517 6917 mosipov@ilbers.de http://ilbers.de/ Commercial register Munich, HRB 214197 General Manager: Baurzhan Ismagulov