useradd-staticids.bbclass: Support recipes specifying static IDs
PATCH v2 1/2 useradd-staticids.bbclass: Support recipes specifying static IDs
If this bblcass is used and a recipe specifies a static ID for a user/group as part of the USERADD_PARAM_${PN} or GROUPADD_PARAM_${PN}, the build would fail with and error like this if there was no corresponding ID in the passwd/group files specified via USERADD_UID_TABLES/USERADD_GID_TABLES:
ERROR: meta-oe/recipes-support/postgresql/postgresql_9.4.11.bb:
meta-oe/recipes-support/postgresql/postgresql_9.4.11.bb inherits useradd but doesn't set USERADD_PARAM, GROUPADD_PARAM or GROUPMEMS_PARAM for package postgresql
--- meta/classes/useradd-staticids.bbclass | 2 ++ 1 file changed, 2 insertions(+)
meta/classes/useradd-staticids.bbclass +2 -0
@@ -125,6 +125,7 @@ def update_useradd_static_config(d): if uaargs.LOGIN not in users: if not uaargs.uid or not uaargs.uid.isdigit() or not uaargs.gid: handle_missing_id(uaargs.LOGIN, 'user', pkg) + newparams.append(param) continue field = users[uaargs.LOGIN]
@@ -260,6 +261,7 @@ def update_useradd_static_config(d): if gaargs.GROUP not in groups: if not gaargs.gid or not gaargs.gid.isdigit(): handle_missing_id(gaargs.GROUP, 'group', pkg) + newparams.append(param) continue field = groups[gaargs.GROUP]
Signature · 1 line
2.12.0
PATCH v2 2/2 useradd-staticids.bbclass: Always fail/warn for missing IDs
Previously, with USERADD_ERROR_DYNAMIC set to error/warn, if a static UID/GID was specified in the recipe, then no error/warning would be issued even if no ID was specified in the passwd/groups files.
--- meta/classes/useradd-staticids.bbclass | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
meta/classes/useradd-staticids.bbclass +2 -4
@@ -123,8 +123,7 @@ def update_useradd_static_config(d): users = merge_files(get_passwd_list(d), 7) if uaargs.LOGIN not in users: - if not uaargs.uid or not uaargs.uid.isdigit() or not uaargs.gid: - handle_missing_id(uaargs.LOGIN, 'user', pkg) + handle_missing_id(uaargs.LOGIN, 'user', pkg) newparams.append(param) continue
@@ -259,8 +258,7 @@ def update_useradd_static_config(d): groups = merge_files(get_group_list(d), 4) if gaargs.GROUP not in groups: - if not gaargs.gid or not gaargs.gid.isdigit(): - handle_missing_id(gaargs.GROUP, 'group', pkg) + handle_missing_id(gaargs.GROUP, 'group', pkg) newparams.append(param) continue
Signature · 1 line
2.12.0
Re: [PATCHv2 2/2] useradd-staticids.bbclass: Always fail/warn for missing IDs
Quoted 3 lines · Peter Kjellerstedt
Previously, with
USERADD_ERROR_DYNAMICset to error/warn, if a static UID/GID was specified in the recipe, then no error/warning would be issued even if no ID was specified in the passwd/groups files.
I'm glad it was this simple to implement.
Acked.
--Mark
Quoted 30 lines
Signed-off-by Peter Kjellerstedt <[email protected]>--- meta/classes/useradd-staticids.bbclass | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)meta/classes/useradd-staticids.bbclass +2
-4@@ -123,8 +123,7 @@ def update_useradd_static_config(d): users = merge_files(get_passwd_list(d), 7) if uaargs.LOGIN not in users: - if not uaargs.uid or not uaargs.uid.isdigit() or not uaargs.gid: - handle_missing_id(uaargs.LOGIN, 'user', pkg) + handle_missing_id(uaargs.LOGIN, 'user', pkg) newparams.append(param) continue@@ -259,8 +258,7 @@ def update_useradd_static_config(d): groups = merge_files(get_group_list(d), 4) if gaargs.GROUP not in groups: - if not gaargs.gid or not gaargs.gid.isdigit(): - handle_missing_id(gaargs.GROUP, 'group', pkg) + handle_missing_id(gaargs.GROUP, 'group', pkg) newparams.append(param) continue
Quoted 1 line · Peter Kjellerstedt
If this bblcass is used and a recipe specifies a static ID for a
'bbclass' (typo)
Otherwise, acked.
Quoted 36 lines
user/group as part of the USERADD_PARAM_${PN} or GROUPADD_PARAM_${PN}, the build would fail with and error like this if there was no corresponding ID in the passwd/group files specified via USERADD_UID_TABLES/USERADD_GID_TABLES:
ERROR: meta-oe/recipes-support/postgresql/postgresql_9.4.11.bb:
meta-oe/recipes-support/postgresql/postgresql_9.4.11.bb inherits useradd but doesn't setUSERADD_PARAM,GROUPADD_PARAMorGROUPMEMS_PARAMfor package postgresqlSigned-off-by Peter Kjellerstedt <[email protected]>--- meta/classes/useradd-staticids.bbclass | 2 ++ 1 file changed, 2 insertions(+)meta/classes/useradd-staticids.bbclass +2
-0@@ -125,6 +125,7 @@ def update_useradd_static_config(d): if uaargs.LOGIN not in users: if not uaargs.uid or not uaargs.uid.isdigit() or not uaargs.gid: handle_missing_id(uaargs.LOGIN, 'user', pkg) + newparams.append(param) continue field = users[uaargs.LOGIN]@@ -260,6 +261,7 @@ def update_useradd_static_config(d): if gaargs.GROUP not in groups: if not gaargs.gid or not gaargs.gid.isdigit(): handle_missing_id(gaargs.GROUP, 'group', pkg) + newparams.append(param) continue field = groups[gaargs.GROUP]