wok-next view linux/stuff/tools/gztazmod.sh @ rev 21727

created recipe for vbindiff
author Hans-G?nter Theisgen
date Sat Nov 21 14:32:44 2020 +0100 (2020-11-21)
parents
children
line source
1 #!/bin/sh
2 # gztazmod.sh: Compress Linux Kernel modules for SliTaz GNU/Linux.
3 # 2007-2017 <pankso@slitaz.org> - GNU General Public License.
4 #
5 . /lib/libtaz.sh
7 # We do our work in the Kernel version modules directory.
8 if [ -z "$1" ] ; then
9 newline
10 _ 'Usage: %s path/to/kernel-version' "$(basename $0)"
11 newline
12 exit 1
13 fi
15 if [ ! -r "$1" ] ; then
16 newline
17 _ 'Error: %s does not exist.' "$1"
18 newline
19 exit 1
20 fi
22 cd $1
24 # Script start.
25 newline
26 _ 'Starting %s to build compressed Kernel modules...' "$(basename $0)"
27 newline
29 # Find all modules.
30 action 'Searching all modules to compress them...'
31 find . -name '*.ko' -exec xz '{}' \; 2>/dev/null
32 status
33 find . -name '*.ko' -exec rm '{}' \;
35 # Build a new temporary modules.dep.
36 action 'Building tmp.dep...'
37 sed 's/\.ko.[xg]z/.ko/g' modules.dep > tmp.dep
38 sed -i 's/\.ko.[xg]z/.ko/g' tmp.dep
39 sed -i 's/\.ko/.ko.xz/g' tmp.dep
40 status
42 # Destroy original modules.dep
43 action 'Destroying modules.dep...'
44 rm modules.dep
45 status
47 # Remove tmp.dep to modules.dep.
48 action 'Moving tmp.dep to modules.dep...'
49 mv tmp.dep modules.dep
50 status
52 # Script end.
53 newline
54 _ 'Kernel modules %s are ready.' "$(basename $1)"
55 newline