#4 Update %posttrans scriptlet to handle resolve before files too
Closed 2 years ago by zbyszek. Opened 3 years ago by zbyszek.
rpms/ zbyszek/nss-mdns nss-resolve-scriptlet  into  rawhide

file modified
+6 -4
@@ -44,10 +44,12 @@ 

  function mod_nss() {

      if [ -f "$1" ] ; then

          # sed-fu to add mdns4_minimal to the hosts line of /etc/nsswitch.conf

-         sed -i.bak '

-                 /^hosts:/ !b

-             /\<mdns\(4\|6\)\?\(_minimal\)\?\>/ b

-             s/\<files\([[:blank:]]\+\)/files\1mdns4_minimal [NOTFOUND=return] /g

+         sed -r -i.bak '

+             /^hosts:/ !b

+             /\<mdns(4|6)?(_minimal)?\>/ b

+             s/\<resolve \[!UNAVAIL=return\] files\s+/files mdns4_minimal [NOTFOUND=return] resolve /

+             s/\<files resolve \[!UNAVAIL=return\]\s+/files mdns4_minimal [NOTFOUND=return] resolve /

+             s/(^hosts:\s+)files dns/\1files mdns4_minimal [NOTFOUND=return] dns/

              ' "$1"

      fi

  }

After https://github.com/authselect/authselect/pull/222 is merged, the line
will be like:
hosts: resolve [!UNAVAIL=return] files myhostname ...
And with nss-mdns active, we want this to change this to:
hosts: files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] myhostname ...

And currently, with systemd installed we have:
hosts: files resolve [!UNAVAIL=return] myhostname ...

And if systemd is not installed and we have the glibc default:
hosts: files dns myhostname

This adjust the scriptlet to handle all three cases separately to always
put mdns4_minimal right after files.

Sorry I missed this earlier. Do you still need it or is it obsolete now?

I've forgotten about this too ;) Let's drop it for now, #5 makes this obsolete.

Pull-Request has been closed by zbyszek

2 years ago