summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/image.bbclass21
1 files changed, 21 insertions, 0 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 832c7384c6..34e9f4cba5 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -215,6 +215,27 @@ read_only_rootfs_hook () {
215 fi 215 fi
216 fi 216 fi
217 fi 217 fi
218
219 if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
220 # Update user database files so that services don't fail for a read-only systemd system
221 for conffile in ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd.conf ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd-remote.conf; do
222 [ -e $conffile ] || continue
223 grep -v "^#" $conffile | sed -e '/^$/d' | while read type name id comment; do
224 if [ "$type" = "u" ]; then
225 useradd_params=""
226 [ "$id" != "-" ] && useradd_params="$useradd_params --uid $id"
227 [ "$comment" != "-" ] && useradd_params="$useradd_params --comment $comment"
228 useradd_params="$useradd_params --system $name"
229 eval useradd --root ${IMAGE_ROOTFS} $useradd_params || true
230 elif [ "$type" = "g" ]; then
231 groupadd_params=""
232 [ "$id" != "-" ] && groupadd_params="$groupadd_params --gid $id"
233 groupadd_params="$groupadd_params --system $name"
234 eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true
235 fi
236 done
237 done
238 fi
218} 239}
219 240
220PACKAGE_EXCLUDE ??= "" 241PACKAGE_EXCLUDE ??= ""