All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC] add ability to pass additional users tables
@ 2014-03-27 16:19 Eric Le Bihan
  2014-03-27 16:19 ` [Buildroot] [PATCH 1/1] system: " Eric Le Bihan
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Le Bihan @ 2014-03-27 16:19 UTC (permalink / raw)
  To: buildroot

Hi!

I wanted to add some predefined users on my target system, but did not want to
set up a skeleton. So I added a new entry into the "System configuration"
menu, to set the location of an additional users table, to be passed to the
powerful mkusers script, as it is done for the device tables.

This is an RFC, as I do not know where to add the help instructions in the
manual about this feature.

Best regards,
ELB

Eric Le Bihan (1):
  system: add ability to pass additional users tables.

 fs/common.mk     |    6 +++++-
 system/Config.in |    9 +++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

--
1.7.9.5

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

* [Buildroot] [PATCH 1/1] system: add ability to pass additional users tables.
  2014-03-27 16:19 [Buildroot] [RFC] add ability to pass additional users tables Eric Le Bihan
@ 2014-03-27 16:19 ` Eric Le Bihan
  2014-03-27 18:19   ` Yann E. MORIN
  2014-04-20 17:21   ` Yann E. MORIN
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Le Bihan @ 2014-03-27 16:19 UTC (permalink / raw)
  To: buildroot

A new entry has been added to the "System Configuration" menu to allow
the user to set the location of additional user tables (besides the ones
defined in packages).

A user table is a text file, formatted using the mkusers syntax, which
describes the users on the target system, with their UID/GID, home
directory, password, etc.

The target root file system will be populated according the content of
these files.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 fs/common.mk     |    6 +++++-
 system/Config.in |    9 +++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/fs/common.mk b/fs/common.mk
index d95c26b..6f37bd0 100644
--- a/fs/common.mk
+++ b/fs/common.mk
@@ -33,6 +33,7 @@ FULL_DEVICE_TABLE = $(BUILD_DIR)/_device_table.txt
 ROOTFS_DEVICE_TABLES = $(call qstrip,$(BR2_ROOTFS_DEVICE_TABLE) \
        $(BR2_ROOTFS_STATIC_DEVICE_TABLE))
 USERS_TABLE = $(BUILD_DIR)/_users_table.txt
+ROOTFS_USERS_TABLE = $(call qstrip,$(BR2_ROOTFS_USERS_TABLE))
 
 define ROOTFS_TARGET_INTERNAL
 
@@ -78,7 +79,10 @@ endif
 	printf '$$(subst $$(sep),\n,$$(PACKAGES_PERMISSIONS_TABLE))' >> $$(FULL_DEVICE_TABLE)
 	echo "$$(HOST_DIR)/usr/bin/makedevs -d $$(FULL_DEVICE_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
 endif
-	printf '$(subst $(sep),\n,$(PACKAGES_USERS))' > $(USERS_TABLE)
+ifneq ($$(ROOTFS_USERS_TABLE),)
+	cat $$(ROOTFS_USERS_TABLE) > $(USERS_TABLE)
+endif
+	printf '$(subst $(sep),\n,$(PACKAGES_USERS))' >> $(USERS_TABLE)
 	$(TOPDIR)/support/scripts/mkusers $(USERS_TABLE) $(TARGET_DIR) >> $(FAKEROOT_SCRIPT)
 	echo "$$(ROOTFS_$(2)_CMD)" >> $$(FAKEROOT_SCRIPT)
 	chmod a+x $$(FAKEROOT_SCRIPT)
diff --git a/system/Config.in b/system/Config.in
index e8f1ed6..b7052f5 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -280,6 +280,15 @@ config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
 
 endif # BR2_ROOTFS_SKELETON_DEFAULT
 
+config BR2_ROOTFS_USERS_TABLE
+	string "Path to the users tables"
+	help
+	  Specify a space-separated list of users table locations,
+	  that will be passed to the mkusers utility to create
+	  users on the system, with home directory, password, etc.
+
+	  See manual for details on the usage and syntax of these files.
+
 config BR2_ROOTFS_OVERLAY
 	string "Root filesystem overlay directories"
 	default ""
-- 
1.7.9.5

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

* [Buildroot] [PATCH 1/1] system: add ability to pass additional users tables.
  2014-03-27 16:19 ` [Buildroot] [PATCH 1/1] system: " Eric Le Bihan
@ 2014-03-27 18:19   ` Yann E. MORIN
  2014-03-28 11:10     ` Eric Le Bihan
  2014-04-20 17:21   ` Yann E. MORIN
  1 sibling, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2014-03-27 18:19 UTC (permalink / raw)
  To: buildroot

Eric, All,

