Skip to contentSkip to conversation

scripts/mkusers: allow the creation of groups alone

PATCH New Gustavo Zacarias 3 participants 9 messages Oct 21, 2014 – Oct 22, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 scripts/mkusers: allow the creation of groups alone

Let mkusers create groups alone, useful for supplementary permissions in udev/systemd for example where users can be added to later at runtime. Use a magic string "-" to signal that user creation should be skipped.

---
 support/scripts/mkusers | 2 ++
 1 file changed, 2 insertions(+)
support/scripts/mkusers +2 -0
index ffd192d..5e5a5d9 100755
@@ -397,6 +397,7 @@ main() {
     # Now, add users whose uid is *not* automatic
     while read username uid group gid passwd home shell groups comment; do
         [ -n "${username}" ] || continue    # Package with no user
+        [ "${username}" != "-" ] || continue # Magic string to skip user creation
         [ ${uid} -ge 0     ] || continue    # Automatic uid
         add_one_user "${username}" "${uid}" "${group}" "${gid}" "${passwd}" \
                      "${home}" "${shell}" "${groups}" "${comment}"
@@ -405,6 +406,7 @@ main() {
     # Finally, add users whose uid *is* automatic
     while read username uid group gid passwd home shell groups comment; do
         [ -n "${username}" ] || continue    # Package with no user
+        [ "${username}" != "-" ] || continue # Magic string to skip user creation
         [ ${uid} -eq -1    ] || continue    # Non-automatic uid
         add_one_user "${username}" "${uid}" "${group}" "${gid}" "${passwd}" \
                      "${home}" "${shell}" "${groups}" "${comment}"
Signature · 1 line
2.0.4
#1 lore raw

PATCH 2/4 docs/manual: document makeusers group-only creation

---
 docs/manual/makeusers-syntax.txt | 2 ++
 1 file changed, 2 insertions(+)
docs/manual/makeusers-syntax.txt +2 -0
index 5b3f347..8e64a0e 100644
@@ -51,6 +51,8 @@ There are a few restrictions on the content of each field:
 If +home+ is not +-+, then the home directory, and all files below,
 will belong to the user and its main group.
 
+If +username+ is +-+, then just a group will be created.
+
 Examples:
 
 ----
Signature · 1 line
2.0.4
#2 lore raw

PATCH 2/4 docs/manual: document makeusers group-only creation

Gustavo, All,

On 2014-10-21 11:26 -0300, Gustavo Zacarias spake thusly:

Quoted 10 lines
---
 docs/manual/makeusers-syntax.txt | 2 ++
 1 file changed, 2 insertions(+)
docs/manual/makeusers-syntax.txt +0 -0
index 5b3f347..8e64a0e 100644

docs/manual/makeusers-syntax.txt There are a few restrictions on the content of each field: · line 55

Quoted 5 lines
docs/manual/makeusers-syntax.txt +2 -0
@@ -51,6 +51,8 @@ There are a few restrictions on the content of each field:
 If +home+ is not +-+, then the home directory, and all files below,
 will belong to the user and its main group.
 
+If +username+ is +-+, then just a group will be created.
+

I would have preferred we add this to the existing explanations about the user filed, lsomething like:

- +username+ is the desired user name (aka login name) for the user. It can not be +root+, and must be unique. If set to +-+, then just a group will be created.

But I won;t be pedantic about this, so if the maintainer wants it as-is, you get my:

Regards,
Yann E. MORIN.

Quoted 10 lines
docs/manual/makeusers-syntax.txt +0 -0
 Examples:
 
 ----
Signature · 6 lines
2.0.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 3/4 eudev: add input group

In reply to Gustavo Zacarias

It's used by 50-default-udev.rules for input-class devices.

---
 package/eudev/eudev.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/eudev/eudev.mk +5 -0
index fd935a7..3cd22be 100644
@@ -42,4 +42,9 @@ define EUDEV_INSTALL_INIT_SYSV
 	$(INSTALL) -m 0755 package/eudev/S10udev $(TARGET_DIR)/etc/init.d/S10udev
 endef
 
+# Required by default rules for input devices
+define EUDEV_USERS
+	- - input -1 * - - - Input device group
+endef
+
 $(eval $(autotools-package))
Signature · 1 line
2.0.4
#4 lore raw

PATCH 3/4 eudev: add input group

Gustavo, All,

On 2014-10-21 11:26 -0300, Gustavo Zacarias spake thusly:

Quoted 3 lines

It's used by 50-default-udev.rules for input-class devices.

Regards,
Yann E. MORIN.

Quoted 25 lines
---
 package/eudev/eudev.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/eudev/eudev.mk +5 -0
index fd935a7..3cd22be 100644
@@ -42,4 +42,9 @@ define EUDEV_INSTALL_INIT_SYSV
 	$(INSTALL) -m 0755 package/eudev/S10udev $(TARGET_DIR)/etc/init.d/S10udev
 endef
 
+# Required by default rules for input devices
+define EUDEV_USERS
+	- - input -1 * - - - Input device group
+endef
+
 $(eval $(autotools-package))
Signature · 6 lines
2.0.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 4/4 systemd: add input group

In reply to Gustavo Zacarias

It's used by 50-default-udev.rules for input-class devices.

---
 package/systemd/systemd.mk | 1 +
 1 file changed, 1 insertion(+)
package/systemd/systemd.mk +1 -0
index fd19bff..75a32f4 100644
@@ -179,6 +179,7 @@ define SYSTEMD_USERS
 	systemd-bus-proxy -1 systemd-bus-proxy -1 * - - - Proxy D-Bus messages to/from a bus
 	systemd-timesync -1 systemd-timesync -1 * - - - Network Time Synchronization
 	systemd-network -1 systemd-network -1 * - - - Network Manager
+	- - input -1 * - - - Input device group
 endef
 
 define SYSTEMD_DISABLE_SERVICE_TTY1
Signature · 1 line
2.0.4
#6 lore raw

PATCH 4/4 systemd: add input group

Gustavo, All,

On 2014-10-21 11:26 -0300, Gustavo Zacarias spake thusly:

Quoted 3 lines

It's used by 50-default-udev.rules for input-class devices.

Regards,
Yann E. MORIN.

Quoted 23 lines
---
 package/systemd/systemd.mk | 1 +
 1 file changed, 1 insertion(+)
package/systemd/systemd.mk +1 -0
index fd19bff..75a32f4 100644
@@ -179,6 +179,7 @@ define SYSTEMD_USERS
 	systemd-bus-proxy -1 systemd-bus-proxy -1 * - - - Proxy D-Bus messages to/from a bus
 	systemd-timesync -1 systemd-timesync -1 * - - - Network Time Synchronization
 	systemd-network -1 systemd-network -1 * - - - Network Manager
+	- - input -1 * - - - Input device group
 endef
 
 define SYSTEMD_DISABLE_SERVICE_TTY1
Signature · 6 lines
2.0.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#7 lore raw

PATCH 1/4 scripts/mkusers: allow the creation of groups alone

In reply to Gustavo Zacarias

Gustavo, All,

On 2014-10-21 11:26 -0300, Gustavo Zacarias spake thusly:

Quoted 3 lines

Let mkusers create groups alone, useful for supplementary permissions in udev/systemd for example where users can be added to later at runtime. Use a magic string "-" to signal that user creation should be skipped.

Gah, FIFO de-queuing. You beat me to it! :-)

Quoted 1 line

Regards,
Yann E. MORIN.

Quoted 31 lines
---
 support/scripts/mkusers | 2 ++
 1 file changed, 2 insertions(+)
support/scripts/mkusers +2 -0
index ffd192d..5e5a5d9 100755
@@ -397,6 +397,7 @@ main() {
     # Now, add users whose uid is *not* automatic
     while read username uid group gid passwd home shell groups comment; do
         [ -n "${username}" ] || continue    # Package with no user
+        [ "${username}" != "-" ] || continue # Magic string to skip user creation
         [ ${uid} -ge 0     ] || continue    # Automatic uid
         add_one_user "${username}" "${uid}" "${group}" "${gid}" "${passwd}" \
                      "${home}" "${shell}" "${groups}" "${comment}"
@@ -405,6 +406,7 @@ main() {
     # Finally, add users whose uid *is* automatic
     while read username uid group gid passwd home shell groups comment; do
         [ -n "${username}" ] || continue    # Package with no user
+        [ "${username}" != "-" ] || continue # Magic string to skip user creation
         [ ${uid} -eq -1    ] || continue    # Non-automatic uid
         add_one_user "${username}" "${uid}" "${group}" "${gid}" "${passwd}" \
                      "${home}" "${shell}" "${groups}" "${comment}"
Signature · 6 lines
2.0.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

PATCH 1/4 scripts/mkusers: allow the creation of groups alone

In reply to Gustavo Zacarias

Dear Gustavo Zacarias,

Quoted 8 lines · Gustavo Zacarias

Let mkusers create groups alone, useful for supplementary permissions in udev/systemd for example where users can be added to later at runtime. Use a magic string "-" to signal that user creation should be skipped.

---
 support/scripts/mkusers | 2 ++
 1 file changed, 2 insertions(+)

I've applied the four patches. On the documentation patch, I've taken into account the suggestion of Yann to slightly adjust the commit.

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com