wok-current view linux64/receipt @ rev 15078

grub: fix genpkg_rules
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Aug 13 17:02:48 2013 +0000 (2013-08-13)
parents 416fab3c90c0
children 051931e905b0
line source
1 # SliTaz package receipt.
3 PACKAGE="linux64"
4 VERSION="3.2.40"
5 KBASEVER="${VERSION:0:3}"
6 CATEGORY="base-system"
7 SHORT_DESC="The Linux 64 bits kernel and modules."
8 MAINTAINER="devel@slitaz.org"
9 LICENSE="GPL2"
10 WEB_SITE="http://www.kernel.org/"
11 WANTED="linux"
12 PROVIDE="linux"
13 CONFIG_FILES="/lib/modules/$KBASEVER-slitaz/modules.dep"
15 DEPENDS="depmod"
17 # Rules to gen a SliTaz package suitable for Tazpkg.
18 genpkg_rules()
19 {
20 local path
21 _pkg=$_pkg/linux64
22 cp -a $_pkg/boot $fs
23 path=$fs/lib/modules/$KBASEVER-slitaz/kernel
24 mkdir -p $path
25 cp -a $_pkg/lib/modules/$KBASEVER-slitaz/mo* \
26 $fs/lib/modules/$KBASEVER-slitaz
27 [ "$KBASEVER" != "$VERSION" ] &&
28 ln -s $KBASEVER-slitaz $fs/lib/modules/$VERSION-slitaz
29 # Get the base modules
30 export src
31 export _pkg
32 mkdir -p $WOK/$PACKAGE/source/tmp
33 $wanted_stuff/list_modules.sh \
34 $(cat $stuff/modules64.list) > $WOK/$PACKAGE/source/tmp/modules.list
35 while read module; do
36 dir=$(dirname $module)
37 [ -d $path/$dir ] || mkdir -p $path/$dir
38 cp -a $_pkg/lib/modules/$KBASEVER-slitaz/kernel/$module $path/$dir
39 done < $WOK/$PACKAGE/source/tmp/modules.list
40 # Remove unresolved links
41 rm -f $fs/lib/modules/$KBASEVER-slitaz/build
42 rm -f $fs/lib/modules/$KBASEVER-slitaz/source
43 # Cook all packages with a kernel module
44 for i in $(cd $WOK; grep -l 'cook linux$' */receipt)
45 do
46 echo cook ${i%/receipt}
47 done
48 # Fixed modules.dep to use right path
49 # saves 100kb of space too
50 sed -i "s|$_pkg||g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
51 sed -i "s|99.98.$KBASEVER-slitaz|$KBASEVER-slitaz|g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
52 # Check and echo any module in kernel .config that's not added to
53 # one of linux-* pkgs
54 $wanted_stuff/check_modules.sh 2>&1 | grep -v files.list
55 }
57 # Pre and post install commands for Tazpkg.
58 post_install()
59 {
60 echo "Processing post-install commands..."
61 chroot "$1/" depmod -a $KBASEVER-slitaz
62 # GRUB stuff.
63 if [ -f "$1/boot/grub/menu.lst" ]; then
64 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
65 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
66 # Add new kernel entry in case of upgrade for installed system.
67 if ! grep -q $PACKAGE-$VERSION-slitaz $1/boot/grub/menu.lst; then
68 cat >> $1/boot/grub/menu.lst << EOT
70 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
71 $grub_dev
72 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
73 EOT
74 fi
75 # Display information message.
76 cat <<EOT
77 ----
78 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
80 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
81 $grub_dev
82 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
83 ----
84 EOT
85 fi
86 }