sysusers.generate-pre: indentation

rhel-only

Resolves: #2217149
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-05-31 13:45:35 +02:00 committed by Christian Glombek
parent 36f2f948cd
commit 42b42fd61e

View File

@ -12,17 +12,17 @@ user() {
home="$5" home="$5"
shell="$6" shell="$6"
[ "$desc" = '-' ] && desc= [ "$desc" = '-' ] && desc=
[ "$home" = '-' -o "$home" = '' ] && home=/ [ "$home" = '-' -o "$home" = '' ] && home=/
[ "$shell" = '-' -o "$shell" = '' ] && shell=/sbin/nologin [ "$shell" = '-' -o "$shell" = '' ] && shell=/sbin/nologin
if [ "$uid" = '-' -o "$uid" = '' ]; then if [ "$uid" = '-' -o "$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'
@ -32,21 +32,21 @@ if ! getent passwd '$user' >/dev/null ; then
fi fi
EOF EOF
fi fi
} }
group() { group() {
group="$1" group="$1"
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
} }
parse() { parse() {
@ -75,5 +75,5 @@ parse() {
for fn in "$@"; do for fn in "$@"; do
[ -e "$fn" ] || continue [ -e "$fn" ] || continue
echo "# generated from $(basename $fn)" echo "# generated from $(basename $fn)"
parse < "$fn" parse <"$fn"
done done