wok-6.x diff linux-libre/stuff/gztazmod.sh @ rev 10629
libsexymm: fix gdeps
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu May 26 22:40:08 2011 +0200 (2011-05-26) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/linux-libre/stuff/gztazmod.sh Thu May 26 22:40:08 2011 +0200 1.3 @@ -0,0 +1,67 @@ 1.4 +#!/bin/sh 1.5 +# gztazmod.sh: Compress Linux kernel modules for SliTaz GNU/Linux. 1.6 +# 2007/10/04 <pankso@slitaz.org> - GNU General Public License. 1.7 +# 1.8 + 1.9 +# We do our work in the kernel version modules directory. 1.10 +if [ -z "$1" ] ; then 1.11 + echo "" 1.12 + echo -e "\033[1musage:\033[0m `basename $0` path/to/kernel-version" 1.13 + echo "" 1.14 + exit 1 1.15 +fi 1.16 + 1.17 +if [ ! -r "$1" ] ; then 1.18 + echo "" 1.19 + echo -e "Error : $1 does not exist." 1.20 + echo "" 1.21 + exit 1 1.22 +fi 1.23 + 1.24 +cd $1 1.25 + 1.26 +# Status functions. 1.27 +status() 1.28 +{ 1.29 + local CHECK=$? 1.30 + echo -en "\\033[70G[ " 1.31 + if [ $CHECK = 0 ]; then 1.32 + echo -en "\\033[1;33mOK" 1.33 + else 1.34 + echo -en "\\033[1;31mFailed" 1.35 + fi 1.36 + echo -e "\\033[0;39m ]" 1.37 +} 1.38 + 1.39 +# Script start. 1.40 +echo "" 1.41 +echo "Starting gztazmod.sh to build compressed kernel modules... " 1.42 +echo "" 1.43 + 1.44 +# Find all modules. 1.45 +echo -n "Searching all modules to compress them... " 1.46 +find . -name "*.ko" -exec lzma e '{}' '{}'.gz \; 2> /dev/null 1.47 +status 1.48 +find . -name "*.ko" -exec rm '{}' \; 1.49 + 1.50 +# Build a new temporary modules.dep. 1.51 +echo -n "Building tmp.dep... " 1.52 +sed 's/\.ko.gz/.ko/g' modules.dep > tmp.dep 1.53 +sed -i 's/\.ko.gz/.ko/g' tmp.dep 1.54 +sed -i 's/\.ko/.ko.gz/g' tmp.dep 1.55 +status 1.56 + 1.57 +# Destroy original modules.dep 1.58 +echo -n "Destroying modules.dep... " 1.59 +rm modules.dep 1.60 +status 1.61 + 1.62 +# Remove tmp.dep to modules.dep. 1.63 +echo -n "Removing tmp.dep to modules.dep... " 1.64 +mv tmp.dep modules.dep 1.65 +status 1.66 + 1.67 +# Script end. 1.68 +echo "" 1.69 +echo "Kernel modules `basename $1` are ready." 1.70 +echo ""