public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [isar] rootfs: Add new ROOTFS_FEATURE 'slimfy' to minimize the footprint
@ 2021-09-06  9:45 venkata.pyla
  2021-09-06 10:13 ` Jan Kiszka
  2021-09-06 10:48 ` Henning Schild
  0 siblings, 2 replies; 12+ messages in thread
From: venkata.pyla @ 2021-09-06  9:45 UTC (permalink / raw)
  To: isar-users; +Cc: venkata pyla, henning.schild, jan.kiszka

From: venkata pyla <venkata.pyla@toshiba-tsip.com>

 This Adds new ROOTFS_FEATURE 'slimify' that deletes unnecessary files
 in the rootfs and contributes to minimal footprint in the rootfs and
 also avoids the reproducible failures due to non-deterministic data in
 the log files and temporary files.

 It deletes the following files
  - /var/log/*
  - /tmp/*

 To enable this feature
   ROOTFS_FEATURE += slimify

Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
---
 meta/classes/rootfs.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index f9151c5..d01a9d1 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -12,6 +12,7 @@ ROOTFS_PACKAGES ?= ""
 # 'clean-package-cache' - delete package cache from rootfs
 # 'generate-manifest' - generate a package manifest of the rootfs into ${ROOTFS_MANIFEST_DEPLOY_DIR}
 # 'export-dpkg-status' - exports /var/lib/dpkg/status file to ${ROOTFS_DPKGSTATUS_DEPLOY_DIR}
+# 'slimify'            - delete unnecessary files in rootfs like /var/log/*, /tmp/*
 ROOTFS_FEATURES ?= ""
 
 ROOTFS_APT_ARGS="install --yes -o Debug::pkgProblemResolver=yes"
@@ -229,6 +230,12 @@ rootfs_export_dpkg_status() {
        '${ROOTFS_DPKGSTATUS_DEPLOY_DIR}'/'${PF}'.dpkg_status
 }
 
+ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'slimify', 'rootfs_slimify', '', d)}"
+rootfs_slimify() {
+    sudo rm -rf "${ROOTFSDIR}/var/log/"*
+    sudo rm -rf "${ROOTFSDIR}/tmp/"*
+}
+
 do_rootfs_postprocess[vardeps] = "${ROOTFS_POSTPROCESS_COMMAND}"
 python do_rootfs_postprocess() {
     # Take care that its correctly mounted:
-- 
2.20.1



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

end of thread, other threads:[~2021-10-04 16:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06  9:45 [isar] rootfs: Add new ROOTFS_FEATURE 'slimfy' to minimize the footprint venkata.pyla
2021-09-06 10:13 ` Jan Kiszka
2021-09-06 10:48 ` Henning Schild
2021-10-01 14:37   ` [PATCH v2] rootfs: clean package log files that are not owned by packages venkata.pyla
2021-10-04  9:55     ` Jan Kiszka
2021-10-04 10:47       ` Venkata.Pyla
2021-10-04 12:36         ` Henning Schild
2021-10-04 12:05     ` Henning Schild
2021-10-04 12:51       ` Venkata.Pyla
2021-10-04 13:48         ` Henning Schild
2021-10-04 15:07           ` Venkata.Pyla
2021-10-04 16:45             ` Henning Schild

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