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