From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6558749580291211264 X-Received: by 2002:a2e:854c:: with SMTP id u12-v6mr849683ljj.6.1527580726488; Tue, 29 May 2018 00:58:46 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a19:5511:: with SMTP id n17-v6ls1362156lfe.6.gmail; Tue, 29 May 2018 00:58:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJqJSd1jw9SfyplADAd2qccp56oLLlvvViveoEsHQJBKDXkluo3v6Kabw0QWftMmhDsQbT7 X-Received: by 2002:a19:a94c:: with SMTP id s73-v6mr720259lfe.35.1527580725943; Tue, 29 May 2018 00:58:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527580725; cv=none; d=google.com; s=arc-20160816; b=sE67B2fCfOUPwinpPQO2caFpb/y7ZeACFlAriJ1PgldDndO2aMCTVJKKPEYR721jg8 l+duF1EdQeNi3VNBwav4ovYcxDwKqGoPIReN0vJxuNxYBd+HEfWBrwI5y3oBL1NFrTvR HT/q1SW4sE6X1mEC6j2+Knhbj8CdXKE/MVpoqNNY/0+mTvsdosMh1hXM5sLqLeQ3lJ7c eJ4xXrXdk2IXwGFeytFOjEyVkkyjoc6L5biPcLEQBrpG5QA5c3C+evXuAmYA5k65FyHZ NT/7chbkTj0kuIb4IrqYMNfgnlHoljHEXGkyMi5XW49TqyqNQnHAdkzZmGd6ptQRxgN5 Y7jQ== 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:cc:references:to :subject:arc-authentication-results; bh=wfk8cHqPY4XA+pl46tD6OZo6wigsc5MflxYk/Rp6C4w=; b=bHbvi+Fjzk+ei+XVcWpSB+JxPtm4xWnEjjQ9ZGZu/GsMKX3wTpLVrV376sfq3RRMUq 1cqKGkXPwWNaR5442lncAOU9NxzEquKgcanJyCuwOz+xa8jrvBdRp+bBa4DWTjQytG1T BwGXpEA6BG2PgxquXz5fSSM/gX9TATdW5ANbS9BACkgtekNS5RbOgjkcaQOc9CL6kxv+ 0Ebw/q/Ut+6CRvPmvtJiQek2iq2TqVFHwop+pNgDKyyztS3gvZtdLDRMIgd27Mbrez/d oA9USnF3wZr+KV0387+PN7igRV/JUdwsJqjF0Zb77h2297osaiaCoMQdPDUOKX1RE4F5 O1Rw== 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 i26-v6si1521071ljj.2.2018.05.29.00.58.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 00:58:45 -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 w4T7wfgi024569 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 29 May 2018 09:58:43 +0200 Subject: Re: [PATCH v4 1/3] isar-bootstrap|configscript: implement one shot config option To: claudius.heine.ext@siemens.com References: <20180528105643.23518-1-claudius.heine.ext@siemens.com> <20180528105643.23518-2-claudius.heine.ext@siemens.com> Cc: isar-users@googlegroups.com, Claudius Heine From: "Maxim Yu. Osipov" Organization: ilbers GmbH Message-ID: <6193ea08-16c2-b1be-c0d5-f571ff99d9db@ilbers.de> Date: Tue, 29 May 2018 09:58:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180528105643.23518-2-claudius.heine.ext@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: 6aMmlAgjdEJO Hi Claudius, On 05/28/2018 12:56 PM, claudius.heine.ext@siemens.com wrote: > 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 | 32 ++++++++++++++++--- > 3 files changed, 28 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..b87c94e 100644 > --- a/meta/classes/isar-bootstrap-helper.bbclass > +++ b/meta/classes/isar-bootstrap-helper.bbclass > @@ -5,15 +5,24 @@ > # > # SPDX-License-Identifier: MIT > > +IMAGE_CFG_PACKAGE ??= "" Are you going to rename this variable to IMAGE_CFG_PACKAGES and add a comment it in a separate patch? Kind regards, Maxim. > + > +def reverse_bb_array(d, varname): > + array = d.getVar(varname, True) > + if array is None: > + return None > + array = reversed(array.split()) > + return " ".join(i for i in array) > + > 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 +50,23 @@ 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 > + done > + for pkg in ${@reverse_bb_array(d, "IMAGE_CFG_PACKAGE") or ""}; do > + sudo -E chroot "$ROOTFSDIR" \ > + /usr/bin/apt-get purge --yes $pkg > + done > + 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