mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v2] rootfs: Add possibility to add custom directories and files.
@ 2022-01-12 13:30 Christian Melki
  2022-01-21  8:07 ` Michael Olbrich
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Melki @ 2022-01-12 13:30 UTC (permalink / raw)
  To: ptxdist; +Cc: flix.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   | 33 +++++++++++++++++++++++++++++++++
 rules/rootfs.make | 13 +++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/rules/rootfs.in b/rules/rootfs.in
index 34e9bdcff..dddb5ebe1 100644
--- a/rules/rootfs.in
+++ b/rules/rootfs.in
@@ -257,6 +257,22 @@ config ROOTFS_VAR_TMP
 	  available at run-time.
 
 endmenu
+
+config ROOTFS_CUSTOM_DIRS
+	bool
+	prompt "custom directories"
+	help
+	  Create custom directories in the rootfs. Directories
+	  will be created from a file in the project conf directory,
+	  directories.cfg. Format: <directory name>:<permission>.
+	  Multiple directories are separated by a newline.
+	  Use this if you want to add various directories,
+	  but do not wish to maintain a copy of a package file
+	  solely for that purpose.
+	  For example:
+	  /conf:0755
+	  /conf/default:0700
+
 endif # ROOTFS
 
 # ----------------------------------------------------------------------------
@@ -488,4 +504,21 @@ choice
 		  If enabled, no /init will be install.
 endchoice
 
+config ROOTFS_CUSTOM_FILES
+	bool
+	prompt "custom files"
+	help
+	  Copy custom files to the rootfs. Files will be
+	  created from a file in the project conf directory,
+	  files.cfg. Format: <file path>:<permission>.
+	  Multiple files are separated by a newline.
+	  Files are installed with the install_alternative mechanism.
+	  Use this if you want to add various scripts, data files,
+	  etc but do not wish to maintain a copy of a package file
+	  solely for that purpose.
+	  For example:
+	  /usr/share/data.cfg:0644
+	  /etc/daemon.cfg:0644
+	  /usr/bin/script.sh:0755
+
 endmenu
diff --git a/rules/rootfs.make b/rules/rootfs.make
index 1c1e5501c..715804cec 100644
--- a/rules/rootfs.make
+++ b/rules/rootfs.make
@@ -145,6 +145,12 @@ ifdef PTXCONF_ROOTFS_VAR_OVERLAYFS
 	@$(call install_link, rootfs, ../var.mount, \
 		/usr/lib/systemd/system/local-fs.target.requires/var.mount)
 endif
+ifdef PTXCONF_ROOTFS_CUSTOM_DIRS
+	@$(foreach customdir, $(shell cat $(call ptx/in-platformconfigdir, directories)), \
+		$(call install_copy, rootfs, 0, 0, \
+		$(word 2, $(subst :, ,$(customdir))), \
+		$(word 1, $(subst :, ,$(customdir))))$(ptx/nl))
+endif
 
 #	#
 #	# install files in rootfs
@@ -277,6 +283,13 @@ ifdef PTXCONF_ROOTFS_INIT_BIN
 	@$(call install_alternative, rootfs, 0, 0, 0755, /init)
 endif
 
+ifdef PTXCONF_ROOTFS_CUSTOM_FILES
+	@$(foreach customfiles, $(shell cat $(call ptx/in-platformconfigdir, files)), \
+		$(call install_alternative, rootfs, 0, 0, \
+		$(word 2, $(subst :, ,$(customfiles))), \
+		$(word 1, $(subst :, ,$(customfiles))))$(ptx/nl))
+endif
+
 	@$(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] 3+ messages in thread

* Re: [ptxdist] [PATCH v2] rootfs: Add possibility to add custom directories and files.
  2022-01-12 13:30 [ptxdist] [PATCH v2] rootfs: Add possibility to add custom directories and files Christian Melki
@ 2022-01-21  8:07 ` Michael Olbrich
  2022-01-21  8:36   ` Christian Melki
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Olbrich @ 2022-01-21  8:07 UTC (permalink / raw)
  To: Christian Melki; +Cc: ptxdist, flix.ptxdist

On Wed, Jan 12, 2022 at 02:30:42PM +0100, Christian Melki wrote:
> 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.

Nack. It's normal and expected to have some rules in your BSP. And it quite
trivial to maintain. We even have a template to create rules to make it
even easier.

Michael

> Signed-off-by: Christian Melki <christian.melki@t2data.com>
> ---
>  rules/rootfs.in   | 33 +++++++++++++++++++++++++++++++++
>  rules/rootfs.make | 13 +++++++++++++
>  2 files changed, 46 insertions(+)
> 
> diff --git a/rules/rootfs.in b/rules/rootfs.in
> index 34e9bdcff..dddb5ebe1 100644
> --- a/rules/rootfs.in
> +++ b/rules/rootfs.in
> @@ -257,6 +257,22 @@ config ROOTFS_VAR_TMP
>  	  available at run-time.
>  
>  endmenu
> +
> +config ROOTFS_CUSTOM_DIRS
> +	bool
> +	prompt "custom directories"
> +	help
> +	  Create custom directories in the rootfs. Directories
> +	  will be created from a file in the project conf directory,
> +	  directories.cfg. Format: <directory name>:<permission>.
> +	  Multiple directories are separated by a newline.
> +	  Use this if you want to add various directories,
> +	  but do not wish to maintain a copy of a package file
> +	  solely for that purpose.
> +	  For example:
> +	  /conf:0755
> +	  /conf/default:0700
> +
>  endif # ROOTFS
>  
>  # ----------------------------------------------------------------------------
> @@ -488,4 +504,21 @@ choice
>  		  If enabled, no /init will be install.
>  endchoice
>  
> +config ROOTFS_CUSTOM_FILES
> +	bool
> +	prompt "custom files"
> +	help
> +	  Copy custom files to the rootfs. Files will be
> +	  created from a file in the project conf directory,
> +	  files.cfg. Format: <file path>:<permission>.
> +	  Multiple files are separated by a newline.
> +	  Files are installed with the install_alternative mechanism.
> +	  Use this if you want to add various scripts, data files,
> +	  etc but do not wish to maintain a copy of a package file
> +	  solely for that purpose.
> +	  For example:
> +	  /usr/share/data.cfg:0644
> +	  /etc/daemon.cfg:0644
> +	  /usr/bin/script.sh:0755
> +
>  endmenu
> diff --git a/rules/rootfs.make b/rules/rootfs.make
> index 1c1e5501c..715804cec 100644
> --- a/rules/rootfs.make
> +++ b/rules/rootfs.make
> @@ -145,6 +145,12 @@ ifdef PTXCONF_ROOTFS_VAR_OVERLAYFS
>  	@$(call install_link, rootfs, ../var.mount, \
>  		/usr/lib/systemd/system/local-fs.target.requires/var.mount)
>  endif
> +ifdef PTXCONF_ROOTFS_CUSTOM_DIRS
> +	@$(foreach customdir, $(shell cat $(call ptx/in-platformconfigdir, directories)), \
> +		$(call install_copy, rootfs, 0, 0, \
> +		$(word 2, $(subst :, ,$(customdir))), \
> +		$(word 1, $(subst :, ,$(customdir))))$(ptx/nl))
> +endif
>  
>  #	#
>  #	# install files in rootfs
> @@ -277,6 +283,13 @@ ifdef PTXCONF_ROOTFS_INIT_BIN
>  	@$(call install_alternative, rootfs, 0, 0, 0755, /init)
>  endif
>  
> +ifdef PTXCONF_ROOTFS_CUSTOM_FILES
> +	@$(foreach customfiles, $(shell cat $(call ptx/in-platformconfigdir, files)), \
> +		$(call install_alternative, rootfs, 0, 0, \
> +		$(word 2, $(subst :, ,$(customfiles))), \
> +		$(word 1, $(subst :, ,$(customfiles))))$(ptx/nl))
> +endif
> +
>  	@$(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
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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


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

* Re: [ptxdist] [PATCH v2] rootfs: Add possibility to add custom directories and files.
  2022-01-21  8:07 ` Michael Olbrich
