wok view linux/stuff/gztazmod.sh @ rev 19942

memtest: shrink unpack.S
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 06 08:25:09 2017 +0200 (2017-05-06)
parents 873a0ed5aab7
children
line source
1 #!/bin/sh
2 # gztazmod.sh: Compress Linux kernel modules for SliTaz GNU/Linux.
3 # 2007-2014 <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 echo "Usage: $(basename $0) path/to/kernel-version"
11 newline && exit 1
12 fi
14 if [ ! -r "$1" ] ; then
15 newline
16 echo -e "Error : $1 does not exist."
17 newline && exit 1
18 fi
20 cd $1
22 # Script start.
23 newline
24 echo "Starting gztazmod.sh to build compressed kernel modules... "
25 newline
27 # Find all modules.
28 echo -n "Searching all modules to compress them... "
29 find . -name "*.ko" -exec xz '{}' \; 2> /dev/null
30 status
31 find . -name "*.ko" -exec rm '{}' \;
33 # Build a new temporary modules.dep.
34 echo -n "Building tmp.dep... "
35 sed 's/\.ko.[xg]z/.ko/g' modules.dep > tmp.dep
36 sed -i 's/\.ko.[xg]z/.ko/g' tmp.dep
37 sed -i 's/\.ko/.ko.xz/g' tmp.dep
38 status
40 # Destroy original modules.dep
41 echo -n "Destroying modules.dep... "
42 rm modules.dep
43 status
45 # Remove tmp.dep to modules.dep.
46 echo -n "Removing tmp.dep to modules.dep... "
47 mv tmp.dep modules.dep
48 status
50 # Script end.
51 newline
52 echo "Kernel modules `basename $1` are ready."
53 newline