spec: prevent 'myhostname' from being appended on upgrade
Without that patch, on every package upgrade, a 'myhostname' is forcibly appended to hosts in nsswitch.conf which is not desirable for some customers. It is required until authselect change introduction in RHEL. RHEL-only Resolves: #2187761
This commit is contained in:
parent
a0e2ca72a7
commit
b27d491859
20
systemd.spec
20
systemd.spec
@ -1497,32 +1497,32 @@ fi
|
|||||||
%{?ldconfig}
|
%{?ldconfig}
|
||||||
|
|
||||||
function mod_nss() {
|
function mod_nss() {
|
||||||
if [ -f "$1" ] ; then
|
if [ $1 -eq 1 ] && [ -f "$2" ]; then
|
||||||
# sed-fu to add myhostname to hosts line
|
# sed-fu to add myhostname to hosts line (only once, on install)
|
||||||
grep -E -q '^hosts:.* myhostname' "$1" ||
|
grep -E -q '^hosts:.* myhostname' "$2" ||
|
||||||
sed -i.bak -e '
|
sed -i.bak -e '
|
||||||
/^hosts:/ !b
|
/^hosts:/ !b
|
||||||
/\<myhostname\>/ b
|
/\<myhostname\>/ b
|
||||||
s/[[:blank:]]*$/ myhostname/
|
s/[[:blank:]]*$/ myhostname/
|
||||||
' "$1" &>/dev/null || :
|
' "$2" &>/dev/null || :
|
||||||
|
|
||||||
# Add nss-systemd to passwd and group
|
# Add nss-systemd to passwd and group (only once, on install)
|
||||||
grep -E -q '^(passwd|group):.* systemd' "$1" ||
|
grep -E -q '^(passwd|group):.* systemd' "$2" ||
|
||||||
sed -i.bak -r -e '
|
sed -i.bak -r -e '
|
||||||
s/^(passwd|group):(.*)/\1: \2 systemd/
|
s/^(passwd|group):(.*)/\1: \2 systemd/
|
||||||
' "$1" &>/dev/null || :
|
' "$2" &>/dev/null || :
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE="$(readlink /etc/nsswitch.conf || echo /etc/nsswitch.conf)"
|
FILE="$(readlink /etc/nsswitch.conf || echo /etc/nsswitch.conf)"
|
||||||
if [ "$FILE" = "/etc/authselect/nsswitch.conf" ] && authselect check &>/dev/null; then
|
if [ "$FILE" = "/etc/authselect/nsswitch.conf" ] && authselect check &>/dev/null; then
|
||||||
mod_nss "/etc/authselect/user-nsswitch.conf"
|
mod_nss $1 "/etc/authselect/user-nsswitch.conf"
|
||||||
authselect apply-changes &> /dev/null || :
|
authselect apply-changes &> /dev/null || :
|
||||||
else
|
else
|
||||||
mod_nss "$FILE"
|
mod_nss $1 "$FILE"
|
||||||
# also apply the same changes to user-nsswitch.conf to affect
|
# also apply the same changes to user-nsswitch.conf to affect
|
||||||
# possible future authselect configuration
|
# possible future authselect configuration
|
||||||
mod_nss "/etc/authselect/user-nsswitch.conf"
|
mod_nss $1 "/etc/authselect/user-nsswitch.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if nobody or nfsnobody is defined
|
# check if nobody or nfsnobody is defined
|
||||||
|
Loading…
Reference in New Issue
Block a user