-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlist.sh
executable file
·30 lines (28 loc) · 952 Bytes
/
list.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
#!/usr/bin/env bash
root=$(pwd)
start=${root}/modules
rm -f ${start}/modules.yml
touch ${start}/modules.yml
echo "## List of included modules" >>${start}/modules.yml
for folder in ${start}/*; do
if test -d ${folder}; then
echo "${folder}"
echo "" >> ${start}/modules.yml
path=$(echo ${folder} | rev | cut -d '/' -f-1 | rev)
echo "### ${path}" >>${start}/modules.yml
echo "" >>${start}/modules.yml
# Get list of all modules
for F in $(ls ${folder}/*.ko); do
X=$(basename ${F})
M=$(basename ${F} | sed 's/\.[^.]*$//')
DESC=$(modinfo ${F} | awk -F':' '/description:/{ print $2}' | awk '{sub(/^[ ]+/,""); print}')
[ -z "${DESC}" ] && DESC="${X}"
echo "${M} \"${DESC}\""
echo "* ${M} \"${DESC}\"" >>${start}/modules.yml
done
fi
done
echo "" >> ${start}/modules.yml
date=$(date +'%y.%m.%d')
echo "Update: ${date}" >>${start}/modules.yml
mv -f ${start}/modules.yml ${root}/modules.yml