wok-next view linux-libre/stuff/gztazmod.sh @ rev 9857

obconf: fix BUILD_DEPENDS (again)
author Christophe Lincoln <pankso@slitaz.org>
date Mon May 16 15:34:53 2011 +0200 (2011-05-16)
parents
children
line source
1 #!/bin/sh
2 # gztazmod.sh: Compress Linux kernel modules for SliTaz GNU/Linux.
3 # 2007/10/04 <pankso@slitaz.org> - GNU General Public License.
4 #
6 # We do our work in the kernel version modules directory.
7 if [ -z "$1" ] ; then
8 echo ""
9 echo -e "\033[1musage:\033[0m `basename $0` path/to/kernel-version"
10 echo ""
11 exit 1
12 fi
14 if [ ! -r "$1" ] ; then
15 echo ""
16 echo -e "Error : $1 does not exist."
17 echo ""
18 exit 1
19 fi
21 cd $1
23 # Status functions.
24 status()
25 {
26 local CHECK=$?
27 echo -en "\\033[70G[ "
28 if [ $CHECK = 0 ]; then
29 echo -en "\\033[1;33mOK"
30 else
31 echo -en "\\033[1;31mFailed"
32 fi
33 echo -e "\\033[0;39m ]"
34 }
36 # Script start.
37 echo ""
38 echo "Starting gztazmod.sh to build compressed kernel modules... "
39 echo ""
41 # Find all modules.
42 echo -n "Searching all modules to compress them... "
43 find . -name "*.ko" -exec lzma e '{}' '{}'.gz \; 2> /dev/null
44 status
45 find . -name "*.ko" -exec rm '{}' \;
47 # Build a new temporary modules.dep.
48 echo -n "Building tmp.dep... "
49 sed 's/\.ko.gz/.ko/g' modules.dep > tmp.dep
50 sed -i 's/\.ko.gz/.ko/g' tmp.dep
51 sed -i 's/\.ko/.ko.gz/g' tmp.dep
52 status
54 # Destroy original modules.dep
55 echo -n "Destroying modules.dep... "
56 rm modules.dep
57 status
59 # Remove tmp.dep to modules.dep.
60 echo -n "Removing tmp.dep to modules.dep... "
61 mv tmp.dep modules.dep
62 status
64 # Script end.
65 echo ""
66 echo "Kernel modules `basename $1` are ready."
67 echo ""