summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/useradd.bbclass36
1 files changed, 34 insertions, 2 deletions
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index 6f2c2dfb86..6ecfa16a5f 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -45,7 +45,23 @@ if test "x$GROUPADD_PARAM" != "x"; then
45 groupname=`echo "$opts" | awk '{ print $NF }'` 45 groupname=`echo "$opts" | awk '{ print $NF }'`
46 group_exists=`grep "^$groupname:" $SYSROOT/etc/group || true` 46 group_exists=`grep "^$groupname:" $SYSROOT/etc/group || true`
47 if test "x$group_exists" = "x"; then 47 if test "x$group_exists" = "x"; then
48 eval $PSEUDO groupadd $OPT $opts 48 count=1
49 while true; do
50 eval $PSEUDO groupadd $OPT $opts || true
51 group_exists=`grep "^$groupname:" $SYSROOT/etc/group || true`
52 if test "x$group_exists" = "x"; then
53 # File locking issues can require us to retry the command
54 echo "WARNING: groupadd command did not succeed. Retrying..."
55 sleep 1
56 else
57 break
58 fi
59 count=`expr $count + 1`
60 if test $count = 11; then
61 echo "ERROR: tried running groupadd command 10 times without success, giving up"
62 exit 1
63 fi
64 done
49 else 65 else
50 echo "Note: group $groupname already exists, not re-creating it" 66 echo "Note: group $groupname already exists, not re-creating it"
51 fi 67 fi
@@ -70,7 +86,23 @@ if test "x$USERADD_PARAM" != "x"; then
70 username=`echo "$opts" | awk '{ print $NF }'` 86 username=`echo "$opts" | awk '{ print $NF }'`
71 user_exists=`grep "^$username:" $SYSROOT/etc/passwd || true` 87 user_exists=`grep "^$username:" $SYSROOT/etc/passwd || true`
72 if test "x$user_exists" = "x"; then 88 if test "x$user_exists" = "x"; then
73 eval $PSEUDO useradd $OPT $opts 89 count=1
90 while true; do
91 eval $PSEUDO useradd $OPT $opts || true
92 user_exists=`grep "^$username:" $SYSROOT/etc/passwd || true`
93 if test "x$user_exists" = "x"; then
94 # File locking issues can require us to retry the command
95 echo "WARNING: useradd command did not succeed. Retrying..."
96 sleep 1
97 else
98 break
99 fi
100 count=`expr $count + 1`
101 if test $count = 11; then
102 echo "ERROR: tried running useradd command 10 times without success, giving up"
103 exit 1
104 fi
105 done
74 else 106 else
75 echo "Note: username $username already exists, not re-creating it" 107 echo "Note: username $username already exists, not re-creating it"
76 fi 108 fi