| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | inherit useradd_base | 
|  | 2 |  | 
|  | 3 | # base-passwd-cross provides the default passwd and group files in the | 
|  | 4 | # target sysroot, and shadow -native and -sysroot provide the utilities | 
|  | 5 | # and support files needed to add and modify user and group accounts | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 6 | DEPENDS:append:class-target = " base-files shadow-native shadow-sysroot shadow base-passwd" | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 7 | PACKAGE_WRITE_DEPS += "shadow-native" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 8 |  | 
|  | 9 | # This preinstall function can be run in four different contexts: | 
|  | 10 | # | 
|  | 11 | # a) Before do_install | 
|  | 12 | # b) At do_populate_sysroot_setscene when installing from sstate packages | 
|  | 13 | # c) As the preinst script in the target package at do_rootfs time | 
|  | 14 | # d) As the preinst script in the target package on device as a package upgrade | 
|  | 15 | # | 
|  | 16 | useradd_preinst () { | 
|  | 17 | OPT="" | 
|  | 18 | SYSROOT="" | 
|  | 19 |  | 
|  | 20 | if test "x$D" != "x"; then | 
|  | 21 | # Installing into a sysroot | 
|  | 22 | SYSROOT="$D" | 
|  | 23 | OPT="--root $D" | 
|  | 24 |  | 
|  | 25 | # Make sure login.defs is there, this is to make debian package backend work | 
|  | 26 | # correctly while doing rootfs. | 
|  | 27 | # The problem here is that if /etc/login.defs is treated as a config file for | 
|  | 28 | # shadow package, then while performing preinsts for packages that depend on | 
|  | 29 | # shadow, there might only be /etc/login.def.dpkg-new there in root filesystem. | 
|  | 30 | if [ ! -e $D${sysconfdir}/login.defs -a -e $D${sysconfdir}/login.defs.dpkg-new ]; then | 
|  | 31 | cp $D${sysconfdir}/login.defs.dpkg-new $D${sysconfdir}/login.defs | 
|  | 32 | fi | 
|  | 33 |  | 
|  | 34 | # user/group lookups should match useradd/groupadd --root | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 35 | export PSEUDO_PASSWD="$SYSROOT" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 36 | fi | 
|  | 37 |  | 
|  | 38 | # If we're not doing a special SSTATE/SYSROOT install | 
|  | 39 | # then set the values, otherwise use the environment | 
|  | 40 | if test "x$UA_SYSROOT" = "x"; then | 
|  | 41 | # Installing onto a target | 
|  | 42 | # Add groups and users defined only for this package | 
|  | 43 | GROUPADD_PARAM="${GROUPADD_PARAM}" | 
|  | 44 | USERADD_PARAM="${USERADD_PARAM}" | 
|  | 45 | GROUPMEMS_PARAM="${GROUPMEMS_PARAM}" | 
|  | 46 | fi | 
|  | 47 |  | 
|  | 48 | # Perform group additions first, since user additions may depend | 
|  | 49 | # on these groups existing | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 50 | if test "x`echo $GROUPADD_PARAM | tr -d '[:space:]'`" != "x"; then | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 51 | echo "Running groupadd commands..." | 
|  | 52 | # Invoke multiple instances of groupadd for parameter lists | 
|  | 53 | # separated by ';' | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 54 | opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` | 
|  | 55 | remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 56 | while test "x$opts" != "x"; do | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 57 | perform_groupadd "$SYSROOT" "$OPT $opts" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 58 | if test "x$opts" = "x$remaining"; then | 
|  | 59 | break | 
|  | 60 | fi | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 61 | opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` | 
|  | 62 | remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 63 | done | 
|  | 64 | fi | 
|  | 65 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 66 | if test "x`echo $USERADD_PARAM | tr -d '[:space:]'`" != "x"; then | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 67 | echo "Running useradd commands..." | 
|  | 68 | # Invoke multiple instances of useradd for parameter lists | 
|  | 69 | # separated by ';' | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 70 | opts=`echo "$USERADD_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` | 
|  | 71 | remaining=`echo "$USERADD_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 72 | while test "x$opts" != "x"; do | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 73 | perform_useradd "$SYSROOT" "$OPT $opts" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 74 | if test "x$opts" = "x$remaining"; then | 
|  | 75 | break | 
|  | 76 | fi | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 77 | opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` | 
|  | 78 | remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 79 | done | 
|  | 80 | fi | 
|  | 81 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 82 | if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 83 | echo "Running groupmems commands..." | 
|  | 84 | # Invoke multiple instances of groupmems for parameter lists | 
|  | 85 | # separated by ';' | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 86 | opts=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` | 
|  | 87 | remaining=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 88 | while test "x$opts" != "x"; do | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 89 | perform_groupmems "$SYSROOT" "$OPT $opts" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 90 | if test "x$opts" = "x$remaining"; then | 
|  | 91 | break | 
|  | 92 | fi | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 93 | opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` | 
|  | 94 | remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 95 | done | 
|  | 96 | fi | 
|  | 97 | } | 
|  | 98 |  | 
|  | 99 | useradd_sysroot () { | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 100 | # Pseudo may (do_prepare_recipe_sysroot) or may not (do_populate_sysroot_setscene) be running | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 101 | # at this point so we're explicit about the environment so pseudo can load if | 
|  | 102 | # not already present. | 
| Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 103 | # PSEUDO_SYSROOT can contain references to the build architecture and COMPONENT_DIR | 
|  | 104 | # so needs the STAGING_FIXME below | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 105 | export PSEUDO="${FAKEROOTENV} ${PSEUDO_SYSROOT}${bindir_native}/pseudo" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 106 |  | 
|  | 107 | # Explicitly set $D since it isn't set to anything | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 108 | # before do_prepare_recipe_sysroot | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 109 | D=${STAGING_DIR_TARGET} | 
|  | 110 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 111 | # base-passwd's postinst may not have run yet in which case we'll get called later, just exit. | 
|  | 112 | # Beware that in some cases we might see the fake pseudo passwd here, in which case we also must | 
|  | 113 | # exit. | 
|  | 114 | if [ ! -f $D${sysconfdir}/passwd ] || | 
|  | 115 | grep -q this-is-the-pseudo-passwd $D${sysconfdir}/passwd; then | 
|  | 116 | exit 0 | 
|  | 117 | fi | 
|  | 118 |  | 
|  | 119 | # It is also possible we may be in a recipe which doesn't have useradd dependencies and hence the | 
|  | 120 | # useradd/groupadd tools are unavailable. If there is no dependency, we assume we don't want to | 
|  | 121 | # create users in the sysroot | 
|  | 122 | if ! command -v useradd; then | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 123 | bbwarn "command useradd not found!" | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 124 | exit 0 | 
|  | 125 | fi | 
|  | 126 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 127 | # Add groups and users defined for all recipe packages | 
|  | 128 | GROUPADD_PARAM="${@get_all_cmd_params(d, 'groupadd')}" | 
|  | 129 | USERADD_PARAM="${@get_all_cmd_params(d, 'useradd')}" | 
|  | 130 | GROUPMEMS_PARAM="${@get_all_cmd_params(d, 'groupmems')}" | 
|  | 131 |  | 
|  | 132 | # Tell the system to use the environment vars | 
|  | 133 | UA_SYSROOT=1 | 
|  | 134 |  | 
|  | 135 | useradd_preinst | 
|  | 136 | } | 
|  | 137 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 138 | # The export of PSEUDO in useradd_sysroot() above contains references to | 
| Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 139 | # ${PSEUDO_SYSROOT} and ${PSEUDO_LOCALSTATEDIR}. Additionally, the logging | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 140 | # shell functions use ${LOGFIFO}. These need to be handled when restoring | 
|  | 141 | # postinst-useradd-${PN} from the sstate cache. | 
| Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 142 | EXTRA_STAGING_FIXMES += "PSEUDO_SYSROOT PSEUDO_LOCALSTATEDIR LOGFIFO" | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 143 |  | 
|  | 144 | python useradd_sysroot_sstate () { | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 145 | scriptfile = None | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 146 | task = d.getVar("BB_CURRENTTASK") | 
|  | 147 | if task == "package_setscene": | 
|  | 148 | bb.build.exec_func("useradd_sysroot", d) | 
|  | 149 | elif task == "prepare_recipe_sysroot": | 
|  | 150 | # Used to update this recipe's own sysroot so the user/groups are available to do_install | 
|  | 151 | scriptfile = d.expand("${RECIPE_SYSROOT}${bindir}/postinst-useradd-${PN}") | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 152 | bb.build.exec_func("useradd_sysroot", d) | 
|  | 153 | elif task == "populate_sysroot": | 
|  | 154 | # Used when installed in dependent task sysroots | 
|  | 155 | scriptfile = d.expand("${SYSROOT_DESTDIR}${bindir}/postinst-useradd-${PN}") | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 156 |  | 
|  | 157 | if scriptfile: | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 158 | bb.utils.mkdirhier(os.path.dirname(scriptfile)) | 
|  | 159 | with open(scriptfile, 'w') as script: | 
|  | 160 | script.write("#!/bin/sh\n") | 
|  | 161 | bb.data.emit_func("useradd_sysroot", script, d) | 
|  | 162 | script.write("useradd_sysroot\n") | 
|  | 163 | os.chmod(scriptfile, 0o755) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 164 | } | 
|  | 165 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 166 | do_prepare_recipe_sysroot[postfuncs] += "${SYSROOTFUNC}" | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 167 | SYSROOTFUNC:class-target = "useradd_sysroot_sstate" | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 168 | SYSROOTFUNC = "" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 169 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 170 | SYSROOT_PREPROCESS_FUNCS += "${SYSROOTFUNC}" | 
|  | 171 |  | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 172 | SSTATEPREINSTFUNCS:append:class-target = " useradd_sysroot_sstate" | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 173 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 174 | do_package_setscene[depends] += "${USERADDSETSCENEDEPS}" | 
|  | 175 | do_populate_sysroot_setscene[depends] += "${USERADDSETSCENEDEPS}" | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 176 | USERADDSETSCENEDEPS:class-target = "${MLPREFIX}base-passwd:do_populate_sysroot_setscene pseudo-native:do_populate_sysroot_setscene shadow-native:do_populate_sysroot_setscene ${MLPREFIX}shadow-sysroot:do_populate_sysroot_setscene" | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 177 | USERADDSETSCENEDEPS = "" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 178 |  | 
|  | 179 | # Recipe parse-time sanity checks | 
|  | 180 | def update_useradd_after_parse(d): | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 181 | useradd_packages = d.getVar('USERADD_PACKAGES') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 182 |  | 
|  | 183 | if not useradd_packages: | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 184 | bb.fatal("%s inherits useradd but doesn't set USERADD_PACKAGES" % d.getVar('FILE', False)) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 185 |  | 
|  | 186 | for pkg in useradd_packages.split(): | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 187 | d.appendVarFlag("do_populate_sysroot", "vardeps", "USERADD_PARAM:%s GROUPADD_PARAM:%s GROUPMEMS_PARAM:%s" % (pkg, pkg, pkg)) | 
|  | 188 | if not d.getVar('USERADD_PARAM:%s' % pkg) and not d.getVar('GROUPADD_PARAM:%s' % pkg) and not d.getVar('GROUPMEMS_PARAM:%s' % pkg): | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 189 | bb.fatal("%s inherits useradd but doesn't set USERADD_PARAM, GROUPADD_PARAM or GROUPMEMS_PARAM for package %s" % (d.getVar('FILE', False), pkg)) | 
|  | 190 |  | 
|  | 191 | python __anonymous() { | 
|  | 192 | if not bb.data.inherits_class('nativesdk', d) \ | 
|  | 193 | and not bb.data.inherits_class('native', d): | 
|  | 194 | update_useradd_after_parse(d) | 
|  | 195 | } | 
|  | 196 |  | 
|  | 197 | # Return a single [GROUP|USER]ADD_PARAM formatted string which includes the | 
|  | 198 | # [group|user]add parameters for all USERADD_PACKAGES in this recipe | 
|  | 199 | def get_all_cmd_params(d, cmd_type): | 
|  | 200 | import string | 
|  | 201 |  | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 202 | param_type = cmd_type.upper() + "_PARAM:%s" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 203 | params = [] | 
|  | 204 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 205 | useradd_packages = d.getVar('USERADD_PACKAGES') or "" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 206 | for pkg in useradd_packages.split(): | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 207 | param = d.getVar(param_type % pkg) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 208 | if param: | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 209 | params.append(param.rstrip(" ;")) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 210 |  | 
|  | 211 | return "; ".join(params) | 
|  | 212 |  | 
|  | 213 | # Adds the preinst script into generated packages | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 214 | fakeroot python populate_packages:prepend () { | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 215 | def update_useradd_package(pkg): | 
|  | 216 | bb.debug(1, 'adding user/group calls to preinst for %s' % pkg) | 
|  | 217 |  | 
|  | 218 | """ | 
|  | 219 | useradd preinst is appended here because pkg_preinst may be | 
|  | 220 | required to execute on the target. Not doing so may cause | 
|  | 221 | useradd preinst to be invoked twice, causing unwanted warnings. | 
|  | 222 | """ | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 223 | preinst = d.getVar('pkg_preinst:%s' % pkg) or d.getVar('pkg_preinst') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 224 | if not preinst: | 
|  | 225 | preinst = '#!/bin/sh\n' | 
|  | 226 | preinst += 'bbnote () {\n\techo "NOTE: $*"\n}\n' | 
|  | 227 | preinst += 'bbwarn () {\n\techo "WARNING: $*"\n}\n' | 
|  | 228 | preinst += 'bbfatal () {\n\techo "ERROR: $*"\n\texit 1\n}\n' | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 229 | preinst += 'perform_groupadd () {\n%s}\n' % d.getVar('perform_groupadd') | 
|  | 230 | preinst += 'perform_useradd () {\n%s}\n' % d.getVar('perform_useradd') | 
|  | 231 | preinst += 'perform_groupmems () {\n%s}\n' % d.getVar('perform_groupmems') | 
|  | 232 | preinst += d.getVar('useradd_preinst') | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 233 | d.setVar('pkg_preinst:%s' % pkg, preinst) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 234 |  | 
|  | 235 | # RDEPENDS setup | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 236 | rdepends = d.getVar("RDEPENDS:%s" % pkg) or "" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 237 | rdepends += ' ' + d.getVar('MLPREFIX', False) + 'base-passwd' | 
|  | 238 | rdepends += ' ' + d.getVar('MLPREFIX', False) + 'shadow' | 
|  | 239 | # base-files is where the default /etc/skel is packaged | 
|  | 240 | rdepends += ' ' + d.getVar('MLPREFIX', False) + 'base-files' | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 241 | d.setVar("RDEPENDS:%s" % pkg, rdepends) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 242 |  | 
|  | 243 | # Add the user/group preinstall scripts and RDEPENDS requirements | 
|  | 244 | # to packages specified by USERADD_PACKAGES | 
|  | 245 | if not bb.data.inherits_class('nativesdk', d) \ | 
|  | 246 | and not bb.data.inherits_class('native', d): | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 247 | useradd_packages = d.getVar('USERADD_PACKAGES') or "" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 248 | for pkg in useradd_packages.split(): | 
|  | 249 | update_useradd_package(pkg) | 
|  | 250 | } | 
|  | 251 |  | 
|  | 252 | # Use the following to extend the useradd with custom functions | 
|  | 253 | USERADDEXTENSION ?= "" | 
|  | 254 |  | 
|  | 255 | inherit ${USERADDEXTENSION} |