@ 2022-01-21  8:36   ` Christian Melki
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Melki @ 2022-01-21  8:36 UTC (permalink / raw)
  To: ptxdist, m.olbrich; +Cc: flix.ptxdist



On 1/21/22 9:07 AM, Michael Olbrich wrote:
> On Wed, Jan 12, 2022 at 02:30:42PM +0100, Christian Melki wrote:
>> 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.
> 
> Nack. It's normal and expected to have some rules in your BSP. And it quite
> trivial to maintain. We even have a template to create rules to make it
> even easier.
> 
> Michael
> 

Thanks for the feedback.

Sort of suspected the nack. The request was a bit naive. But I still 
think it's a common problem.
I don't mind creating new packages and rules for things that deserve it. 
But it annoys me that I have to keep my own set of ptxdist default rules 
because I want to add a file or two in relation to the package.

Because every time I install a new ptxdist release I have to merge my 
changes to the new ruleset (so I don't miss out), just to be able to 
copy files.

Yes, I can create separate rules. But the files belong to a specific 
package for my solutions and I prefer not to have a dependency 
file-copy-rule-package for a lot of packages. This is not something that 
the CUSTOM_FILES do address, but atleast it removes the need to 
constantly merge/update files on every ptxdist upgrade.

Regards,
Christian

>> Signed-off-by: Christian Melki <christian.melki@t2data.com>
>> ---
>>   rules/rootfs.in   | 33 +++++++++++++++++++++++++++++++++
>>   rules/rootfs.make | 13 +++++++++++++
>>   2 files changed, 46 insertions(+)
>>
>> diff --git a/rules/rootfs.in b/rules/rootfs.in
>> index 34e9bdcff..dddb5ebe1 100644
>> --- a/rules/rootfs.in
>> +++ b/rules/rootfs.in
>> @@ -257,6 +257,22 @@ config ROOTFS_VAR_TMP
>>   	  available at run-time.
>>   
>>   endmenu
>> +
>> +config ROOTFS_CUSTOM_DIRS
>> +	bool
>> +	prompt "custom directories"
>> +	help
>> +	  Create custom directories in the rootfs. Directories
>> +	  will be created from a file in the project conf directory,
>> +	  directories.cfg. Format: <directory name>:<permission>.
>> +	  Multiple directories are separated by a newline.
>> +	  Use this if you want to add various directories,
>> +	  but do not wish to maintain a copy of a package file
>> +	  solely for that purpose.
>> +	  For example:
>> +	  /conf:0755
>> +	  /conf/default:0700
>> +
>>   endif # ROOTFS
>>   
>>   # ----------------------------------------------------------------------------
>> @@ -488,4 +504,21 @@ choice
>>   		  If enabled, no /init will be install.
>>   endchoice
>>   
>> +config ROOTFS_CUSTOM_FILES
>> +	bool
>> +	prompt "custom files"
>> +	help
>> +	  Copy custom files to the rootfs. Files will be
>> +	  created from a file in the project conf directory,
>> +	  files.cfg. Format: <file path>:<permission>.
>> +	  Multiple files are separated by a newline.
>> +	  Files are installed with the install_alternative mechanism.
>> +	  Use this if you want to add various scripts, data files,
>> +	  etc but do not wish to maintain a copy of a package file
>> +	  solely for that purpose.
>> +	  For example:
>> +	  /usr/share/data.cfg:0644
>> +	  /etc/daemon.cfg:0644
>> +	  /usr/bin/script.sh:0755
>> +
>>   endmenu
>> diff --git a/rules/rootfs.make b/rules/rootfs.make
>> index 1c1e5501c..715804cec 100644
>> --- a/rules/rootfs.make
>> +++ b/rules/rootfs.make
>> @@ -145,6 +145,12 @@ ifdef PTXCONF_ROOTFS_VAR_OVERLAYFS
>>   	@$(call install_link, rootfs, ../var.mount, \
>>   		/usr/lib/systemd/system/local-fs.target.requires/var.mount)
>>   endif
>> +ifdef PTXCONF_ROOTFS_CUSTOM_DIRS
>> +	@$(foreach customdir, $(shell cat $(call ptx/in-platformconfigdir, directories)), \
>> +		$(call install_copy, rootfs, 0, 0, \
>> +		$(word 2, $(subst :, ,$(customdir))), \
>> +		$(word 1, $(subst :, ,$(customdir))))$(ptx/nl))
>> +endif
>>   
>>   #	#
>>   #	# install files in rootfs
>> @@ -277,6 +283,13 @@ ifdef PTXCONF_ROOTFS_INIT_BIN
>>   	@$(call install_alternative, rootfs, 0, 0, 0755, /init)
>>   endif
>>   
>> +ifdef PTXCONF_ROOTFS_CUSTOM_FILES
>> +	@$(foreach customfiles, $(shell cat $(call ptx/in-platformconfigdir, files)), \
>> +		$(call install_alternative, rootfs, 0, 0, \
>> +		$(word 2, $(subst :, ,$(customfiles))), \
>> +		$(word 1, $(subst :, ,$(customfiles))))$(ptx/nl))
>> +endif
>> +
>>   	@$(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
>>
> 

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


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

end of thread, other threads:[~2022-01-21  8:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-12 13:30 [ptxdist] [PATCH v2] rootfs: Add possibility to add custom directories and files Christian Melki
2022-01-21  8:07 ` Michael Olbrich
2022-01-21  8:36   ` Christian Melki

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