summaryrefslogtreecommitdiffstats
path: root/meta/classes/useradd_base.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/useradd_base.bbclass')
-rw-r--r--meta/classes/useradd_base.bbclass18
1 files changed, 14 insertions, 4 deletions
diff --git a/meta/classes/useradd_base.bbclass b/meta/classes/useradd_base.bbclass
index ba87edc57a..551c82c322 100644
--- a/meta/classes/useradd_base.bbclass
+++ b/meta/classes/useradd_base.bbclass
@@ -69,11 +69,21 @@ perform_groupdel () {
69 bbnote "${PN}: Performing groupdel with [$opts]" 69 bbnote "${PN}: Performing groupdel with [$opts]"
70 local groupname=`echo "$opts" | awk '{ print $NF }'` 70 local groupname=`echo "$opts" | awk '{ print $NF }'`
71 local group_exists="`grep "^$groupname:" $rootdir/etc/group || true`" 71 local group_exists="`grep "^$groupname:" $rootdir/etc/group || true`"
72
72 if test "x$group_exists" != "x"; then 73 if test "x$group_exists" != "x"; then
73 eval flock -x $rootdir${sysconfdir} -c \"$PSEUDO groupdel \$opts\" || true 74 local awk_input='BEGIN {FS=":"}; $1=="'$groupname'" { print $3 }'
74 group_exists="`grep "^$groupname:" $rootdir/etc/group || true`" 75 local groupid=`echo "$awk_input" | awk -f- $rootdir/etc/group`
75 if test "x$group_exists" != "x"; then 76 local awk_check_users='BEGIN {FS=":"}; $4=="'$groupid'" {print $1}'
76 bbfatal "${PN}: groupdel command did not succeed." 77 local other_users=`echo "$awk_check_users" | awk -f- $rootdir/etc/passwd`
78
79 if test "x$other_users" = "x"; then
80 eval flock -x $rootdir${sysconfdir} -c \"$PSEUDO groupdel \$opts\" || true
81 group_exists="`grep "^$groupname:" $rootdir/etc/group || true`"
82 if test "x$group_exists" != "x"; then
83 bbfatal "${PN}: groupdel command did not succeed."
84 fi
85 else
86 bbnote "${PN}: '$groupname' is primary group for users '$other_users', not removing it"
77 fi 87 fi
78 else 88 else
79 bbnote "${PN}: group $groupname doesn't exist, not removing it" 89 bbnote "${PN}: group $groupname doesn't exist, not removing it"