wok-next diff linux/stuff/tools/gztazmod.sh @ rev 21727

created recipe for vbindiff
author Hans-G?nter Theisgen
date Sat Nov 21 14:32:44 2020 +0100 (2020-11-21)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linux/stuff/tools/gztazmod.sh	Sat Nov 21 14:32:44 2020 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +#!/bin/sh
     1.5 +# gztazmod.sh: Compress Linux Kernel modules for SliTaz GNU/Linux.
     1.6 +# 2007-2017 <pankso@slitaz.org> - GNU General Public License.
     1.7 +#
     1.8 +. /lib/libtaz.sh
     1.9 +
    1.10 +# We do our work in the Kernel version modules directory.
    1.11 +if [ -z "$1" ] ; then
    1.12 +	newline
    1.13 +	_ 'Usage: %s path/to/kernel-version' "$(basename $0)"
    1.14 +	newline
    1.15 +	exit 1
    1.16 +fi
    1.17 +
    1.18 +if [ ! -r "$1" ] ; then
    1.19 +	newline
    1.20 +	_ 'Error: %s does not exist.' "$1"
    1.21 +	newline
    1.22 +	exit 1
    1.23 +fi
    1.24 +
    1.25 +cd $1
    1.26 +
    1.27 +# Script start.
    1.28 +newline
    1.29 +_ 'Starting %s to build compressed Kernel modules...' "$(basename $0)"
    1.30 +newline
    1.31 +
    1.32 +# Find all modules.
    1.33 +action 'Searching all modules to compress them...'
    1.34 +find . -name '*.ko' -exec xz '{}' \; 2>/dev/null
    1.35 +status
    1.36 +find . -name '*.ko' -exec rm '{}' \;
    1.37 +
    1.38 +# Build a new temporary modules.dep.
    1.39 +action 'Building tmp.dep...'
    1.40 +sed    's/\.ko.[xg]z/.ko/g' modules.dep > tmp.dep
    1.41 +sed -i 's/\.ko.[xg]z/.ko/g' tmp.dep
    1.42 +sed -i 's/\.ko/.ko.xz/g'    tmp.dep
    1.43 +status
    1.44 +
    1.45 +# Destroy original modules.dep
    1.46 +action 'Destroying modules.dep...'
    1.47 +rm modules.dep
    1.48 +status
    1.49 +
    1.50 +# Remove tmp.dep to modules.dep.
    1.51 +action 'Moving tmp.dep to modules.dep...'
    1.52 +mv tmp.dep modules.dep
    1.53 +status
    1.54 +
    1.55 +# Script end.
    1.56 +newline
    1.57 +_ 'Kernel modules %s are ready.' "$(basename $1)"
    1.58 +newline