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