On 2014-03-27 17:19 +0100, Eric Le Bihan spake thusly:
> A new entry has been added to the "System Configuration" menu to allow
> the user to set the location of additional user tables (besides the ones
> defined in packages).
> 
> A user table is a text file, formatted using the mkusers syntax, which
> describes the users on the target system, with their UID/GID, home
> directory, password, etc.
> 
> The target root file system will be populated according the content of
> these files.
> 
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
>  fs/common.mk     |    6 +++++-
>  system/Config.in |    9 +++++++++
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/common.mk b/fs/common.mk
> index d95c26b..6f37bd0 100644
> --- a/fs/common.mk
> +++ b/fs/common.mk
> @@ -33,6 +33,7 @@ FULL_DEVICE_TABLE = $(BUILD_DIR)/_device_table.txt
>  ROOTFS_DEVICE_TABLES = $(call qstrip,$(BR2_ROOTFS_DEVICE_TABLE) \
>         $(BR2_ROOTFS_STATIC_DEVICE_TABLE))
>  USERS_TABLE = $(BUILD_DIR)/_users_table.txt
> +ROOTFS_USERS_TABLE = $(call qstrip,$(BR2_ROOTFS_USERS_TABLE))
>  
>  define ROOTFS_TARGET_INTERNAL
>  
> @@ -78,7 +79,10 @@ endif
>  	printf '$$(subst $$(sep),\n,$$(PACKAGES_PERMISSIONS_TABLE))' >> $$(FULL_DEVICE_TABLE)
>  	echo "$$(HOST_DIR)/usr/bin/makedevs -d $$(FULL_DEVICE_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
>  endif
> -	printf '$(subst $(sep),\n,$(PACKAGES_USERS))' > $(USERS_TABLE)
> +ifneq ($$(ROOTFS_USERS_TABLE),)
> +	cat $$(ROOTFS_USERS_TABLE) > $(USERS_TABLE)
> +endif
> +	printf '$(subst $(sep),\n,$(PACKAGES_USERS))' >> $(USERS_TABLE)
>  	$(TOPDIR)/support/scripts/mkusers $(USERS_TABLE) $(TARGET_DIR) >> $(FAKEROOT_SCRIPT)
>  	echo "$$(ROOTFS_$(2)_CMD)" >> $$(FAKEROOT_SCRIPT)
>  	chmod a+x $$(FAKEROOT_SCRIPT)
> diff --git a/system/Config.in b/system/Config.in
> index e8f1ed6..b7052f5 100644
> --- a/system/Config.in
> +++ b/system/Config.in
> @@ -280,6 +280,15 @@ config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
>  
>  endif # BR2_ROOTFS_SKELETON_DEFAULT
>  
> +config BR2_ROOTFS_USERS_TABLE
> +	string "Path to the users tables"
> +	help
> +	  Specify a space-separated list of users table locations,
> +	  that will be passed to the mkusers utility to create
> +	  users on the system, with home directory, password, etc.
> +
> +	  See manual for details on the usage and syntax of these files.
> +

There is a discrepancy bewteen the description commit log and this help
text, and the actual behaviour. The commit log and help text both
explain this can be a space-separated list of files, but in the code you
just treat it as if it were a unique file:

    ifneq ($$(ROOTFS_USERS_TABLE),)
        cat $$(ROOTFS_USERS_TABLE) > $(USERS_TABLE)
    endif

I think you should do something like:

    $(foreach f,$$(ROOTFS_USERS_TABLE),cat $$(f) >>$(USERS_TABLE)$(sep))

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 1/1] system: add ability to pass additional users tables.
  2014-03-27 18:19   ` Yann E. MORIN
@ 2014-03-28 11:10     ` Eric Le Bihan
  2014-03-28 16:50       ` Yann E. MORIN
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Le Bihan @ 2014-03-28 11:10 UTC (permalink / raw)
  To: buildroot

Hi!

On Thu, Mar 27, 2014 at 07:19:15PM +0100, Yann E. MORIN wrote:
> Eric, All,
>
[...]
>
> There is a discrepancy bewteen the description commit log and this help
> text, and the actual behaviour. The commit log and help text both
> explain this can be a space-separated list of files, but in the code you
> just treat it as if it were a unique file:
>
>     ifneq ($$(ROOTFS_USERS_TABLE),)
>         cat $$(ROOTFS_USERS_TABLE) > $(USERS_TABLE)
>     endif
>
> I think you should do something like:
>
>     $(foreach f,$$(ROOTFS_USERS_TABLE),cat $$(f) >>$(USERS_TABLE)$(sep))
In fact I use the same trick as for ROOTFS_DEVICE_TABLES: whether
ROOTFS_USERS_TABLE is 'foo' or 'foo bar quux', the invocation of `cat` is
valid, as `cat` takes a list of filenames as arguments. So no need to loop
on a list. Or is the loop preferred because of portability issues?

But it is true that I should use the plural form ROOTFS_USERS_TABLES.

Thanks for your review.

Best regards,
ELB

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

* [Buildroot] [PATCH 1/1] system: add ability to pass additional users tables.
  2014-03-28 11:10     ` Eric Le Bihan
