From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6558749580291211264 X-Received: by 2002:a19:51c9:: with SMTP id g70-v6mr434138lfl.10.1527176732134; Thu, 24 May 2018 08:45:32 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:900e:: with SMTP id h14-v6ls2593666ljg.11.gmail; Thu, 24 May 2018 08:45:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZowZY19zlv+7+1pkDmPaUjxWTex+1X0WG1bNOfw3IgT97FOk8tYBdduCFhN59ijScWK3IIa X-Received: by 2002:a2e:7210:: with SMTP id n16-v6mr446254ljc.35.1527176731872; Thu, 24 May 2018 08:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527176731; cv=none; d=google.com; s=arc-20160816; b=FBBMohn/xHFy3BFh3ZoNtikjIspc+i9WQ6R7zV8Jcxu6p7vYSCpNPi8Xr4xwqBROur IKNJUij78J+9xERt61OAons9DnOl0JNcjXnFOwLMgMl7aE/hC7k1yv1xwibD3MfxZ/lZ qwirfkWXxPqx6+D9evDkwhX1HPL84y+6CjkJx9jN8omFi8uI8XPmtYm0B0EQMl/FKHEu hg8XD+nr0PfBb5yAu2WjWBtst0XW+t72yKRj1dCGZU1ADY0pQXX6mhmaqNcBXihTvMYW 6W3IrzbiO5LEuR9CkWYpb/jjvgRq5T6vj+bBzzgnj1KaNxLFjk7cDpOOnvncUTlO9oa0 PFUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:arc-authentication-results; bh=52taiOej/bXd1gqgjqcRk8C4hBFYzec/QmZDCGjow9A=; b=p+jFusjt4kim0neB+oFnpEngDDVwI1gGMVhKvq8uLpFvT95lrAHZVIRq6MI0860hiq jxe/41uuRxUSE+BL5qtAzFP04b/DAxOD07OmlZDZ1Dca8ZQwjx3Ys0aefLFuFtHID+IT NIW02a1cZl8obUg8mhFETWx+Um33SpwbZHXubpgBH1vXlkI8VeB5EzDLapFQLX/mzBVE eXz7Og6n2WOx3EFMa35qcc25URUyQPkTtFdfnm+tk3ZCwWR4OVI4WQZQ1ipZjnLIKems 49X19OzrmEhTw81AQnDFNRQTvXLjnAvGhcYPH9S4Ga+/0rVMAupI3smlp5tUvKT5lRjS DHaA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Return-Path: Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id n24-v6si834941lfh.5.2018.05.24.08.45.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 08:45:31 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.14 as permitted sender) client-ip=192.35.17.14; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id w4OFjUXw012924 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 May 2018 17:45:30 +0200 Received: from md1pvb1c.ad001.siemens.net (md1pvb1c.ad001.siemens.net [139.25.68.40]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id w4OFjUHg025920; Thu, 24 May 2018 17:45:30 +0200 Date: Thu, 24 May 2018 17:45:29 +0200 From: Henning Schild To: "[ext] claudius.heine.ext@siemens.com" Cc: , Claudius Heine Subject: Re: [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option Message-ID: <20180524174529.7571e20e@md1pvb1c.ad001.siemens.net> In-Reply-To: <20180524142635.5814-2-claudius.heine.ext@siemens.com> References: <20180524142635.5814-1-claudius.heine.ext@siemens.com> <20180524142635.5814-2-claudius.heine.ext@siemens.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: INyrWw29jxrO 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 > }