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