]> git.ipfire.org Git - thirdparty/dracut.git/blob - modules.d/95cifs/module-setup.sh
make host_fs_types a hashmap
[thirdparty/dracut.git] / modules.d / 95cifs / module-setup.sh
1 #!/bin/bash
2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
4
5 check() {
6 # If our prerequisites are not met, fail anyways.
7 type -P mount.cifs >/dev/null || return 1
8
9 [[ $hostonly ]] || [[ $mount_needs ]] && {
10 for fs in ${host_fs_types[@]}; do
11 [[ "$fs" == "cifs" ]] && return 0
12 done
13 return 255
14 }
15
16 return 0
17 }
18
19 depends() {
20 # We depend on network modules being loaded
21 echo network
22 }
23
24 installkernel() {
25 instmods cifs ipv6
26 }
27
28 install() {
29 local _i
30 local _nsslibs
31 dracut_install -o mount.cifs
32 dracut_install /etc/services /etc/nsswitch.conf /etc/protocols
33
34 inst_libdir_file 'libcap-ng.so*'
35
36 _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
37 | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
38 _nsslibs=${_nsslibs#|}
39 _nsslibs=${_nsslibs%|}
40
41 inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
42
43 inst_hook cmdline 90 "$moddir/parse-cifsroot.sh"
44 inst "$moddir/cifsroot.sh" "/sbin/cifsroot"
45 inst "$moddir/cifs-lib.sh" "/lib/cifs-lib.sh"
46 dracut_need_initqueue
47 }