Adjust scriptlets to modify /etc/authselect/user-nsswitch.conf
With input from Pavel Březina.
The guard in install scriptlet was borked. The grep call was supposed
to skip the sed call if the file already had correct contents. But the
condition was always true. Added by me in back in 37de5dfe28
;(
This commit is contained in:
parent
8bc4ef61e5
commit
4ba08126b1
30
systemd.spec
30
systemd.spec
@ -529,20 +529,33 @@ fi
|
|||||||
%post libs
|
%post libs
|
||||||
%{?ldconfig}
|
%{?ldconfig}
|
||||||
|
|
||||||
if [ -f /etc/nsswitch.conf ] ; then
|
function mod_nss() {
|
||||||
# sed-fu to add myhostanme to hosts line
|
if [ -f "$1" ] ; then
|
||||||
grep -v -E -q '^hosts:.* myhostname' /etc/nsswitch.conf &&
|
# sed-fu to add myhostname to hosts line
|
||||||
|
grep -E -q '^hosts:.* myhostname' "$1" ||
|
||||||
sed -i.bak -e '
|
sed -i.bak -e '
|
||||||
/^hosts:/ !b
|
/^hosts:/ !b
|
||||||
/\<myhostname\>/ b
|
/\<myhostname\>/ b
|
||||||
s/[[:blank:]]*$/ myhostname/
|
s/[[:blank:]]*$/ myhostname/
|
||||||
' /etc/nsswitch.conf &>/dev/null || :
|
' "$1" &>/dev/null || :
|
||||||
|
|
||||||
# Add nss-systemd to passwd and group
|
# Add nss-systemd to passwd and group
|
||||||
grep -E -q '^(passwd|group):.* systemd' /etc/nsswitch.conf ||
|
grep -E -q '^(passwd|group):.* systemd' "$1" ||
|
||||||
sed -i.bak -r -e '
|
sed -i.bak -r -e '
|
||||||
s/^(passwd|group):(.*)/\1: \2 systemd/
|
s/^(passwd|group):(.*)/\1: \2 systemd/
|
||||||
' /etc/nsswitch.conf &>/dev/null || :
|
' "$1" &>/dev/null || :
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE="$(readlink /etc/nsswitch.conf || echo /etc/nsswitch.conf)"
|
||||||
|
if [ "$FILE" = "/etc/authselect/nsswitch.conf" ]; then
|
||||||
|
mod_nss "/etc/authselect/user-nsswitch.conf"
|
||||||
|
authselect apply-changes &> /dev/null || :
|
||||||
|
else
|
||||||
|
mod_nss "$FILE"
|
||||||
|
# also apply the same changes to user-nsswitch.conf to affect
|
||||||
|
# possible future authselect configuration
|
||||||
|
mod_nss "/etc/authselect/user-nsswitch.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if nobody or nfsnobody is defined
|
# check if nobody or nfsnobody is defined
|
||||||
@ -662,6 +675,11 @@ fi
|
|||||||
%files tests -f .file-list-tests
|
%files tests -f .file-list-tests
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 29 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
||||||
|
- Adjust scriptlets to modify /etc/authselect/user-nsswitch.conf
|
||||||
|
(see https://github.com/pbrezina/authselect/issues/77)
|
||||||
|
- Drop old scriptlets for nsswitch.conf modifications for nss-mymachines and nss-resolve
|
||||||
|
|
||||||
* Sun Nov 18 2018 Alejandro Domínguez Muñoz <adomu@net-c.com> - 239-10.git9f3aed1
|
* Sun Nov 18 2018 Alejandro Domínguez Muñoz <adomu@net-c.com> - 239-10.git9f3aed1
|
||||||
- Remove link creation for rsyslog.service
|
- Remove link creation for rsyslog.service
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user