summaryrefslogtreecommitdiff
path: root/meta-phosphor/classes/phosphor-rootfs-postcommands.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta-phosphor/classes/phosphor-rootfs-postcommands.bbclass')
-rw-r--r--meta-phosphor/classes/phosphor-rootfs-postcommands.bbclass10
1 files changed, 10 insertions, 0 deletions
diff --git a/meta-phosphor/classes/phosphor-rootfs-postcommands.bbclass b/meta-phosphor/classes/phosphor-rootfs-postcommands.bbclass
new file mode 100644
index 000000000..3485661b3
--- /dev/null
+++ b/meta-phosphor/classes/phosphor-rootfs-postcommands.bbclass
@@ -0,0 +1,10 @@
+#
+# This function is intended to add root to corresponding groups if 'debug-tweaks' or 'allow-root-login' is in IMAGE_FEATURES.
+#
+update_root_user_groups () {
+ if [ -e ${IMAGE_ROOTFS}/etc/group ]; then
+ sed -i '/^\(ipmi\|web\|redfish\|priv-admin\):.*:.*:$/s/$/root/' ${IMAGE_ROOTFS}/etc/group
+ fi
+}
+# Add root user to the needed groups
+ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], "update_root_user_groups; ", "", d)}'