]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Retrieve service, rpc and protcol entries via getent in hostonly mode
authorDaniel Molkentin <dmolkentin@suse.com>
Fri, 27 Mar 2020 13:22:37 +0000 (14:22 +0100)
committerDaniel Molkentin <daniel@molkentin.de>
Sat, 14 Nov 2020 18:28:56 +0000 (19:28 +0100)
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

modules.d/95cifs/module-setup.sh
modules.d/95nfs/module-setup.sh

index 81db541c4ab8be7ec855a176a2be10a7603b74d3..826317e4fe46a4138ea76936e3db4a14b4e44a10 100755 (executable)
@@ -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*'
 
index cfe0b965acf7f0bc66e4119cb4a7477b01372258..0a2a7ab34b5600ee8a87d300e73a51326eb8c9a4 100755 (executable)
@@ -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)"