@ 2014-03-28 16:50       ` Yann E. MORIN
  0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2014-03-28 16:50 UTC (permalink / raw)
  To: buildroot

Eric, All,

On 2014-03-28 12:10 +0100, Eric Le Bihan spake thusly:
> On Thu, Mar 27, 2014 at 07:19:15PM +0100, Yann E. MORIN wrote:
> > Eric, All,
> >
> [...]
> >
> > There is a discrepancy bewteen the description commit log and this help
> > text, and the actual behaviour. The commit log and help text both
> > explain this can be a space-separated list of files, but in the code you
> > just treat it as if it were a unique file:
> >
> >     ifneq ($$(ROOTFS_USERS_TABLE),)
> >         cat $$(ROOTFS_USERS_TABLE) > $(USERS_TABLE)
> >     endif
> >
> > I think you should do something like:
> >
> >     $(foreach f,$$(ROOTFS_USERS_TABLE),cat $$(f) >>$(USERS_TABLE)$(sep))
> In fact I use the same trick as for ROOTFS_DEVICE_TABLES: whether
> ROOTFS_USERS_TABLE is 'foo' or 'foo bar quux', the invocation of `cat` is
> valid, as `cat` takes a list of filenames as arguments. So no need to loop
> on a list.

Oh, right. OK, then.

> But it is true that I should use the plural form ROOTFS_USERS_TABLES.

Yes, please.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 1/1] system: add ability to pass additional users tables.
  2014-03-27 16:19 ` [Buildroot] [PATCH 1/1] system: " Eric Le Bihan
  2014-03-27 18:19   ` Yann E. MORIN
@ 2014-04-20 17:21   ` Yann E. MORIN
  1 sibling, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2014-04-20 17:21 UTC (permalink / raw)
  To: buildroot

On 2014-03-27 17:19 +0100, Eric Le Bihan spake thusly:
> A new entry has been added to the "System Configuration" menu to allow
> the user to set the location of additional user tables (besides the ones
> defined in packages).
> 
> A user table is a text file, formatted using the mkusers syntax, which
> describes the users on the target system, with their UID/GID, home
> directory, password, etc.
> 
> The target root file system will be populated according the content of
> these files.
> 
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Although a minor nit below:

> ---
>  fs/common.mk     |    6 +++++-
>  system/Config.in |    9 +++++++++
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/common.mk b/fs/common.mk
> index d95c26b..6f37bd0 100644
> --- a/fs/common.mk
> +++ b/fs/common.mk
> @@ -33,6 +33,7 @@ FULL_DEVICE_TABLE = $(BUILD_DIR)/_device_table.txt
>  ROOTFS_DEVICE_TABLES = $(call qstrip,$(BR2_ROOTFS_DEVICE_TABLE) \
>         $(BR2_ROOTFS_STATIC_DEVICE_TABLE))
>  USERS_TABLE = $(BUILD_DIR)/_users_table.txt
> +ROOTFS_USERS_TABLE = $(call qstrip,$(BR2_ROOTFS_USERS_TABLE))

This is a list of space-separated files, so I'd prefer TABLE be a plural
TABLES.

>  define ROOTFS_TARGET_INTERNAL
>  
> @@ -78,7 +79,10 @@ endif
>  	printf '$$(subst $$(sep),\n,$$(PACKAGES_PERMISSIONS_TABLE))' >> $$(FULL_DEVICE_TABLE)
>  	echo "$$(HOST_DIR)/usr/bin/makedevs -d $$(FULL_DEVICE_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
>  endif
> -	printf '$(subst $(sep),\n,$(PACKAGES_USERS))' > $(USERS_TABLE)
> +ifneq ($$(ROOTFS_USERS_TABLE),)
> +	cat $$(ROOTFS_USERS_TABLE) > $(USERS_TABLE)

Rename here too.

> +endif
> +	printf '$(subst $(sep),\n,$(PACKAGES_USERS))' >> $(USERS_TABLE)
>  	$(TOPDIR)/support/scripts/mkusers $(USERS_TABLE) $(TARGET_DIR) >> $(FAKEROOT_SCRIPT)
>  	echo "$$(ROOTFS_$(2)_CMD)" >> $$(FAKEROOT_SCRIPT)
>  	chmod a+x $$(FAKEROOT_SCRIPT)
> diff --git a/system/Config.in b/system/Config.in
> index e8f1ed6..b7052f5 100644
> --- a/system/Config.in
> +++ b/system/Config.in
> @@ -280,6 +280,15 @@ config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
>  
>  endif # BR2_ROOTFS_SKELETON_DEFAULT
>  
> +config BR2_ROOTFS_USERS_TABLE

Rename here.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

end of thread, other threads:[~2014-04-20 17:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-27 16:19 [Buildroot] [RFC] add ability to pass additional users tables Eric Le Bihan
2014-03-27 16:19 ` [Buildroot] [PATCH 1/1] system: " Eric Le Bihan
2014-03-27 18:19   ` Yann E. MORIN
2014-03-28 11:10     ` Eric Le Bihan
2014-03-28 16:50       ` Yann E. MORIN
2014-04-20 17:21   ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.