mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
useradd.bbclass: Strip trailing ';' in cmd params
When there are more than 1 packages in a recipe requiring useradd services, they are concatnated and a ';' is inserted just after each of the users being added by the packages. A situation arises in cases where this is controlled by PACKAGECONFIG then we add a ';' separator in the USERADD_PARAM value itself for each packagecofig since we do not know which one will be picked, we end up in situation where the final string returned from get_all_cmd_params() appears to be a; ; b; c; and then the logic which uses these cmds triggers with ';' as separator but in this case it will fail after executing useradd 'a' because the next cmd it will call will be just a whitespace This is highlighted by the systemd patch to add more users as needed by systemd 229 components. (From OE-Core rev: e8d4356c38e3c2aacd6dc49231c73bcb7d597308) (From OE-Core rev: 4f69a4be79e17ef009351c447694e46b5cb517c2) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -54,14 +54,14 @@ if test "x`echo $GROUPADD_PARAM | tr -d '[:space:]'`" != "x"; then
|
|||||||
echo "Running groupadd commands..."
|
echo "Running groupadd commands..."
|
||||||
# Invoke multiple instances of groupadd for parameter lists
|
# Invoke multiple instances of groupadd for parameter lists
|
||||||
# separated by ';'
|
# separated by ';'
|
||||||
opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1`
|
opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
|
||||||
remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2-`
|
remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2-`
|
||||||
while test "x$opts" != "x"; do
|
while test "x$opts" != "x"; do
|
||||||
perform_groupadd "$SYSROOT" "$OPT $opts"
|
perform_groupadd "$SYSROOT" "$OPT $opts"
|
||||||
if test "x$opts" = "x$remaining"; then
|
if test "x$opts" = "x$remaining"; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
opts=`echo "$remaining" | cut -d ';' -f 1`
|
opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
|
||||||
remaining=`echo "$remaining" | cut -d ';' -f 2-`
|
remaining=`echo "$remaining" | cut -d ';' -f 2-`
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@@ -70,14 +70,14 @@ if test "x`echo $USERADD_PARAM | tr -d '[:space:]'`" != "x"; then
|
|||||||
echo "Running useradd commands..."
|
echo "Running useradd commands..."
|
||||||
# Invoke multiple instances of useradd for parameter lists
|
# Invoke multiple instances of useradd for parameter lists
|
||||||
# separated by ';'
|
# separated by ';'
|
||||||
opts=`echo "$USERADD_PARAM" | cut -d ';' -f 1`
|
opts=`echo "$USERADD_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
|
||||||
remaining=`echo "$USERADD_PARAM" | cut -d ';' -f 2-`
|
remaining=`echo "$USERADD_PARAM" | cut -d ';' -f 2-`
|
||||||
while test "x$opts" != "x"; do
|
while test "x$opts" != "x"; do
|
||||||
perform_useradd "$SYSROOT" "$OPT $opts"
|
perform_useradd "$SYSROOT" "$OPT $opts"
|
||||||
if test "x$opts" = "x$remaining"; then
|
if test "x$opts" = "x$remaining"; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
opts=`echo "$remaining" | cut -d ';' -f 1`
|
opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
|
||||||
remaining=`echo "$remaining" | cut -d ';' -f 2-`
|
remaining=`echo "$remaining" | cut -d ';' -f 2-`
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@@ -86,14 +86,14 @@ if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then
|
|||||||
echo "Running groupmems commands..."
|
echo "Running groupmems commands..."
|
||||||
# Invoke multiple instances of groupmems for parameter lists
|
# Invoke multiple instances of groupmems for parameter lists
|
||||||
# separated by ';'
|
# separated by ';'
|
||||||
opts=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 1`
|
opts=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
|
||||||
remaining=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 2-`
|
remaining=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 2-`
|
||||||
while test "x$opts" != "x"; do
|
while test "x$opts" != "x"; do
|
||||||
perform_groupmems "$SYSROOT" "$OPT $opts"
|
perform_groupmems "$SYSROOT" "$OPT $opts"
|
||||||
if test "x$opts" = "x$remaining"; then
|
if test "x$opts" = "x$remaining"; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
opts=`echo "$remaining" | cut -d ';' -f 1`
|
opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
|
||||||
remaining=`echo "$remaining" | cut -d ';' -f 2-`
|
remaining=`echo "$remaining" | cut -d ';' -f 2-`
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@@ -203,7 +203,7 @@ def get_all_cmd_params(d, cmd_type):
|
|||||||
for pkg in useradd_packages.split():
|
for pkg in useradd_packages.split():
|
||||||
param = d.getVar(param_type % pkg, True)
|
param = d.getVar(param_type % pkg, True)
|
||||||
if param:
|
if param:
|
||||||
params.append(param)
|
params.append(param.rstrip(" ;"))
|
||||||
|
|
||||||
return "; ".join(params)
|
return "; ".join(params)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user