From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6716822677311455232 X-Received: by 2002:adf:df90:: with SMTP id z16mr33491326wrl.331.1563882147704; Tue, 23 Jul 2019 04:42:27 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:9083:: with SMTP id i3ls12715090wri.14.gmail; Tue, 23 Jul 2019 04:42:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzT1NUkGzObYDVOvtowSe/05TQwH2dpfWxdPFNDbbr+LFHR+gbGSIJ4bnVbIi3oXufoQ7Gh X-Received: by 2002:adf:cf0d:: with SMTP id o13mr34381673wrj.291.1563882147305; Tue, 23 Jul 2019 04:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563882147; cv=none; d=google.com; s=arc-20160816; b=ZttxUWkajnlW6whMmaf5HMtmsD+kmFkuS5XvBCOm8Dpin5AKx2R92dmyGSnD4JvXTD f50D10PLWY3QKNT1Ni4xRdWVfWzxwtaw5riIKW5oupUCz1ev+IDtpiUGqh8fmbvy8NXA OaGbg6fpoAF38FLOR2TQkI0zIJSteAPdeL05GDMpjEQHQIsCI++hhPu5PT8Xu6CdguvQ gkRGqrVlMEPGWKuf4S25/entD3FZkbAqmsrWsNd+NFW1QajwdnOHEX+XddUV/6zAg4NW DmHDDj76WURonF/2SJ0ialI5mBfj+2Yxx1+TbauuNcQXgowaOKE/BmdVdmtO1ltIWpRp Kq9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=eGseOp7+KTV4DymroONQY2RVL80LR+eqg6BY0mKKMGs=; b=fs/jD1K4FXtMC5BqLH6+bQAg6JYVvJz8cphVO6UfiyZud2V/3woYlKgxc77PlVyudy 93gvugU2OH+cXrU5UOsiIfwTGny7hn2kk7UIGS6DcBpUXEAHtkL2+TKPPeGGjChluPzz zz+cqj9J9lX7Xv12vAeiDXzwwpgwNeH4TlJQJv7/Zc0am8Ko2Su7RO548B+wfnvjVhtf sBw0/U/MjZ+4NSArQnDkovXperSehOsldtBVgfrsD/BhzYY+qeFsxur8aDi9dENHEqXm L/r91ObwcR9uKEtVtzAtqSqNv+iGpjLEDJA2v1ybo6xWSYLOrU6J3T8jxbtI0dvoRz65 Yh2A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id p23si1788551wma.1.2019.07.23.04.42.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jul 2019 04:42:27 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@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 henning.schild@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 x6NBgQS4014123 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 23 Jul 2019 13:42:26 +0200 Received: from md1za8fc.ad001.siemens.net ([139.25.69.220]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id x6NBgQcD009388; Tue, 23 Jul 2019 13:42:26 +0200 From: Henning Schild To: isar-users Cc: Henning Schild Subject: [PATCH 1/2] meta: recipes-support shrink with preconfig instead of postproc Date: Tue, 23 Jul 2019 13:42:23 +0200 Message-Id: <20190723114224.22776-1-henning.schild@siemens.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: wlQt1/YDiEu+ From: Henning Schild This adds two support packages to shrink an image and keep it small in case apt/dpkg will be used on the system later on. An alternative would be postprocess functions, they would be run-once and if the system continues to receive package updates new files will not be cleaned up. Signed-off-by: Henning Schild --- .../files/isar-disable-apt-cache | 3 +++ .../isar-disable-apt-cache_0.1.bb | 13 +++++++++++++ .../isar-exclude-docs/files/isar-exclude-docs | 11 +++++++++++ .../isar-exclude-docs/files/postinst | 7 +++++++ .../isar-exclude-docs/isar-exclude-docs_0.1.bb | 14 ++++++++++++++ 5 files changed, 48 insertions(+) create mode 100644 meta/recipes-support/isar-disable-apt-cache/files/isar-disable-apt-cache create mode 100644 meta/recipes-support/isar-disable-apt-cache/isar-disable-apt-cache_0.1.bb create mode 100644 meta/recipes-support/isar-exclude-docs/files/isar-exclude-docs create mode 100644 meta/recipes-support/isar-exclude-docs/files/postinst create mode 100644 meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.1.bb diff --git a/meta/recipes-support/isar-disable-apt-cache/files/isar-disable-apt-cache b/meta/recipes-support/isar-disable-apt-cache/files/isar-disable-apt-cache new file mode 100644 index 0000000..ff10041 --- /dev/null +++ b/meta/recipes-support/isar-disable-apt-cache/files/isar-disable-apt-cache @@ -0,0 +1,3 @@ +DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; }; +APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; }; +Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache ""; diff --git a/meta/recipes-support/isar-disable-apt-cache/isar-disable-apt-cache_0.1.bb b/meta/recipes-support/isar-disable-apt-cache/isar-disable-apt-cache_0.1.bb new file mode 100644 index 0000000..7dbd6ed --- /dev/null +++ b/meta/recipes-support/isar-disable-apt-cache/isar-disable-apt-cache_0.1.bb @@ -0,0 +1,13 @@ +# This software is a part of ISAR. +inherit dpkg-raw + +DESCRIPTION = "Configuration to disable apt cache" +MAINTAINER = "isar-users " + +SRC_URI = "file://${PN}" + +do_install[cleandirs] += "${D}/etc/apt/apt.conf.d/" + +do_install() { + install -v -m 644 "${WORKDIR}/${PN}" "${D}/etc/apt/apt.conf.d/99${PN}" +} diff --git a/meta/recipes-support/isar-exclude-docs/files/isar-exclude-docs b/meta/recipes-support/isar-exclude-docs/files/isar-exclude-docs new file mode 100644 index 0000000..5bec626 --- /dev/null +++ b/meta/recipes-support/isar-exclude-docs/files/isar-exclude-docs @@ -0,0 +1,11 @@ +# Drop all man pages +path-exclude=/usr/share/man/* + +# Drop all documentation ... +path-exclude=/usr/share/doc/* + +# ... except copyright files ... +path-include=/usr/share/doc/*/copyright + +# ... and Debian changelogs +path-include=/usr/share/doc/*/changelog.Debian.* diff --git a/meta/recipes-support/isar-exclude-docs/files/postinst b/meta/recipes-support/isar-exclude-docs/files/postinst new file mode 100644 index 0000000..f6c0d1b --- /dev/null +++ b/meta/recipes-support/isar-exclude-docs/files/postinst @@ -0,0 +1,7 @@ +#!/bin/sh +# we need to do this once right after install, so we can install this at any +# time and do not need to be "the first" package +# what we delete needs to be in sync with the dpkg configuration we ship + +rm -rf /usr/share/man/* +find /usr/share/doc/ -type f ! -name "copyright" ! -name "changelog.Debian.*" -exec rm -rf {} \; diff --git a/meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.1.bb b/meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.1.bb new file mode 100644 index 0000000..05c8953 --- /dev/null +++ b/meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.1.bb @@ -0,0 +1,14 @@ +# This software is a part of ISAR. +inherit dpkg-raw + +DESCRIPTION = "Configuration to exclude most documentation" +MAINTAINER = "isar-users " + +SRC_URI = "file://${PN} \ + file://postinst" + +do_install[cleandirs] += "${D}/etc/dpkg/dpkg.conf.d/" + +do_install() { + install -v -m 644 "${WORKDIR}/${PN}" "${D}/etc/dpkg/dpkg.conf.d/99${PN}" +} -- 2.21.0