Supress errors from useradd/groupadd

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-05-25 14:18:17 +02:00
parent b68903c0ee
commit a65bd010dd
2 changed files with 10 additions and 7 deletions

View File

@ -1018,6 +1018,9 @@ fi
%files standalone-sysusers -f .file-list-standalone-sysusers %files standalone-sysusers -f .file-list-standalone-sysusers
%changelog %changelog
* Wed May 25 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 251.1-2
- Supress errors from useradd/groupadd (#2090129)
* Tue May 24 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 251.1-1 * Tue May 24 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 251.1-1
- First bugfix release for 250 - First bugfix release for 250
- Two fixes for kernel-install and a revert for #2087225, #2088788. - Two fixes for kernel-install and a revert for #2087225, #2088788.

View File

@ -19,15 +19,15 @@ user() {
if [ "$uid" = '-' ] || [ "$uid" = '' ]; then if [ "$uid" = '-' ] || [ "$uid" = '' ]; then
cat <<EOF cat <<EOF
getent passwd '$user' >/dev/null || \\ getent passwd '$user' >/dev/null || \\
useradd -r -g '$group' -d '$home' -s '$shell' -c '$desc' '$user' useradd -r -g '$group' -d '$home' -s '$shell' -c '$desc' '$user' || :
EOF EOF
else else
cat <<EOF cat <<EOF
if ! getent passwd '$user' >/dev/null ; then if ! getent passwd '$user' >/dev/null; then
if ! getent passwd '$uid' >/dev/null ; then if ! getent passwd '$uid' >/dev/null; then
useradd -r -u '$uid' -g '$group' -d '$home' -s /sbin/nologin -c '$desc' '$user' useradd -r -u '$uid' -g '$group' -d '$home' -s /sbin/nologin -c '$desc' '$user' || :
else else
useradd -r -g '$group' -d '$home' -s /sbin/nologin -c '$desc' '$user' useradd -r -g '$group' -d '$home' -s /sbin/nologin -c '$desc' '$user' || :
fi fi
fi fi
@ -40,11 +40,11 @@ group() {
gid="$2" gid="$2"
if [ "$gid" = '-' ]; then if [ "$gid" = '-' ]; then
cat <<-EOF cat <<-EOF
getent group '$group' >/dev/null || groupadd -r '$group' getent group '$group' >/dev/null || groupadd -r '$group' || :
EOF EOF
else else
cat <<-EOF cat <<-EOF
getent group '$group' >/dev/null || groupadd -f -g '$gid' -r '$group' getent group '$group' >/dev/null || groupadd -f -g '$gid' -r '$group' || :
EOF EOF
fi fi
} }