diff options
author | Scott Garman <scott.a.garman@intel.com> | 2011-11-08 18:23:48 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-11-10 11:37:12 +0000 |
commit | 67a2c3553090ce3f74f48f6a46c7cbb1bcb2100d (patch) | |
tree | af608a48e856d7673bcf29e000b7d14b50763de2 /meta/classes/useradd.bbclass | |
parent | 4fc4be64384dd2a6ef83c529e2f328926aebd766 (diff) | |
download | poky-67a2c3553090ce3f74f48f6a46c7cbb1bcb2100d.tar.gz |
useradd.bbclass: only modify packages in USERADD_PACKAGES
Previously we injected the user/group preinstall script into all
output packages. This fixes that so that only packages listed in
USERADD_PACKAGES get modified.
It also removes the USERADDPN variable, which is no longer needed.
(From OE-Core rev: 2f73466eb5018040a123ccb0e2af8c519525f958)
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/useradd.bbclass')
-rw-r--r-- | meta/classes/useradd.bbclass | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass index a8a1c14f48..3b2d1dbfe8 100644 --- a/meta/classes/useradd.bbclass +++ b/meta/classes/useradd.bbclass | |||
@@ -1,5 +1,3 @@ | |||
1 | USERADDPN ?= "${PN}" | ||
2 | |||
3 | # base-passwd-cross provides the default passwd and group files in the | 1 | # base-passwd-cross provides the default passwd and group files in the |
4 | # target sysroot, and shadow -native and -sysroot provide the utilities | 2 | # target sysroot, and shadow -native and -sysroot provide the utilities |
5 | # and support files needed to add and modify user and group accounts | 3 | # and support files needed to add and modify user and group accounts |
@@ -106,30 +104,29 @@ SYSROOTPOSTFUNC_virtclass-nativesdk = "" | |||
106 | 104 | ||
107 | # Recipe parse-time sanity checks | 105 | # Recipe parse-time sanity checks |
108 | def update_useradd_after_parse(d): | 106 | def update_useradd_after_parse(d): |
109 | if not d.getVar('USERADD_PACKAGES', False): | 107 | useradd_packages = d.getVar('USERADD_PACKAGES', True) |
110 | if not d.getVar('USERADD_PARAM', False) and not d.getVar('GROUPADD_PARAM', False): | 108 | |
111 | raise bb.build.FuncFailed, "%s inherits useradd but doesn't set USERADD_PARAM or GROUPADD_PARAM" % bb.data.getVar('FILE', d) | 109 | if not useradd_packages: |
110 | raise bb.build.FuncFailed, "%s inherits useradd but doesn't set USERADD_PACKAGES" % bb.data.getVar('FILE', d) | ||
111 | |||
112 | for pkg in useradd_packages.split(): | ||
113 | if not d.getVar('USERADD_PARAM_%s' % pkg, True) and not d.getVar('GROUPADD_PARAM_%s' % pkg, True): | ||
114 | raise bb.build.FuncFailed, "%s inherits useradd but doesn't set USERADD_PARAM or GROUPADD_PARAM for package %s" % (bb.data.getVar('FILE', d), pkg) | ||
112 | 115 | ||
113 | python __anonymous() { | 116 | python __anonymous() { |
114 | update_useradd_after_parse(d) | 117 | update_useradd_after_parse(d) |
115 | } | 118 | } |
116 | 119 | ||
117 | # Return a single [GROUP|USER]ADD_PARAM formatted string which includes the | 120 | # Return a single [GROUP|USER]ADD_PARAM formatted string which includes the |
118 | # [group|user]add parameters for all packages in this recipe | 121 | # [group|user]add parameters for all USERADD_PACKAGES in this recipe |
119 | def get_all_cmd_params(d, cmd_type): | 122 | def get_all_cmd_params(d, cmd_type): |
120 | import string | 123 | import string |
121 | 124 | ||
122 | param_type = cmd_type.upper() + "ADD_PARAM_%s" | 125 | param_type = cmd_type.upper() + "ADD_PARAM_%s" |
123 | params = [] | 126 | params = [] |
124 | 127 | ||
125 | pkgs = d.getVar('USERADD_PACKAGES', True) | 128 | useradd_packages = d.getVar('USERADD_PACKAGES', True) or "" |
126 | if not pkgs: | 129 | for pkg in useradd_packages.split(): |
127 | pkgs = d.getVar('USERADDPN', True) | ||
128 | packages = (d.getVar('PACKAGES', True) or "").split() | ||
129 | if packages and pkgs not in packages: | ||
130 | pkgs = packages[0] | ||
131 | |||
132 | for pkg in pkgs.split(): | ||
133 | param = d.getVar(param_type % pkg, True) | 130 | param = d.getVar(param_type % pkg, True) |
134 | if param: | 131 | if param: |
135 | params.append(param) | 132 | params.append(param) |
@@ -156,17 +153,10 @@ fakeroot python populate_packages_prepend () { | |||
156 | rdepends = d.getVar("RDEPENDS_%s" % pkg, True) or "" | 153 | rdepends = d.getVar("RDEPENDS_%s" % pkg, True) or "" |
157 | rdepends += " base-passwd shadow" | 154 | rdepends += " base-passwd shadow" |
158 | bb.data.setVar("RDEPENDS_%s" % pkg, rdepends, d) | 155 | bb.data.setVar("RDEPENDS_%s" % pkg, rdepends, d) |
159 | 156 | ||
160 | # We add the user/group calls to all packages to allow any package | 157 | # Add the user/group preinstall scripts and RDEPENDS requirements |
161 | # to contain files owned by the users/groups defined in the recipe. | 158 | # to packages specified by USERADD_PACKAGES |
162 | # The user/group addition code is careful not to create duplicate | 159 | useradd_packages = d.getVar('USERADD_PACKAGES', True) or "" |
163 | # entries, so this is safe. | 160 | for pkg in useradd_packages.split(): |
164 | pkgs = d.getVar('USERADD_PACKAGES', True) | ||
165 | if not pkgs: | ||
166 | pkgs = d.getVar('USERADDPN', True) | ||
167 | packages = (d.getVar('PACKAGES', True) or "").split() | ||
168 | if packages and pkgs not in packages: | ||
169 | pkgs = packages[0] | ||
170 | for pkg in pkgs.split(): | ||
171 | update_useradd_package(pkg) | 161 | update_useradd_package(pkg) |
172 | } | 162 | } |