Accepting request 1191724 from home:kukuk:cleanup

- Implement UID:GID support for busybox
- Reenable UID:GID support

OBS-URL: https://build.opensuse.org/request/show/1191724
OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=59
This commit is contained in:
Thorsten Kukuk 2024-08-05 14:38:15 +00:00 committed by Git OBS Bridge
parent 008c2cc775
commit 02b62a69dd
2 changed files with 17 additions and 8 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Aug 5 14:25:14 UTC 2024 - Thorsten Kukuk <kukuk@suse.com>
- Implement UID:GID support for busybox
- Reenable UID:GID support
------------------------------------------------------------------- -------------------------------------------------------------------
Sat Aug 3 06:09:03 UTC 2024 - Thorsten Kukuk <kukuk@suse.com> Sat Aug 3 06:09:03 UTC 2024 - Thorsten Kukuk <kukuk@suse.com>

View File

@ -52,12 +52,11 @@ else
continue continue
fi fi
# Split user and Group id # Split user and Group id. Must work with busybox sh.
#userGrouArr=(${2//:/ }) case $2 in
#USER_ID=${userGrouArr[0]} (*:*) USER_ID=${2%:*} GROUP_ID=${2##*:};;
#GROUP_ID=${userGrouArr[1]} (*) USER_ID=$2 GROUP_ID="";;
USER_ID=$2 esac
GROUP_ID=""
if [ -n "$USER_ID" ] && [ "$USER_ID" != "-" ]; then if [ -n "$USER_ID" ] && [ "$USER_ID" != "-" ]; then
ARGUMENTS="-u $USER_ID $ARGUMENTS" ARGUMENTS="-u $USER_ID $ARGUMENTS"
@ -89,9 +88,13 @@ else
run /usr/sbin/useradd -r -c "$3" -d "${homedir}" $ARGUMENTS run /usr/sbin/useradd -r -c "$3" -d "${homedir}" $ARGUMENTS
elif [ -x "$busybox" ]; then elif [ -x "$busybox" ]; then
if [ -n "$GROUP_ID" ] && [ "$GROUP_ID" != "-" ]; then
run $busybox adduser -S -H -g "$3" -G "GROUP_ID" -h "${homedir}" $ARGUMENTS
else
/usr/bin/getent group "$1" >> /dev/null || $busybox addgroup -S "$1" /usr/bin/getent group "$1" >> /dev/null || $busybox addgroup -S "$1"
run $busybox adduser -S -H -g "$3" -G "$1" -h "${homedir}" $ARGUMENTS run $busybox adduser -S -H -g "$3" -G "$1" -h "${homedir}" $ARGUMENTS
fi
else else
echo "ERROR: neither useradd nor busybox found!" echo "ERROR: neither useradd nor busybox found!"
exit 1 exit 1
@ -100,9 +103,9 @@ else
m) m)
shift shift
if [ -x /usr/sbin/usermod ] ; then if [ -x /usr/sbin/usermod ] ; then
run /usr/sbin/usermod -a -G "$2" "$1" run /usr/sbin/usermod -a -G "$USER_ID" "$1"
elif [ -x "$busybox" ]; then elif [ -x "$busybox" ]; then
run $busybox addgroup "$1" "$2" run $busybox addgroup "$1" "$USER_ID"
else else
echo "ERROR: neither usermod nor busybox found!" echo "ERROR: neither usermod nor busybox found!"
exit 1 exit 1