]> git.ipfire.org Git - thirdparty/dracut.git/blame - modules.d/50plymouth/module-setup.sh
modules are now only handled with /sys/modules and modules.dep
[thirdparty/dracut.git] / modules.d / 50plymouth / module-setup.sh
CommitLineData
95d2dabc
HH
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
5check() {
1b7fd0fa 6 [[ "$mount_needs" ]] && return 1
95d2dabc
HH
7 [[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
8}
9
10depends() {
11 return 0
12}
13
14installkernel() {
29b10e65 15 local _modname
95d2dabc 16 # Include KMS capable drm drivers
fe1484f3
HH
17
18 drm_module_filter() {
19 local _drm_drivers='drm_crtc_init'
20 local _ret
21 # subfunctions inherit following FDs
22 local _merge=8 _side2=9
23 function nmf1() {
24 local _fname _fcont
25 while read _fname; do
26 case "$_fname" in
27 *.ko) _fcont="$(< $_fname)" ;;
28 *.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
29 *.ko.xz) _fcont="$(xz -dc $_fname)" ;;
30 esac
31 [[ $_fcont =~ $_drm_drivers
32 && ! $_fcont =~ iw_handler_get_spy ]] \
33 && echo "$_fname"
34 done
35 }
36 function rotor() {
37 local _f1 _f2
38 while read _f1; do
39 echo "$_f1"
40 if read _f2; then
41 echo "$_f2" 1>&${_side2}
42 fi
43 done | nmf1 1>&${_merge}
44 }
45 # Use two parallel streams to filter alternating modules.
46 set +x
47 eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
48 _ret=$?
49 [[ $debug ]] && set -x
50 return $_ret
51 }
52
53 for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
54 | drm_module_filter) ; do
55 # if the hardware is present, include module even if it is not currently loaded,
56 # as we could e.g. be in the installer; nokmsboot boot parameter will disable
57 # loading of the driver if needed
58 if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
59 | grep -qxf - /sys/bus/pci/devices/*/modalias; then
60 hostonly='' instmods $_modname
61 continue
5fae9d9a 62 fi
fe1484f3 63 instmods $_modname
95d2dabc
HH
64 done
65}
66
67install() {
68 if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
69 || ! grep -q PLYMOUTH_POPULATE_SOURCE_FUNCTIONS /usr/libexec/plymouth/plymouth-populate-initrd \
70 || [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
552ecca6 71 . "$moddir"/plymouth-populate-initrd.sh
95d2dabc
HH
72 else
73 PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
74 /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
75 fi
76
77 inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
78 inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
79 inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
80 inst readlink
81}
82