mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [RFC: PATCH] rootfs: Add possibility to add custom directories and files.
@ 2022-01-11  9:58 Christian Melki
  2022-01-11 14:16 ` Felix Mellmann
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Melki @ 2022-01-11  9:58 UTC (permalink / raw)
  To: ptxdist

Add two custom targets in the rootfs configuration.
Rationale behind this is that I often find myself maintaining
a copy of a package ruleset just to be able to copy a file or add
a directory.
These changes are often things that are project specific and
are useless upstream.
Now this type of project specific maintenance can go away.

Signed-off-by: Christian Melki <christian.melki@t2data.com>
---
 rules/rootfs.in   | 20 ++++++++++++++++++++
 rules/rootfs.make |  5 +++++
 2 files changed, 25 insertions(+)

diff --git a/rules/rootfs.in b/rules/rootfs.in
index 34e9bdcff..3183abc6b 100644
--- a/rules/rootfs.in
+++ b/rules/rootfs.in
@@ -257,6 +257,15 @@ config ROOTFS_VAR_TMP
 	  available at run-time.
 
 endmenu
+
+config ROOTFS_CUSTOM_DIRS
+	string "custom directories"
+	default ""
+	help
+	  Create custom directories in the root filesystem.
+	  Directories will be created with a standard 0755 permission.
+	  Multiple directories can be specified, separated by spaces.
+
 endif # ROOTFS
 
 # ----------------------------------------------------------------------------
@@ -488,4 +497,15 @@ choice
 		  If enabled, no /init will be install.
 endchoice
 
+config ROOTFS_CUSTOM_FILES
+	string "custom files"
+	default ""
+	help
+	  Copy custom files from projectroot to the root filesystem.
+	  Files will be created with a standard 0644 permission.
+	  Multiple files can be specified, separated by spaces.
+	  Use this if you want to add various scripts, data files,
+	  etc but to not wish to maintain a copy of a package file
+	  solely for that purpose.
+
 endmenu
diff --git a/rules/rootfs.make b/rules/rootfs.make
index 1c1e5501c..55fb06486 100644
--- a/rules/rootfs.make
+++ b/rules/rootfs.make
@@ -145,6 +145,8 @@ ifdef PTXCONF_ROOTFS_VAR_OVERLAYFS
 	@$(call install_link, rootfs, ../var.mount, \
 		/usr/lib/systemd/system/local-fs.target.requires/var.mount)
 endif
+	@$(foreach customdir, $(call remove_quotes,$(PTXCONF_ROOTFS_CUSTOM_DIRS)), \
+		$(call install_copy, rootfs, 0, 0, 0755, $(customdir))$(ptx/nl))
 
 #	#
 #	# install files in rootfs
@@ -277,6 +279,9 @@ ifdef PTXCONF_ROOTFS_INIT_BIN
 	@$(call install_alternative, rootfs, 0, 0, 0755, /init)
 endif
 
+	@$(foreach customfiles, $(call remove_quotes,$(PTXCONF_ROOTFS_CUSTOM_FILES)), \
+		$(call install_alternative, rootfs, 0, 0, 0644, $(customfiles))$(ptx/nl))
+
 	@$(call install_finish, rootfs)
 
 	@$(call touch)
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

end of thread, other threads:[~2022-01-12 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11  9:58 [ptxdist] [RFC: PATCH] rootfs: Add possibility to add custom directories and files Christian Melki
2022-01-11 14:16 ` Felix Mellmann
2022-01-12 11:46   ` Christian Melki
2022-01-12 11:56     ` Felix Mellmann

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