From 42b42fd61e2ff1b4e3836a21881c1a39900cf818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 31 May 2021 13:45:35 +0200 Subject: [PATCH] sysusers.generate-pre: indentation rhel-only Resolves: #2217149 --- sysusers.generate-pre.sh | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sysusers.generate-pre.sh b/sysusers.generate-pre.sh index 6c481c3..9441971 100755 --- a/sysusers.generate-pre.sh +++ b/sysusers.generate-pre.sh @@ -12,17 +12,17 @@ user() { home="$5" shell="$6" -[ "$desc" = '-' ] && desc= -[ "$home" = '-' -o "$home" = '' ] && home=/ -[ "$shell" = '-' -o "$shell" = '' ] && shell=/sbin/nologin + [ "$desc" = '-' ] && desc= + [ "$home" = '-' -o "$home" = '' ] && home=/ + [ "$shell" = '-' -o "$shell" = '' ] && shell=/sbin/nologin -if [ "$uid" = '-' -o "$uid" = '' ]; then - cat </dev/null || \\ useradd -r -g '$group' -d '$home' -s '$shell' -c '$desc' '$user' EOF -else - cat </dev/null ; then if ! getent passwd '$uid' >/dev/null ; then useradd -r -u '$uid' -g '$group' -d '$home' -s /sbin/nologin -c '$desc' '$user' @@ -32,21 +32,21 @@ if ! getent passwd '$user' >/dev/null ; then fi EOF -fi + fi } group() { group="$1" gid="$2" -if [ "$gid" = '-' ]; then - cat </dev/null || groupadd -r '$group' -EOF -else - cat </dev/null || groupadd -f -g '$gid' -r '$group' -EOF -fi + if [ "$gid" = '-' ]; then + cat <<-EOF + getent group '$group' >/dev/null || groupadd -r '$group' + EOF + else + cat <<-EOF + getent group '$group' >/dev/null || groupadd -f -g '$gid' -r '$group' + EOF + fi } parse() { @@ -75,5 +75,5 @@ parse() { for fn in "$@"; do [ -e "$fn" ] || continue echo "# generated from $(basename $fn)" - parse < "$fn" + parse <"$fn" done