public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: "[ext] claudius.heine.ext@siemens.com" <claudius.heine.ext@siemens.com>
Cc: <isar-users@googlegroups.com>, Claudius Heine <ch@denx.de>
Subject: Re: [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option
Date: Wed, 23 May 2018 16:06:06 +0200	[thread overview]
Message-ID: <20180523160606.3a155731@md1pvb1c.ad001.siemens.net> (raw)
In-Reply-To: <20180523131248.31907-2-claudius.heine.ext@siemens.com>

Am Wed, 23 May 2018 15:12:46 +0200
schrieb "[ext] claudius.heine.ext@siemens.com"
<claudius.heine.ext@siemens.com>:

> From: Claudius Heine <ch@denx.de>
> 
> 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 <ch@denx.de>
> ---
>  .../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.

> -    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
>  }


  reply	other threads:[~2018-05-23 14:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 13:12 [PATCH v2 0/3] One-shot configuration packages claudius.heine.ext
2018-05-23 13:12 ` [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
2018-05-23 14:06   ` Henning Schild [this message]
2018-05-24  7:06     ` Claudius Heine
2018-05-24  8:57       ` Henning Schild
2018-05-23 13:12 ` [PATCH v2 2/3] meta/isar-cfg-localepurge: added locale purge recipe claudius.heine.ext
2018-05-23 14:16   ` Henning Schild
2018-05-23 14:39     ` Claudius Heine
2018-05-23 13:12 ` [PATCH v2 3/3] meta-isar/isar-image-base: switch use isar-cfg-localepurge claudius.heine.ext
2018-05-23 14:03 ` [PATCH v2 0/3] One-shot configuration packages Henning Schild
2018-05-24  8:38   ` Claudius Heine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180523160606.3a155731@md1pvb1c.ad001.siemens.net \
    --to=henning.schild@siemens.com \
    --cc=ch@denx.de \
    --cc=claudius.heine.ext@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox