wok-next view linux/stuff/tools/check_modules.sh @ rev 21463

stardict: added mysql dependencies
author Hans-G?nter Theisgen
date Tue May 12 08:14:16 2020 +0100 (2020-05-12)
parents
children
line source
1 #!/bin/sh
2 # Print Linux Kernel modules that do not belong to any of the packages.
3 # (c) 2009-2017 SliTaz - GNU General Public License.
4 #
6 . /lib/libtaz.sh
8 WOK=$(cd $(dirname $0) && pwd | sed 's/wok.*/wok/')
9 . $WOK/linux/receipt
10 BASEVER="${VERSION:0:3}"
11 src="$WOK/linux/source/linux-$VERSION"
13 cd $src
14 tmp=$WOK/${PACKAGE:-linux}/tmp
15 mkdir -p $tmp
16 rm -f $tmp/*
18 #===============================================================================
20 # Make temporal base modules list
22 kversion="$VERSION-slitaz"
23 modroot="$WOK/$PACKAGE/install/lib/modules/$kversion/kernel"
24 modlist="$tmp/modules.list"
26 list_modules() {
27 found="$(find $modroot/$1 -type f)"
28 if [ -z "$found" ]; then
29 echo -e "\n\nError: $modroot/$1 does not exist.\n\n" >&2
30 exit 1
31 fi
33 for module in $(echo "$found" | sed "s|.*$kversion/||"); do
34 grep $module: "$modroot/../modules.dep"
35 done | sed 's|^kernel/||; s| kernel/| |g; s|:||' | \
36 tr ' ' $'\n' | sort -u
37 }
39 while read rule_name rule_value; do
40 [ "$rule_name" != 'linux' ] && continue
41 list_modules $rule_value >> "$modlist"
42 done < "$WOK/linux/stuff/split.rules"
44 #===============================================================================
46 echo
47 title 'Checking for Linux Kernel modules that do not belong to any of the packages'
49 # create a packaged modules list
50 {
51 cat "$modlist"
53 for i in $SPLIT; do
54 cat $WOK/$i/taz/$i-*/files.list | sed 's|.*/kernel/||'
55 done
56 } | grep '.ko.xz$' > $tmp/modules-packaged
58 # create a compiled modules list
59 sed 's|^kernel/||; s|$|.xz|' \
60 $WOK/linux/install/lib/modules/$VERSION-slitaz/modules.order > $tmp/modules-compiled
62 # compare the lists
63 awk '{
64 if (FILENAME ~ "compiled")
65 m[$0] = 1;
66 else
67 delete m[$0];
68 }
69 END {
70 for (i in m) print i;
71 }' $tmp/modules-compiled $tmp/modules-packaged | tee $tmp/modules-unpackaged
73 if [ -s $tmp/modules-unpackaged ]; then
74 footer "List saved to wok/linux/tmp/modules-unpackaged"
75 else
76 _ 'All modules are packaged'
77 echo
78 rm $tmp/modules-unpackaged
79 fi
81 # Clean
82 rm "$modlist"