blob: 690fa976aae54a94cb8d39939f633145502ef9af [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7# Zap the root password if debug-tweaks and empty-root-password features are not enabled
8ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'empty-root-password' ], "", "zap_empty_root_password; ",d)}'
9
10# Allow dropbear/openssh to accept logins from accounts with an empty password string if debug-tweaks or allow-empty-password is enabled
11ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-empty-password' ], "ssh_allow_empty_password; ", "",d)}'
12
13# Allow dropbear/openssh to accept root logins if debug-tweaks or allow-root-login is enabled
14ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], "ssh_allow_root_login; ", "",d)}'
15
16# Autologin the root user on the serial console, if empty-root-password and serial-autologin-root are active
17ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", [ 'empty-root-password', 'serial-autologin-root' ], "serial_autologin_root; ", "",d)}'
18
19# Enable postinst logging if debug-tweaks or post-install-logging is enabled
20ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'post-install-logging' ], "postinst_enable_logging; ", "",d)}'
21
22# Create /etc/timestamp during image construction to give a reasonably sane default time setting
23ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp; "
24
Andrew Geissler87f5cff2022-09-30 13:13:31 -050025# Tweak files in /etc if read-only-rootfs is enabled
Patrick Williams92b42cb2022-09-03 06:53:57 -050026ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "read_only_rootfs_hook; ", "",d)}'
27
28# We also need to do the same for the kernel boot parameters,
29# otherwise kernel or initramfs end up mounting the rootfs read/write
30# (the default) if supported by the underlying storage.
31#
32# We do this with :append because the default value might get set later with ?=
33# and we don't want to disable such a default that by setting a value here.
34APPEND:append = '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " ro", "", d)}'
35
36# Generates test data file with data store variables expanded in json format
37ROOTFS_POSTPROCESS_COMMAND += "write_image_test_data; "
38
39# Write manifest
40IMAGE_MANIFEST = "${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.manifest"
41ROOTFS_POSTUNINSTALL_COMMAND =+ "write_image_manifest ; "
42# Set default postinst log file
43POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log"
44# Set default target for systemd images
45SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains_any("IMAGE_FEATURES", [ "x11-base", "weston" ], "graphical.target", "multi-user.target", d)}'
46ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; systemd_create_users;", "", d)}'
47
48ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
49
50ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "overlayfs", "overlayfs_qa_check; overlayfs_postprocess;", "", d)}'
51
52inherit image-artifact-names
53
54# Sort the user and group entries in /etc by ID in order to make the content
55# deterministic. Package installs are not deterministic, causing the ordering
56# of entries to change between builds. In case that this isn't desired,
57# the command can be overridden.
58#
59# Note that useradd-staticids.bbclass has to be used to ensure that
60# the numeric IDs of dynamically created entries remain stable.
61#
62# We want this to run as late as possible, in particular after
63# systemd_sysusers_create and set_user_group. Using :append is not
64# enough for that, set_user_group is added that way and would end
65# up running after us.
66SORT_PASSWD_POSTPROCESS_COMMAND ??= " tidy_shadowutils_files; "
67python () {
68 d.appendVar('ROOTFS_POSTPROCESS_COMMAND', '${SORT_PASSWD_POSTPROCESS_COMMAND}')
69 d.appendVar('ROOTFS_POSTPROCESS_COMMAND', 'rootfs_reproducible;')
70}
71
72systemd_create_users () {
73 for conffile in ${IMAGE_ROOTFS}/usr/lib/sysusers.d/*.conf; do
74 [ -e $conffile ] || continue
75 grep -v "^#" $conffile | sed -e '/^$/d' | while read type name id comment; do
76 if [ "$type" = "u" ]; then
77 useradd_params="--shell /sbin/nologin"
78 [ "$id" != "-" ] && useradd_params="$useradd_params --uid $id"
79 [ "$comment" != "-" ] && useradd_params="$useradd_params --comment $comment"
80 useradd_params="$useradd_params --system $name"
81 eval useradd --root ${IMAGE_ROOTFS} $useradd_params || true
82 elif [ "$type" = "g" ]; then
83 groupadd_params=""
84 [ "$id" != "-" ] && groupadd_params="$groupadd_params --gid $id"
85 groupadd_params="$groupadd_params --system $name"
86 eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true
87 elif [ "$type" = "m" ]; then
88 group=$id
89 eval groupadd --root ${IMAGE_ROOTFS} --system $group || true
90 eval useradd --root ${IMAGE_ROOTFS} --shell /sbin/nologin --system $name --no-user-group || true
91 eval usermod --root ${IMAGE_ROOTFS} -a -G $group $name
92 fi
93 done
94 done
95}
96
97#
98# A hook function to support read-only-rootfs IMAGE_FEATURES
99#
100read_only_rootfs_hook () {
101 # Tweak the mount option and fs_passno for rootfs in fstab
102 if [ -f ${IMAGE_ROOTFS}/etc/fstab ]; then
103 sed -i -e '/^[#[:space:]]*\/dev\/root/{s/defaults/ro/;s/\([[:space:]]*[[:digit:]]\)\([[:space:]]*\)[[:digit:]]$/\1\20/}' ${IMAGE_ROOTFS}/etc/fstab
104 fi
105
106 # Tweak the "mount -o remount,rw /" command in busybox-inittab inittab
107 if [ -f ${IMAGE_ROOTFS}/etc/inittab ]; then
108 sed -i 's|/bin/mount -o remount,rw /|/bin/mount -o remount,ro /|' ${IMAGE_ROOTFS}/etc/inittab
109 fi
110
111 # If we're using openssh and the /etc/ssh directory has no pre-generated keys,
112 # we should configure openssh to use the configuration file /etc/ssh/sshd_config_readonly
113 # and the keys under /var/run/ssh.
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500114 # If overlayfs-etc is used this is not done as /etc is treated as writable
115 # If stateless-rootfs is enabled this is always done as we don't want to save keys then
116 if ${@ 'true' if not bb.utils.contains('IMAGE_FEATURES', 'overlayfs-etc', True, False, d) or bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else 'false'}; then
117 if [ -d ${IMAGE_ROOTFS}/etc/ssh ]; then
118 if [ -e ${IMAGE_ROOTFS}/etc/ssh/ssh_host_rsa_key ]; then
119 echo "SYSCONFDIR=\${SYSCONFDIR:-/etc/ssh}" >> ${IMAGE_ROOTFS}/etc/default/ssh
120 echo "SSHD_OPTS=" >> ${IMAGE_ROOTFS}/etc/default/ssh
121 else
122 echo "SYSCONFDIR=\${SYSCONFDIR:-/var/run/ssh}" >> ${IMAGE_ROOTFS}/etc/default/ssh
123 echo "SSHD_OPTS='-f /etc/ssh/sshd_config_readonly'" >> ${IMAGE_ROOTFS}/etc/default/ssh
124 fi
Patrick Williams92b42cb2022-09-03 06:53:57 -0500125 fi
Patrick Williams92b42cb2022-09-03 06:53:57 -0500126
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500127 # Also tweak the key location for dropbear in the same way.
128 if [ -d ${IMAGE_ROOTFS}/etc/dropbear ]; then
129 if [ ! -e ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key ]; then
130 echo "DROPBEAR_RSAKEY_DIR=/var/lib/dropbear" >> ${IMAGE_ROOTFS}/etc/default/dropbear
131 fi
Patrick Williams92b42cb2022-09-03 06:53:57 -0500132 fi
133 fi
134
135 if ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "true", "false", d)}; then
136 # Change the value of ROOTFS_READ_ONLY in /etc/default/rcS to yes
137 if [ -e ${IMAGE_ROOTFS}/etc/default/rcS ]; then
138 sed -i 's/ROOTFS_READ_ONLY=no/ROOTFS_READ_ONLY=yes/' ${IMAGE_ROOTFS}/etc/default/rcS
139 fi
140 # Run populate-volatile.sh at rootfs time to set up basic files
141 # and directories to support read-only rootfs.
142 if [ -x ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh ]; then
143 ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh
144 fi
145 fi
146
147 if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
148 # Create machine-id
149 # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable
150 touch ${IMAGE_ROOTFS}${sysconfdir}/machine-id
151 fi
152}
153
154#
155# This function disallows empty root passwords
156#
157zap_empty_root_password () {
158 if [ -e ${IMAGE_ROOTFS}/etc/shadow ]; then
159 sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/shadow
160 fi
161 if [ -e ${IMAGE_ROOTFS}/etc/passwd ]; then
162 sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/passwd
163 fi
164}
165
166#
167# allow dropbear/openssh to accept logins from accounts with an empty password string
168#
169ssh_allow_empty_password () {
170 for config in sshd_config sshd_config_readonly; do
171 if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config ]; then
172 sed -i 's/^[#[:space:]]*PermitEmptyPasswords.*/PermitEmptyPasswords yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config
173 fi
174 done
175
176 if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then
177 if grep -q DROPBEAR_EXTRA_ARGS ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then
178 if ! grep -q "DROPBEAR_EXTRA_ARGS=.*-B" ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear ; then
179 sed -i 's/^DROPBEAR_EXTRA_ARGS="*\([^"]*\)"*/DROPBEAR_EXTRA_ARGS="\1 -B"/' ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
180 fi
181 else
182 printf '\nDROPBEAR_EXTRA_ARGS="-B"\n' >> ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
183 fi
184 fi
185
186 if [ -d ${IMAGE_ROOTFS}${sysconfdir}/pam.d ] ; then
187 for f in `find ${IMAGE_ROOTFS}${sysconfdir}/pam.d/* -type f -exec test -e {} \; -print`
188 do
189 sed -i 's/nullok_secure/nullok/' $f
190 done
191 fi
192}
193
194#
195# allow dropbear/openssh to accept root logins
196#
197ssh_allow_root_login () {
198 for config in sshd_config sshd_config_readonly; do
199 if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config ]; then
200 sed -i 's/^[#[:space:]]*PermitRootLogin.*/PermitRootLogin yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config
201 fi
202 done
203
204 if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then
205 if grep -q DROPBEAR_EXTRA_ARGS ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then
206 sed -i '/^DROPBEAR_EXTRA_ARGS=/ s/-w//' ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500207 sed -i '/^# Disallow root/d' ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
Patrick Williams92b42cb2022-09-03 06:53:57 -0500208 fi
209 fi
210}
211
212#
213# Autologin the 'root' user on the serial terminal,
214# if empty-root-password' AND 'serial-autologin-root are enabled
215#
216serial_autologin_root () {
217 if ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "true", "false", d)}; then
218 # add autologin option to util-linux getty only
219 sed -i 's/options="/&--autologin root /' \
220 "${IMAGE_ROOTFS}${base_bindir}/start_getty"
221 elif ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
222 if [ -e ${IMAGE_ROOTFS}${systemd_system_unitdir}/serial-getty@.service ]; then
223 sed -i '/^\s*ExecStart\b/ s/getty /&--autologin root /' \
224 "${IMAGE_ROOTFS}${systemd_system_unitdir}/serial-getty@.service"
225 fi
226 fi
227}
228
229python tidy_shadowutils_files () {
230 import rootfspostcommands
231 rootfspostcommands.tidy_shadowutils_files(d.expand('${IMAGE_ROOTFS}${sysconfdir}'))
232}
233
234python sort_passwd () {
235 """
236 Deprecated in the favour of tidy_shadowutils_files.
237 """
238 import rootfspostcommands
239 bb.warn('[sort_passwd] You are using a deprecated function for '
240 'SORT_PASSWD_POSTPROCESS_COMMAND. The default one is now called '
241 '"tidy_shadowutils_files".')
242 rootfspostcommands.tidy_shadowutils_files(d.expand('${IMAGE_ROOTFS}${sysconfdir}'))
243}
244
245#
246# Enable postinst logging
247#
248postinst_enable_logging () {
249 mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/default
250 echo "POSTINST_LOGGING=1" >> ${IMAGE_ROOTFS}${sysconfdir}/default/postinst
251 echo "LOGFILE=${POSTINST_LOGFILE}" >> ${IMAGE_ROOTFS}${sysconfdir}/default/postinst
252}
253
254#
255# Modify systemd default target
256#
257set_systemd_default_target () {
258 if [ -d ${IMAGE_ROOTFS}${sysconfdir}/systemd/system -a -e ${IMAGE_ROOTFS}${systemd_system_unitdir}/${SYSTEMD_DEFAULT_TARGET} ]; then
259 ln -sf ${systemd_system_unitdir}/${SYSTEMD_DEFAULT_TARGET} ${IMAGE_ROOTFS}${sysconfdir}/systemd/system/default.target
260 fi
261}
262
263# If /var/volatile is not empty, we have seen problems where programs such as the
264# journal make assumptions based on the contents of /var/volatile. The journal
265# would then write to /var/volatile before it was mounted, thus hiding the
266# items previously written.
267#
268# This change is to attempt to fix those types of issues in a way that doesn't
269# affect users that may not be using /var/volatile.
270empty_var_volatile () {
271 if [ -e ${IMAGE_ROOTFS}/etc/fstab ]; then
272 match=`awk '$1 !~ "#" && $2 ~ /\/var\/volatile/{print $2}' ${IMAGE_ROOTFS}/etc/fstab 2> /dev/null`
273 if [ -n "$match" ]; then
274 find ${IMAGE_ROOTFS}/var/volatile -mindepth 1 -delete
275 fi
276 fi
277}
278
279# Turn any symbolic /sbin/init link into a file
280remove_init_link () {
281 if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
282 LINKFILE=${IMAGE_ROOTFS}`readlink ${IMAGE_ROOTFS}/sbin/init`
283 rm ${IMAGE_ROOTFS}/sbin/init
284 cp $LINKFILE ${IMAGE_ROOTFS}/sbin/init
285 fi
286}
287
288make_zimage_symlink_relative () {
289 if [ -L ${IMAGE_ROOTFS}/boot/zImage ]; then
290 (cd ${IMAGE_ROOTFS}/boot/ && for i in `ls zImage-* | sort`; do ln -sf $i zImage; done)
291 fi
292}
293
294python write_image_manifest () {
295 from oe.rootfs import image_list_installed_packages
296 from oe.utils import format_pkg_list
297
298 deploy_dir = d.getVar('IMGDEPLOYDIR')
299 link_name = d.getVar('IMAGE_LINK_NAME')
300 manifest_name = d.getVar('IMAGE_MANIFEST')
301
302 if not manifest_name:
303 return
304
305 pkgs = image_list_installed_packages(d)
306 with open(manifest_name, 'w+') as image_manifest:
307 image_manifest.write(format_pkg_list(pkgs, "ver"))
308
309 if os.path.exists(manifest_name) and link_name:
310 manifest_link = deploy_dir + "/" + link_name + ".manifest"
311 if manifest_link != manifest_name:
312 if os.path.lexists(manifest_link):
313 os.remove(manifest_link)
314 os.symlink(os.path.basename(manifest_name), manifest_link)
315}
316
317# Can be used to create /etc/timestamp during image construction to give a reasonably
318# sane default time setting
319rootfs_update_timestamp () {
320 if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" != "" ]; then
321 # Convert UTC into %4Y%2m%2d%2H%2M%2S
322 sformatted=`date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2S`
323 else
324 sformatted=`date -u +%4Y%2m%2d%2H%2M%2S`
325 fi
326 echo $sformatted > ${IMAGE_ROOTFS}/etc/timestamp
327 bbnote "rootfs_update_timestamp: set /etc/timestamp to $sformatted"
328}
329
330# Prevent X from being started
331rootfs_no_x_startup () {
332 if [ -f ${IMAGE_ROOTFS}/etc/init.d/xserver-nodm ]; then
333 chmod a-x ${IMAGE_ROOTFS}/etc/init.d/xserver-nodm
334 fi
335}
336
337rootfs_trim_schemas () {
338 for schema in ${IMAGE_ROOTFS}/etc/gconf/schemas/*.schemas
339 do
340 # Need this in case no files exist
341 if [ -e $schema ]; then
342 oe-trim-schemas $schema > $schema.new
343 mv $schema.new $schema
344 fi
345 done
346}
347
348rootfs_check_host_user_contaminated () {
349 contaminated="${S}/host-user-contaminated.txt"
350 HOST_USER_UID="$(PSEUDO_UNLOAD=1 id -u)"
351 HOST_USER_GID="$(PSEUDO_UNLOAD=1 id -g)"
352
353 find "${IMAGE_ROOTFS}" -path "${IMAGE_ROOTFS}/home" -prune -o \
354 -user "$HOST_USER_UID" -print -o -group "$HOST_USER_GID" -print >"$contaminated"
355
356 sed -e "s,${IMAGE_ROOTFS},," $contaminated | while read line; do
357 bbwarn "Path in the rootfs is owned by the same user or group as the user running bitbake:" $line `ls -lan ${IMAGE_ROOTFS}/$line`
358 done
359
360 if [ -s "$contaminated" ]; then
361 bbwarn "/etc/passwd:" `cat ${IMAGE_ROOTFS}/etc/passwd`
362 bbwarn "/etc/group:" `cat ${IMAGE_ROOTFS}/etc/group`
363 fi
364}
365
366# Make any absolute links in a sysroot relative
367rootfs_sysroot_relativelinks () {
368 sysroot-relativelinks.py ${SDK_OUTPUT}/${SDKTARGETSYSROOT}
369}
370
371# Generated test data json file
372python write_image_test_data() {
373 from oe.data import export2json
374
375 deploy_dir = d.getVar('IMGDEPLOYDIR')
376 link_name = d.getVar('IMAGE_LINK_NAME')
377 testdata_name = os.path.join(deploy_dir, "%s.testdata.json" % d.getVar('IMAGE_NAME'))
378
379 searchString = "%s/"%(d.getVar("TOPDIR")).replace("//","/")
380 export2json(d, testdata_name, searchString=searchString, replaceString="")
381
382 if os.path.exists(testdata_name) and link_name:
383 testdata_link = os.path.join(deploy_dir, "%s.testdata.json" % link_name)
384 if testdata_link != testdata_name:
385 if os.path.lexists(testdata_link):
386 os.remove(testdata_link)
387 os.symlink(os.path.basename(testdata_name), testdata_link)
388}
389write_image_test_data[vardepsexclude] += "TOPDIR"
390
391# Check for unsatisfied recommendations (RRECOMMENDS)
392python rootfs_log_check_recommends() {
393 log_path = d.expand("${T}/log.do_rootfs")
394 with open(log_path, 'r') as log:
395 for line in log:
396 if 'log_check' in line:
397 continue
398
399 if 'unsatisfied recommendation for' in line:
400 bb.warn('[log_check] %s: %s' % (d.getVar('PN'), line))
401}
402
403# Perform any additional adjustments needed to make rootf binary reproducible
404rootfs_reproducible () {
405 if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" != "" ]; then
406 # Convert UTC into %4Y%2m%2d%2H%2M%2S
407 sformatted=`date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2S`
408 echo $sformatted > ${IMAGE_ROOTFS}/etc/version
409 bbnote "rootfs_reproducible: set /etc/version to $sformatted"
410
411 if [ -d ${IMAGE_ROOTFS}${sysconfdir}/gconf ]; then
412 find ${IMAGE_ROOTFS}${sysconfdir}/gconf -name '%gconf.xml' -print0 | xargs -0r \
413 sed -i -e 's@\bmtime="[0-9][0-9]*"@mtime="'${REPRODUCIBLE_TIMESTAMP_ROOTFS}'"@g'
414 fi
415 fi
416}
417
418# Perform a dumb check for unit existence, not its validity
419python overlayfs_qa_check() {
420 from oe.overlayfs import mountUnitName
421
422 overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT") or {}
423 imagepath = d.getVar("IMAGE_ROOTFS")
424 sysconfdir = d.getVar("sysconfdir")
425 searchpaths = [oe.path.join(imagepath, sysconfdir, "systemd", "system"),
426 oe.path.join(imagepath, d.getVar("systemd_system_unitdir"))]
427 fstabpath = oe.path.join(imagepath, sysconfdir, "fstab")
428
429 if not any(os.path.exists(path) for path in [*searchpaths, fstabpath]):
430 return
431
432 fstabDevices = []
433 if os.path.isfile(fstabpath):
434 with open(fstabpath, 'r') as f:
435 for line in f:
436 if line[0] == '#':
437 continue
438 path = line.split(maxsplit=2)
439 if len(path) > 2:
440 fstabDevices.append(path[1])
441
442 allUnitExist = True;
443 for mountPoint in overlayMountPoints:
444 qaSkip = (d.getVarFlag("OVERLAYFS_QA_SKIP", mountPoint) or "").split()
445 if "mount-configured" in qaSkip:
446 continue
447
448 mountPath = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint)
449 if mountPath in fstabDevices:
450 continue
451
452 mountUnit = mountUnitName(mountPath)
453 if any(os.path.isfile(oe.path.join(dirpath, mountUnit))
454 for dirpath in searchpaths):
455 continue
456
457 bb.warn(f'Mount path {mountPath} not found in fstab and unit '
458 f'{mountUnit} not found in systemd unit directories.')
459 bb.warn(f'Skip this check by setting OVERLAYFS_QA_SKIP[{mountPoint}] = '
460 '"mount-configured"')
461 allUnitExist = False;
462
463 if not allUnitExist:
464 bb.fatal('Not all mount paths and units are installed in the image')
465}
466
467python overlayfs_postprocess() {
468 import shutil
469
470 # install helper script
471 helperScriptName = "overlayfs-create-dirs.sh"
472 helperScriptSource = oe.path.join(d.getVar("COREBASE"), "meta/files", helperScriptName)
473 helperScriptDest = oe.path.join(d.getVar("IMAGE_ROOTFS"), "/usr/sbin/", helperScriptName)
474 shutil.copyfile(helperScriptSource, helperScriptDest)
475 os.chmod(helperScriptDest, 0o755)
476}