Skip to content

Commit

Permalink
ON-16155: Standardise onload_tool on useradd
Browse files Browse the repository at this point in the history
Debian `adduser` perl script now wraps common shadow utils
`useradd`, so just call it directly for consistent
group option handling.
  • Loading branch information
pcolledg-amd committed Nov 5, 2024
1 parent 8786dba commit 2cb643b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions scripts/onload_tool
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,10 @@ cmd_set_cplane_user() {
systemd-sysusers onload.conf
else
getent group "$ONLOAD_CPLANE_USER" >/dev/null || groupadd -r "$ONLOAD_CPLANE_USER"
getent passwd "$ONLOAD_CPLANE_USER" >/dev/null && exit 0

# We do not require this home directory to exist
if command -v adduser; then
try adduser --system --no-create-home --home /run/openonload --group "$ONLOAD_CPLANE_USER" \
--shell /usr/sbin/nologin "$ONLOAD_CPLANE_USER" >/dev/null
elif command -v useradd; then
try useradd --system --home /run/openonload --group "$ONLOAD_CPLANE_USER" \
getent passwd "$ONLOAD_CPLANE_USER" >/dev/null || \
try useradd --system --home /run/openonload --gid "$ONLOAD_CPLANE_USER" \
--shell /usr/sbin/nologin "$ONLOAD_CPLANE_USER" >/dev/null
else
fail "ERROR: Shadow utils not found. The user $ONLOAD_CPLANE_USER needs adding manually."
fi
exit 0
fi
}
Expand Down

0 comments on commit 2cb643b

Please sign in to comment.