From: Daniel Molkentin Date: Fri, 27 Mar 2020 13:22:37 +0000 (+0100) Subject: Retrieve service, rpc and protcol entries via getent in hostonly mode X-Git-Tag: 051~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e0524af2bf83184e18d068bea4356a719d2385c2;p=thirdparty%2Fdracut.git Retrieve service, rpc and protcol entries via getent in hostonly mode Sometimes, systems have more elaborate backends in nsswitch.conf, the complexity of which we do not want in the initrd. SUSE systems with atomic for instance, where those files may also reside in /usr/etc. With this change, the unavaiable nsswitch.conf backends will be silently ignored, and we still end up with all the information we need. Reference: boo#1165366 --- diff --git a/modules.d/95cifs/module-setup.sh b/modules.d/95cifs/module-setup.sh index 81db541c4..826317e4f 100755 --- a/modules.d/95cifs/module-setup.sh +++ b/modules.d/95cifs/module-setup.sh @@ -37,7 +37,13 @@ install() { local _i local _nsslibs inst_multiple -o mount.cifs - inst_multiple /etc/services /etc/nsswitch.conf /etc/protocols + inst_multiple /etc/nsswitch.conf + if [ $hostonly ]; then + getent services > ${initdir}/etc/services + getent protocols > ${initdir}/etc/protocols + else + inst_multiple /etc/services /etc/protocols + fi inst_libdir_file 'libcap-ng.so*' diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh index cfe0b965a..0a2a7ab34 100755 --- a/modules.d/95nfs/module-setup.sh +++ b/modules.d/95nfs/module-setup.sh @@ -77,8 +77,16 @@ cmdline() { install() { local _i local _nsslibs - inst_multiple -o rpc.idmapd mount.nfs mount.nfs4 umount sed /etc/netconfig chmod "$tmpfilesdir/rpcbind.conf" - inst_multiple /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf + inst_multiple -o portmap rpcbind rpc.statd mount.nfs \ + mount.nfs4 umount rpc.idmapd sed /etc/netconfig chmod "$tmpfilesdir/rpcbind.conf" + inst_multiple /etc/nsswitch.conf /etc/idmapd.conf + if [ $hostonly ]; then + getent services > ${initdir}/etc/services + getent protocols > ${initdir}/etc/protocols + getent rpc > ${initdir}/etc/rpc + else + inst_multiple /etc/services /etc/protocols /etc/rpc + fi if [[ $hostonly_cmdline == "yes" ]]; then local _netconf="$(cmdline)"