From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6558749580291211264 X-Received: by 2002:aa7:c611:: with SMTP id h17-v6mr1945691edq.7.1527081174499; Wed, 23 May 2018 06:12:54 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:aa7:d281:: with SMTP id w1-v6ls10793612edq.5.gmail; Wed, 23 May 2018 06:12:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrjHjXteD54iNMmUdrfUf9DhVKm44Rz6jEW6b8NqOHxJuXl2L19pztVIqYRoaCEZ6dorQiL X-Received: by 2002:a50:a5c8:: with SMTP id b8-v6mr1943780edc.1.1527081174109; Wed, 23 May 2018 06:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527081174; cv=none; d=google.com; s=arc-20160816; b=p7BiZGnLSEuP1dDBU7SYXrHYasqFVdEJSAbwp5w9Tx8v+cqpddT1vkWCOz8PLODZuO BGuT3G/BMCCCH4TDENImsMi+iwohgPz8pAAY3blH7Z9RWSAe09VAk6+LA5Tw51O4UBgT JTuPPw2ZpyBgia8ZOz1CCd1A5alTEF8FlHo/l8zf3q8LPZRXsJrJNyTlqpNS58RRbQUY y7qT96P9+unPRbmqjGiiYJbv1A7LFNxptOmGrNavuWEMGz0+zARpwz9KhAWDXGiy7H9w 28xMh3E/qt0zWvLMt4cMGpH+4hay/f/sMDhITcNMsxj708Pmxjgvwe7DHs34RzaW5qLg TGlw== 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=iLjOaFwSwDx5a2xcxEwGdPlCoXuUF2he1mzfZH2kP9Q=; b=KPbLZqjVIEl7FNCedD5RxkrlwFIivdcClngZp7AS632MiGaEiJaR0hmcBJq21jMUmN jG+0Ujs0xlmnWsiRl2LSwF6jD0D6gVVHL1jmq3AKoiSSfg1jeTvH63aqA81ZF4AYbeew 9yBobuicswZBqIZK2LOeltahl941EMd0l6vU/MlJSC4uSRBRNJsr0P4s41WrEQ2LSqaB U9bQpxmBIzM+bozHikXbxfhwe67dm1Lp1JrdupED9srMSEXy2H/HbjhbZdljOMURnN1y qaSffJ3K/CRh2D9POpoP3XUr55JuPKuv1kGIS+/wTiP4RvSN2KjR8uFdWDHXHvuhxA27 KP+A== 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 j5-v6si794357edd.5.2018.05.23.06.12.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 06:12:54 -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 mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id w4NDCrQ6025202 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 May 2018 15:12:53 +0200 Received: from ring.ppmd.siemens.net (linux-ses-ext02.ppmd.siemens.net [139.25.69.69]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id w4NDCrOr024625; Wed, 23 May 2018 15:12:53 +0200 From: claudius.heine.ext@siemens.com To: isar-users@googlegroups.com Cc: Claudius Heine Subject: [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option Date: Wed, 23 May 2018 15:12:46 +0200 Message-Id: <20180523131248.31907-2-claudius.heine.ext@siemens.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180523131248.31907-1-claudius.heine.ext@siemens.com> References: <20180523131248.31907-1-claudius.heine.ext@siemens.com> X-TUID: gjwPbd3in1W/ 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" - 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} + 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 } -- 2.17.0