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

Up: gftp 2.0.19
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Fri Dec 05 15:05:12 2008 +0100 (2008-12-05)
parents 33e1267e176f
children bae9fa77b9be
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 \;
44 status
46 # Build a new temporary modules.dep.
47 echo -n "Building tmp.dep... "
48 sed 's/\.ko/.ko.gz/g' modules.dep > tmp.dep
49 status
51 # Destroy original modules.dep
52 echo -n "Destroying modules.dep... "
53 rm modules.dep
54 status
56 # Remove tmp.dep to modules.dep.
57 echo -n "Removing tmp.dep to modules.dep... "
58 mv tmp.dep modules.dep
59 status
61 # Script end.
62 echo ""
63 echo "Kernel modules `basename $1` are ready."
64 echo ""