Skip to content

Commit

Permalink
fix: cope with distributions with /usr/etc files
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldh committed May 14, 2021
1 parent 6209ede commit 3ad3b3a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
10 changes: 7 additions & 3 deletions modules.d/95cifs/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ installkernel() {
install() {
local _nsslibs
inst_multiple -o mount.cifs
inst_multiple /etc/services /etc/nsswitch.conf /etc/protocols
inst_multiple -o /etc/services /etc/nsswitch.conf /etc/protocols
inst_multiple -o /usr/etc/services /usr/etc/nsswitch.conf /usr/etc/protocols

inst_libdir_file 'libcap-ng.so*'

_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' "$dracutsysrootdir"/etc/nsswitch.conf \
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
_nsslibs=$(
cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
| sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
)
_nsslibs=${_nsslibs#|}
_nsslibs=${_nsslibs%|}

Expand Down
11 changes: 8 additions & 3 deletions modules.d/95nfs/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ cmdline() {
install() {
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 /etc/idmapd.conf
inst_multiple -o /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols
inst_multiple -o /usr/etc/services /usr/etc/nsswitch.conf /usr/etc/rpc /usr/etc/protocols

if [[ $hostonly_cmdline == "yes" ]]; then
local _netconf
Expand All @@ -94,8 +96,11 @@ install() {

inst_libdir_file 'libnfsidmap_nsswitch.so*' 'libnfsidmap/*.so' 'libnfsidmap*.so*'

_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' "$dracutsysrootdir"/etc/nsswitch.conf \
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
_nsslibs=$(
cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
| sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
)
_nsslibs=${_nsslibs#|}
_nsslibs=${_nsslibs%|}

Expand Down
4 changes: 2 additions & 2 deletions modules.d/95ssh-client/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ install() {
inst_sshenv

_nsslibs=$(
sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \
"$dracutsysrootdir"/etc/nsswitch.conf \
cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
| sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
)
_nsslibs=${_nsslibs#|}
Expand Down

0 comments on commit 3ad3b3a

Please sign in to comment.