forked from Sabayon/genkernel-next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_moddeps.sh
executable file
·75 lines (65 loc) · 1.44 KB
/
gen_moddeps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# $Id$
modules_kext()
{
KEXT=".ko"
echo ${KEXT}
}
modules_dep_list()
{
KEXT=$(modules_kext)
if [ -f ${INSTALL_MOD_PATH}/lib/modules/${KV}/modules.dep ]
then
cat ${INSTALL_MOD_PATH}/lib/modules/${KV}/modules.dep | grep ${1}${KEXT}\: | cut -d\: -f2
fi
}
# Pass module deps list
strip_mod_paths()
{
local x
local ret
local myret
for x in ${*}
do
ret=`basename ${x} | cut -d. -f1`
myret="${myret} ${ret}"
done
echo "${myret}"
}
gen_deps()
{
local modlist
local deps
for x in ${*}
do
echo ${x} >> ${TEMP}/moddeps
modlist=`modules_dep_list ${x}`
if [ "${modlist}" != "" -a "${modlist}" != " " ]
then
deps=`strip_mod_paths ${modlist}`
else
deps=""
fi
for y in ${deps}
do
echo ${y} >> ${TEMP}/moddeps
done
done
}
gen_dep_list()
{
if [ "${ALLRAMDISKMODULES}" = "1" ]; then
strip_mod_paths $(find "${INSTALL_MOD_PATH}/lib/modules/${KV}" -name "*$(modules_kext)") | sort
else
local group_modules
rm -f ${TEMP}/moddeps > /dev/null
for group_modules in ${!MODULES_*}; do
gen_deps ${!group_modules}
done
# Only list each module once
if [ -f ${TEMP}/moddeps ]
then
cat ${TEMP}/moddeps | sort | uniq
fi
fi
}