From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6558749580291211264 X-Received: by 2002:adf:e5c3:: with SMTP id a3-v6mr714622wrn.19.1527171999522; Thu, 24 May 2018 07:26:39 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:84c:: with SMTP id 73-v6ls3624530wmi.6.canary-gmail; Thu, 24 May 2018 07:26:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp6RBDWIWa6iGHArAFlSEpTyXtjf2fZ1rAoZOgvwzgiNJfpYIlAKhcVTExeJLlIx6O4xBtW X-Received: by 2002:a1c:6383:: with SMTP id x125-v6mr988553wmb.19.1527171999101; Thu, 24 May 2018 07:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527171999; cv=none; d=google.com; s=arc-20160816; b=zg+ZXc90RVTvs30iDShf/QuAjWGxr9I7ZKnoLVNGYlRieBY8joidHukQR67YopeOBf QW+ebFvGTICjT88jiId9QXzxutnFT/UlaubqZ27uuaDoIlnRjB86GWGg/S7m/B9CGIpi q8G4H4C8jGWtJxzG6LY72yCcEmPYB46H1nXbuwPkY3JTB8NpPBtKg6RKxn/BQh1lMMRW nTh2rH8NgVheSFNZR4MjOgRXRBWkTQlaewOlAZhAG6muF1esMjMeCua+PP6/OL954I/Z Ec/8UXuuh2xp9LPXWABcaogf5N/OO8IcB8UiCd3+ziTsS5yfUcY7plJNY+YBUZDmslj/ zVtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9HtfdU3HTI9aKV36FEeRfA1sViX6BLUkrlZzXjdU0Hs=; b=rELsrj/9t2cA630+pHovOXrUD0h7UDmkrSt7qODQDWhNbRfiHSyWtxORlMckKp5JHZ HZ2zJlavH7V900zMxnxr5+uON9agsgVAk8H5zL+WEUQ/8KXAxNpi1wZqm5siVrhxt+on szq8TJ2CAY1jpWT06BJ6LPMRJZeUP6haiuSWHyM2VJWoHoiY7n/pRcZYd/94TH6e3JZZ leqd9fuwiP44u07nqP1LbJx7hRsiqRl7T5zegGr9o2eFKoWA0bqfHvnA0rUht9+zY0tH X/fln6Az+rZHMLCppcwROEe3ePC9wOj1UQnUCtxAO5GNwT/k3UdR3RAP2lCL5CGocAYg LPcA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Return-Path: Received: from lizzard.sbs.de (lizzard.sbs.de. [194.138.37.39]) by gmr-mx.google.com with ESMTPS id m80-v6si710679wmb.1.2018.05.24.07.26.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 07:26:39 -0700 (PDT) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.39 as permitted sender) client-ip=194.138.37.39; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id w4OEQcO0005957 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 May 2018 16:26:38 +0200 Received: from ring.ppmd.siemens.net (linux-ses-ext02.ppmd.siemens.net [139.25.69.69]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id w4OEQcej007841; Thu, 24 May 2018 16:26:38 +0200 From: claudius.heine.ext@siemens.com To: isar-users@googlegroups.com Cc: Claudius Heine Subject: [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option Date: Thu, 24 May 2018 16:26:33 +0200 Message-Id: <20180524142635.5814-2-claudius.heine.ext@siemens.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524142635.5814-1-claudius.heine.ext@siemens.com> References: <20180524142635.5814-1-claudius.heine.ext@siemens.com> X-TUID: mqyHuLWlOG/F 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 + 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 } -- 2.17.0