public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 1/2] meta: recipes-support shrink with preconfig instead of postproc
@ 2019-07-23 11:42 Henning Schild
  2019-07-23 11:42 ` [PATCH 2/2] ci_build: test image shrinking packages Henning Schild
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Henning Schild @ 2019-07-23 11:42 UTC (permalink / raw)
  To: isar-users; +Cc: Henning Schild

From: Henning Schild <henning.schild@siemens.com>

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 <henning.schild@siemens.com>
---
 .../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 <isar-users@googlegroups.com>"
+
+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 <isar-users@googlegroups.com>"
+
+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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-08-05  9:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23 11:42 [PATCH 1/2] meta: recipes-support shrink with preconfig instead of postproc Henning Schild
2019-07-23 11:42 ` [PATCH 2/2] ci_build: test image shrinking packages Henning Schild
2019-07-23 12:46 ` [PATCH 1/2] meta: recipes-support shrink with preconfig instead of postproc Claudius Heine
2019-07-24  7:53   ` Henning Schild
2019-07-24  7:50 ` Henning Schild
2019-08-05  9:22 ` Baurzhan Ismagulov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox