From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6558749580291211264 X-Received: by 2002:a19:e308:: with SMTP id a8-v6mr327605lfh.40.1527145618993; Thu, 24 May 2018 00:06:58 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:95c1:: with SMTP id y1-v6ls2392017ljh.13.gmail; Thu, 24 May 2018 00:06:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpDJSDXAN6E2CrZe69Abdk3Rnnn0oh8K0+wyvXJEDBE790rMMp6TPK6W6ZpGUnK6q3eDRLZ X-Received: by 2002:a2e:88c1:: with SMTP id a1-v6mr317153ljk.43.1527145618503; Thu, 24 May 2018 00:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527145618; cv=none; d=google.com; s=arc-20160816; b=mv/IxnI9H2x2mBxj9nArtFRbE1blQ7/K6M68qQoWSpHunsHlK7u4NZoYo0LS6xhGrN LvY7VMNVKYfukqhLTIsgdyq/Lptag/lcdZadMxgBLD+Ty/4k7IbD/K71AZ4CIAQP1SQa tU2cffsy/8ZTJWy3iTa+F+XYoUdFlAqU3qP2BCsQ60Wy4Bi8lYhyORZlMorabVDLQ7pR ZvMhWJSJ0OuG4Vpz0oxoIhdItSm1lj9JBr2xbFoJIr4TvqigLbNkdHyXj3OjPng5aNbn Hd+sfSSW8TcdLoN7BKqRYzN7xUYtjzRi4YLU4m0xySF+b4Ybct/bZO8yBkp12clqBLLS cYQQ== 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:from:references:cc:to:subject :arc-authentication-results; bh=JNLZZFvmaiJxcHn/IaZFV8ePYK6Ad00Nts2E4f/jeOE=; b=T7k2VGbuHBlWnJOvUdu9tPYWfGNEHulv4WyC9Nh1VPzMxDR2m82M4AIQxUmC8Mpl2F 8vKZXK+OcPyrsaj9UXxavBwIAdoOabAk6KbCPqV0enmsjlDdj7sJrhG6pwpHXOjBy4vh huXLWyNmSRVoQr0hjsFtSGPtdJeVP9Js8XgVoa0uLAZO2Q2BiURROkrf8kKMVn8ZQlWH chKkl03wBromPVkpGNgRwtPinC8vhUX/irnpAqVQVfWYIbhgHuG2VGVSK5QcqIpryOGg dMuC3Sw4xP/WBBE80v1Lqe+t24MSwZNHR8eLRB2QftC/GKweSNQYQC8zY0RIYnbqoTn3 8Z/g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id n24-v6si795850lfh.5.2018.05.24.00.06.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 00:06:58 -0700 (PDT) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id w4O76vNq015300 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 May 2018 09:06:57 +0200 Received: from [139.25.69.69] (linux-ses-ext02.ppmd.siemens.net [139.25.69.69]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id w4O76ui7026720; Thu, 24 May 2018 09:06:57 +0200 Subject: Re: [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option To: Henning Schild Cc: isar-users@googlegroups.com, Claudius Heine References: <20180523131248.31907-1-claudius.heine.ext@siemens.com> <20180523131248.31907-2-claudius.heine.ext@siemens.com> <20180523160606.3a155731@md1pvb1c.ad001.siemens.net> From: Claudius Heine Message-ID: <225f79fc-bf52-4b06-fd71-9e71ae07d6a7@siemens.com> Date: Thu, 24 May 2018 09:06:56 +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: <20180523160606.3a155731@md1pvb1c.ad001.siemens.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: aZW5B5g3JfhX Hi Henning, On 2018-05-23 16:06, Henning Schild wrote: > Am Wed, 23 May 2018 15:12:46 +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..76e20f6 >> 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" > > I guess if you take the "install" out you can reuse that a few more > times. Where? I only see purge and autoremove that doesn't use it already. Replaceing '-y' with '${APT_ARGS}' there does seem like an overkill, does it not? The other options in it don't do much for purge and autoremove AFAIK. If you think of this as a general improvement to have the command outside of the 'APT_ARGS' variable for readability reasons, then I agree, but that would be a different patch. > >> - 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 >> + if [ -n "${IMAGE_CFG_PACKAGE}" ]; then >> + sudo -E chroot "$ROOTFSDIR" \ >> + /usr/bin/apt-get ${APT_ARGS} ${IMAGE_CFG_PACKAGE} > > Say we have multiple packages here, are we sure apt-get will get the > order right? > Would it make sense to use a loop to deal with potential lists and > their order? > > Henning > >> + sudo -E chroot "$ROOTFSDIR" \ >> + /usr/bin/apt-get purge -y ${IMAGE_CFG_PACKAGE} >> + fi >> + if [ "clean" = ${CLEAN} ]; then >> + sudo -E chroot "$ROOTFSDIR" \ >> + /usr/bin/apt-get autoremove --purge -y >> + sudo -E chroot "$ROOTFSDIR" \ >> + /usr/bin/apt-get clean >> + fi >> } > -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de