wok-next annotate 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
rev   line source
al@19595 1 #!/bin/sh
al@19595 2 # gztazmod.sh: Compress Linux Kernel modules for SliTaz GNU/Linux.
al@19595 3 # 2007-2017 <pankso@slitaz.org> - GNU General Public License.
al@19595 4 #
al@19595 5 . /lib/libtaz.sh
al@19595 6
al@19595 7 # We do our work in the Kernel version modules directory.
al@19595 8 if [ -z "$1" ] ; then
al@19595 9 newline
al@19595 10 _ 'Usage: %s path/to/kernel-version' "$(basename $0)"
al@19595 11 newline
al@19595 12 exit 1
al@19595 13 fi
al@19595 14
al@19595 15 if [ ! -r "$1" ] ; then
al@19595 16 newline
al@19595 17 _ 'Error: %s does not exist.' "$1"
al@19595 18 newline
al@19595 19 exit 1
al@19595 20 fi
al@19595 21
al@19595 22 cd $1
al@19595 23
al@19595 24 # Script start.
al@19595 25 newline
al@19595 26 _ 'Starting %s to build compressed Kernel modules...' "$(basename $0)"
al@19595 27 newline
al@19595 28
al@19595 29 # Find all modules.
al@19595 30 action 'Searching all modules to compress them...'
al@19595 31 find . -name '*.ko' -exec xz '{}' \; 2>/dev/null
al@19595 32 status
al@19595 33 find . -name '*.ko' -exec rm '{}' \;
al@19595 34
al@19595 35 # Build a new temporary modules.dep.
al@19595 36 action 'Building tmp.dep...'
al@19595 37 sed 's/\.ko.[xg]z/.ko/g' modules.dep > tmp.dep
al@19595 38 sed -i 's/\.ko.[xg]z/.ko/g' tmp.dep
al@19595 39 sed -i 's/\.ko/.ko.xz/g' tmp.dep
al@19595 40 status
al@19595 41
al@19595 42 # Destroy original modules.dep
al@19595 43 action 'Destroying modules.dep...'
al@19595 44 rm modules.dep
al@19595 45 status
al@19595 46
al@19595 47 # Remove tmp.dep to modules.dep.
al@19595 48 action 'Moving tmp.dep to modules.dep...'
al@19595 49 mv tmp.dep modules.dep
al@19595 50 status
al@19595 51
al@19595 52 # Script end.
al@19595 53 newline
al@19595 54 _ 'Kernel modules %s are ready.' "$(basename $1)"
al@19595 55 newline