From 55864fc88f76d5588a09f5bbf7e08f5d5ecbb355e4e3a994171a15f40bdbf1e1 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Wed, 7 Aug 2024 10:02:57 +0000 Subject: [PATCH] Accepting request 1192184 from openSUSE:Factory https://bugzilla.opensuse.org/show_bug.cgi?id=1228944 OBS-URL: https://build.opensuse.org/request/show/1192184 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sysuser-tools?expand=0&rev=29 --- sysuser-tools.changes | 6 ------ sysusers2shadow.sh | 19 ++++++++----------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/sysuser-tools.changes b/sysuser-tools.changes index 5df4ccc..e576b9a 100644 --- a/sysuser-tools.changes +++ b/sysuser-tools.changes @@ -1,9 +1,3 @@ -------------------------------------------------------------------- -Mon Aug 5 14:25:14 UTC 2024 - Thorsten Kukuk - -- Implement UID:GID support for busybox -- Reenable UID:GID support - ------------------------------------------------------------------- Sat Aug 3 06:09:03 UTC 2024 - Thorsten Kukuk diff --git a/sysusers2shadow.sh b/sysusers2shadow.sh index 0a1a69f..ee7a5fd 100644 --- a/sysusers2shadow.sh +++ b/sysusers2shadow.sh @@ -52,11 +52,12 @@ else continue fi - # Split user and Group id. Must work with busybox sh. - case $2 in - (*:*) USER_ID=${2%:*} GROUP_ID=${2##*:};; - (*) USER_ID=$2 GROUP_ID="";; - esac + # Split user and Group id + #userGrouArr=(${2//:/ }) + #USER_ID=${userGrouArr[0]} + #GROUP_ID=${userGrouArr[1]} + USER_ID=$2 + GROUP_ID="" if [ -n "$USER_ID" ] && [ "$USER_ID" != "-" ]; then ARGUMENTS="-u $USER_ID $ARGUMENTS" @@ -88,13 +89,9 @@ else run /usr/sbin/useradd -r -c "$3" -d "${homedir}" $ARGUMENTS 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" run $busybox adduser -S -H -g "$3" -G "$1" -h "${homedir}" $ARGUMENTS - fi else echo "ERROR: neither useradd nor busybox found!" exit 1 @@ -103,9 +100,9 @@ else m) shift if [ -x /usr/sbin/usermod ] ; then - run /usr/sbin/usermod -a -G "$USER_ID" "$1" + run /usr/sbin/usermod -a -G "$2" "$1" elif [ -x "$busybox" ]; then - run $busybox addgroup "$1" "$USER_ID" + run $busybox addgroup "$1" "$2" else echo "ERROR: neither usermod nor busybox found!" exit 1