summaryrefslogtreecommitdiffstats
path: root/modules.d/95cifs/module-setup.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:54:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:54:25 +0000
commit9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a (patch)
tree2efb72864cc69e174c9c5ee33efb88a5f1553b48 /modules.d/95cifs/module-setup.sh
parentInitial commit. (diff)
downloaddracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.tar.xz
dracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.zip
Adding upstream version 060+5.upstream/060+5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xmodules.d/95cifs/module-setup.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/modules.d/95cifs/module-setup.sh b/modules.d/95cifs/module-setup.sh
new file mode 100755
index 0000000..6abc475
--- /dev/null
+++ b/modules.d/95cifs/module-setup.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# called by dracut
+check() {
+ # If our prerequisites are not met, fail anyways.
+ require_binaries mount.cifs || return 1
+
+ [[ $hostonly ]] || [[ $mount_needs ]] && {
+ for fs in "${host_fs_types[@]}"; do
+ [[ $fs == "cifs" ]] && return 0
+ done
+ return 255
+ }
+
+ return 0
+}
+
+# called by dracut
+depends() {
+ # We depend on network modules being loaded
+ echo network
+}
+
+# called by dracut
+installkernel() {
+ instmods cifs ipv6
+ # hash algos
+ instmods md4 md5 sha256 sha512
+ # ciphers
+ instmods aes arc4 des ecb gcm aead2
+ # macs
+ instmods hmac cmac ccm
+}
+
+# called by dracut
+install() {
+ local _nsslibs
+ inst_multiple -o mount.cifs
+ 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=$(
+ 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%|}
+
+ inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
+
+ inst_hook cmdline 90 "$moddir/parse-cifsroot.sh"
+ inst "$moddir/cifsroot.sh" "/sbin/cifsroot"
+ inst "$moddir/cifs-lib.sh" "/lib/cifs-lib.sh"
+ dracut_need_initqueue
+}