From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6558749580291211264 X-Received: by 2002:a2e:908d:: with SMTP id l13-v6mr839304ljg.23.1527582046498; Tue, 29 May 2018 01:20:46 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a19:4d53:: with SMTP id a80-v6ls3555936lfb.2.gmail; Tue, 29 May 2018 01:20:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKInwgYK+u7Ocrg2WkC3yK5WctRkWejPrLz0ux/Ki7fnz3U/2FKUDFDx5iP94/jA4jaCIgMj X-Received: by 2002:a19:18a2:: with SMTP id 34-v6mr744691lfy.0.1527582046054; Tue, 29 May 2018 01:20:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527582046; cv=none; d=google.com; s=arc-20160816; b=KCNHtDRCWn78Het9lllxjwrA14pGNy03MIH39wqgaj56YVUKsODYNbAYHsfaaZyKo9 hDJBDVY+GXxvMGNcc/rJYaVoYFSt9Ayes+B6MBguwyJ87K2Ob/AjGNKvlIG+7+5dHzzW A/Wg5uoxH1khJPWxOML9g14t/Wq2RcPcoCzTnkQaQ258g92HAkaIDFoSsQA4hRsjobB2 7adU4kR41fZLhe1lq/bxEAkwWFPxqeSzZ4FHFYJTEwyCPwyXFPg5JUXYDPtqiTSFFqR9 i/uhMpZ3YUDzpTZGTxqJkOObzm5eB20D5tjQIbkXEEKHiGrvOmZY/OHa4g+KXbnz/EZ5 VKug== 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=NNqgcZPod2MHhwNmGK6JD+NWKRZl5O76/fU/Da0Rpvk=; b=mUux2zfn9fDAVcocqKuxwmFQiA3Bu82k2xppHpIX8agfLNEYUxzDDUJ89JupUXk3C7 nw17gddvB1DrTeoALUcffK5gI6ajmMuqG6zURWqVDqe3Y1AJ8SCvsBMRMiD1MAra1LOh Sd4B7oF9578/tPy8wEIR5QuArsPhK7wAQ7MRgARbtRLpQA5ujyVszT6r/nh4ar5wTbdA 0Nxa0NWDz5mAbPaU+N+kJkK/Dodo7yXTTkeE0zSx3OKwbxJMJdB6HVLApiFy3wXIJ/Eu jUG745Q0rnC7dlfE67qGbq0bkTs2lA3+UXOoJiPdpfgOPR1w1RBimv+W4W77539E9dws sN5A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Return-Path: Received: from gecko.sbs.de (gecko.sbs.de. [194.138.37.40]) by gmr-mx.google.com with ESMTPS id y205-v6si1014030lfa.0.2018.05.29.01.20.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 01:20:46 -0700 (PDT) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.40 as permitted sender) client-ip=194.138.37.40; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id w4T8Kd9p003511 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 May 2018 10:20:44 +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 w4T8KcR0002528; Tue, 29 May 2018 10:20:38 +0200 Subject: Re: [PATCH v4 1/3] isar-bootstrap|configscript: implement one shot config option To: "Maxim Yu. Osipov" Cc: isar-users@googlegroups.com, Claudius Heine References: <20180528105643.23518-1-claudius.heine.ext@siemens.com> <20180528105643.23518-2-claudius.heine.ext@siemens.com> <6193ea08-16c2-b1be-c0d5-f571ff99d9db@ilbers.de> From: Claudius Heine Message-ID: Date: Tue, 29 May 2018 10:20:38 +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: <6193ea08-16c2-b1be-c0d5-f571ff99d9db@ilbers.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TUID: PWhBvygnHXGM Hi Maxim, On 2018-05-29 09:58, Maxim Yu. Osipov wrote: > 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? Oh, sorry. Forgot about that. I will prepare v5. Claudius > > 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 >>   } >> > > -- 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