wok-6.x annotate linux/receipt @ rev 15763
Up tazinst-gui (3.92)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Jan 05 22:37:47 2014 +0100 (2014-01-05) |
parents | f4df390821bc |
children | de8cd706512c |
rev | line source |
---|---|
pankso@3 | 1 # SliTaz package receipt. |
pankso@3 | 2 |
pankso@3 | 3 PACKAGE="linux" |
pascal@15670 | 4 VERSION="3.2.53" |
pankso@12812 | 5 KBASEVER="${VERSION:0:3}" |
pankso@3 | 6 CATEGORY="base-system" |
pankso@3 | 7 SHORT_DESC="The Linux kernel and modules." |
pankso@3864 | 8 MAINTAINER="devel@slitaz.org" |
pascal@14657 | 9 LICENSE="GPL2" |
pankso@12812 | 10 TARBALL="$PACKAGE-$KBASEVER.tar.xz" |
pankso@3 | 11 WEB_SITE="http://www.kernel.org/" |
pascal@14234 | 12 WGET_URL="ftp://ftp.kernel.org/pub/linux/kernel/v3.0/$TARBALL" |
pankso@12803 | 13 HOST_ARCH="i486 arm x86_64" |
pankso@12803 | 14 |
pankso@12812 | 15 DEPENDS="kmod" |
pascal@14754 | 16 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch \ |
pascal@14754 | 17 uclibc-cross-compiler-x86_64 busybox-boot" |
pankso@12824 | 18 |
pankso@12824 | 19 # Use version patch so we dont dl full kernel source on each minor update |
pascal@14351 | 20 [ "$KBASEVER" != "$VERSION" ] && |
pascal@14351 | 21 PATCH="$(dirname $WGET_URL)/patch-$VERSION.xz" && |
pascal@14351 | 22 EXTRA_SOURCE_FILES="$(basename $PATCH)" |
pankso@12812 | 23 |
pankso@12803 | 24 # Aufs enable chroot |
pascal@14223 | 25 AUFS_NOT_RAMFS="uclibc-cross-compiler-x86_64 is not compatible with aufs+tmpfs 8(" |
pankso@3 | 26 |
pankso@12824 | 27 # This will save/restore modules.dep but we want to regenerate it on |
pankso@12824 | 28 # install or upgrade. |
pankso@12803 | 29 #CONFIG_FILES="/lib/modules/$KBASEVER-slitaz/modules.dep" |
pankso@12803 | 30 |
pankso@12824 | 31 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM |
pankso@12803 | 32 case "$ARCH" in |
pankso@12824 | 33 arm) BUILD_DEPENDS="xz" TARBALL="$PACKAGE-$VERSION.tar.bz2" ;; |
pankso@12824 | 34 x86_64) BUILD_DEPENDS="xz" ;; |
pankso@12824 | 35 esac |
pankso@12824 | 36 |
pankso@12824 | 37 # TODO: slitaz.conf provide SLITAZ_ARCH and must be handled by tazpkg/spk |
pankso@12824 | 38 [ -f "$root/etc/slitaz/slitaz.conf" ] && . $root/etc/slitaz/slitaz.conf |
pankso@12824 | 39 |
pankso@12824 | 40 # Handle multiarch installation. ARM use Busybox modutils, so avoid any |
pankso@12824 | 41 # deps on kmod |
pankso@12824 | 42 case "$SLITAZ_ARCH" in |
pankso@12824 | 43 arm) DEPENDS="" ;; |
pankso@12803 | 44 esac |
pankso@9731 | 45 |
pankso@3 | 46 # Rules to configure and make the package. |
pankso@3 | 47 compile_rules() |
pankso@3 | 48 { |
pankso@9731 | 49 cd $src |
pascal@14754 | 50 cp /usr/share/boot/initrd initrd.cpio |
pankso@12803 | 51 |
pascal@14179 | 52 if [ "$KBASEVER" != "$VERSION" ]; then |
pascal@14179 | 53 [ -s $SRC/$(basename $PATCH) ] || |
pascal@14234 | 54 wget $PATCH -O $SRC/$(basename $PATCH) |
pascal@14179 | 55 xzcat $SRC/$(basename $PATCH) | patch -Np1 |
pascal@14179 | 56 touch done.patch-$VERSION |
pascal@14179 | 57 fi |
pascal@14179 | 58 |
pankso@12803 | 59 case "$ARCH" in |
pankso@12803 | 60 arm) |
pankso@12803 | 61 echo "Compiling: ARM Kernel" |
pascal@14178 | 62 if [ ! -s $SRC/$(basename $PATCH) ]; then |
pascal@14234 | 63 wget $PATCH -O $SRC/$(basename $PATCH) |
pankso@12812 | 64 fi |
pankso@12824 | 65 make mrproper |
pankso@12824 | 66 # Buggy: we got kernel panic about module not tinted 3.2.14 |
pankso@12824 | 67 #echo "Applying patch: $(basename $PATCH)" |
pankso@12824 | 68 #xzcat $SRC/$(basename $PATCH) | patch -Np1 >/dev/null |
pankso@12824 | 69 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1 |
pankso@12824 | 70 cp -f $stuff/$ARCH/linux-arm.config .config |
pascal@15743 | 71 echo "Configure $ARCH kernel..." |
pascal@15733 | 72 yes '' | make ARCH=$ARCH oldconfig |
pascal@15743 | 73 echo "Build $ARCH kernel..." |
pankso@12803 | 74 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage && |
pankso@12803 | 75 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules && |
pankso@12803 | 76 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \ |
pankso@12803 | 77 INSTALL_MOD_PATH=$DESTDIR modules_install && |
pankso@12803 | 78 mkdir -p $DESTDIR/boot && |
pankso@12824 | 79 cp -a arch/arm/boot/zImage \ |
pankso@12803 | 80 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH |
pankso@12803 | 81 return 0 ;; |
pankso@12803 | 82 x86_64) |
pankso@12803 | 83 echo "TODO: Maybe use default ? But cross compile in x86_64 chroot" |
pankso@12803 | 84 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64" |
pankso@12803 | 85 return 0 ;; |
pankso@12803 | 86 esac |
pankso@12803 | 87 |
gokhlayeh@11395 | 88 [ ! -x /usr/bin/cook ] && report open-bloc |
pankso@9731 | 89 |
pankso@9731 | 90 # Check for Aufs and cook it if unbuilt. |
pankso@9731 | 91 echo "Checking for Aufs packages..." |
pankso@12285 | 92 _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'` |
pankso@12285 | 93 if [ -x /usr/bin/cook ]; then |
gokhlayeh@11395 | 94 # Give info an redirect to /dev/null since aufs got it own log. |
gokhlayeh@11395 | 95 AUFSDIR=$WOK/aufs/source/aufs-${_AUFSVER} |
pankso@12285 | 96 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR |
pankso@12285 | 97 #echo "Cook: aufs $_AUFSVER" |
pankso@12288 | 98 cook aufs --getsrc |
pankso@12288 | 99 mkdir -p $WOK/aufs/source/ |
pankso@12289 | 100 tar xjf $SRC/aufs-${_AUFSVER}.tar.bz2 -C $WOK/aufs/source/ |
pankso@12285 | 101 elif [ -x /usr/bin/tazwok ]; then |
pankso@12285 | 102 # we just need aufs source. Also cooking now is a bad idea since it |
pankso@12285 | 103 # needs linux-module-headers. The one your cooking not the one from the web. |
gokhlayeh@11395 | 104 AUFSDIR=$WOK/aufs/aufs-${_AUFSVER} |
gokhlayeh@11395 | 105 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR |
gokhlayeh@11395 | 106 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; } |
pankso@9731 | 107 fi |
pankso@12285 | 108 echo "cook:linux" > $command |
pankso@12285 | 109 |
pankso@9731 | 110 echo "Copying Aufs files and patches..." |
slaxemulator@7297 | 111 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src |
pankso@12285 | 112 cp -a $AUFSDIR/aufs3-*.patch $stuff |
pankso@12285 | 113 |
pankso@4251 | 114 # SliTaz db |
pankso@12285 | 115 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz 2> /dev/null |
pankso@12285 | 116 mkdir -p $WOK/$PACKAGE/source/slitaz |
pankso@12290 | 117 echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url |
pankso@12285 | 118 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz |
pankso@12285 | 119 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz |
pankso@12803 | 120 |
pankso@5640 | 121 # Apply patches |
pankso@9731 | 122 echo "Applying patches..." |
pascal@521 | 123 while read patch_file; do |
pankso@12285 | 124 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches |
pankso@12285 | 125 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz |
pascal@1442 | 126 if [ -f done.$patch_file ]; then |
pascal@1442 | 127 echo "Skipping $patch_file" |
pascal@1442 | 128 continue |
pascal@1442 | 129 fi |
pascal@521 | 130 echo "Apply $patch_file" |
pankso@12285 | 131 if [ -x /usr/bin/cook ]; then |
pankso@12285 | 132 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1 |
pankso@12285 | 133 elif [ -x /usr/bin/tazwok ]; then |
pankso@12285 | 134 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || { report close-bloc; return 1; } |
pankso@12285 | 135 fi |
pascal@1442 | 136 touch done.$patch_file |
pascal@521 | 137 done <<EOT |
pankso@12285 | 138 $PACKAGE-diff.u |
pankso@12285 | 139 $PACKAGE-header.u |
pankso@12285 | 140 $PACKAGE-freeinitrd.u |
pascal@14759 | 141 $PACKAGE-subroot.u |
pascal@15675 | 142 $PACKAGE-CVE-2013-2929.u |
pankso@12285 | 143 aufs3-base.patch |
pankso@12285 | 144 aufs3-standalone.patch |
pankso@12285 | 145 aufs3-loopback.patch |
mojo@15707 | 146 aufs3-mmap.patch |
pankso@12285 | 147 channel-negative-one-maxim.patch |
pankso@12285 | 148 mac80211.compat08082009.wl_frag+ack_v1.patch |
pascal@521 | 149 EOT |
pankso@9731 | 150 |
pankso@12285 | 151 sed -i 's|SUBLEVEL =.*|SUBLEVEL =|g' Makefile |
pankso@12285 | 152 |
gokhlayeh@11395 | 153 [ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest" |
pankso@12294 | 154 [ -x /usr/bin/cook ] && echo "Make kernel proper and then build lguest" |
pankso@3864 | 155 make mrproper |
pankso@12285 | 156 cd Documentation/virtual/lguest |
pankso@12285 | 157 if [ -x /usr/bin/cook ]; then |
pankso@12285 | 158 make lguest || return 1 |
pankso@12285 | 159 elif [ -x /usr/bin/tazwok ]; then |
pankso@12285 | 160 make lguest || { report close-bloc; return 1; } |
pankso@12285 | 161 fi |
slaxemulator@8681 | 162 cd $src |
pankso@12803 | 163 |
pascal@12570 | 164 case "$opt" in |
pascal@12570 | 165 *--no64*);; |
pascal@12570 | 166 *) |
pankso@12294 | 167 # |
pankso@12294 | 168 # Arch x86_64 |
pankso@12294 | 169 # |
pankso@12294 | 170 [ ! -x /usr/bin/cook ] && report step "Make bzImage64 without modules first" |
pankso@12294 | 171 [ -x /usr/bin/cook ] && echo "Building x86_64 Kernel" |
pankso@12803 | 172 |
pankso@12285 | 173 # Build bzImage64 without modules first |
pascal@12293 | 174 cp -f $stuff/$PACKAGE-slitaz.config64 .config |
pankso@12285 | 175 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config |
pankso@12803 | 176 |
pankso@12803 | 177 # We can't keep every driver in staging |
pankso@12285 | 178 sed -i -e 's/^CONFIG_RTL8192/#&/' \ |
pankso@12285 | 179 -e 's/^CONFIG_R8187SE/#&/' \ |
pankso@12285 | 180 -e 's/^CONFIG_RT2870/#&/' .config |
pascal@15743 | 181 echo "Configure bzImage64 without modules..." |
pankso@12285 | 182 yes '' | make ARCH=x86_64 oldconfig |
pascal@15743 | 183 echo "Build bzImage64 without modules..." |
pankso@12285 | 184 if [ -x /usr/bin/cook ]; then |
pankso@12285 | 185 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1 |
pankso@12285 | 186 elif [ -x /usr/bin/tazwok ]; then |
pankso@12285 | 187 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || { report close-bloc; return 1; } |
pankso@12285 | 188 fi |
pascal@15602 | 189 [ -d $DESTDIR ] || mkdir -p $DESTDIR/linux64 |
pankso@12285 | 190 mv arch/x86/boot/bzImage $DESTDIR/linux64 |
pankso@12285 | 191 mv System.map System.map-without-modules64 |
pankso@12285 | 192 |
pankso@12285 | 193 [ ! -x /usr/bin/cook ] && report step "Now build bzImage64 with modules" |
pankso@12803 | 194 |
pankso@12285 | 195 # Build bzImage64 with modules |
pascal@12293 | 196 cp -f $stuff/$PACKAGE-slitaz.config64 .config |
pascal@15743 | 197 echo "Configure bzImage64 with modules..." |
pascal@15733 | 198 yes '' | make ARCH=x86_64 oldconfig |
pascal@15743 | 199 echo "Build bzImage64 with modules..." |
pankso@12285 | 200 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage && |
pankso@12285 | 201 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules && |
pankso@12285 | 202 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install && |
pankso@12285 | 203 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install && |
pascal@14180 | 204 ln .config $WOK/$PACKAGE/source/slitaz/config64 |
pankso@12285 | 205 if [ -x /usr/bin/cook ]; then |
pankso@12285 | 206 [ -s arch/x86/boot/bzImage ] || return 1 |
pankso@12285 | 207 elif [ -x /usr/bin/tazwok ]; then |
pankso@12285 | 208 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; } |
pankso@12285 | 209 fi |
pankso@12285 | 210 mkdir -p $DESTDIR/linux64/boot 2> /dev/null |
pankso@12285 | 211 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz |
pankso@12285 | 212 ln System.map System.map-modules64 |
pankso@12285 | 213 ln Module.symvers Module.symvers-modules64 |
pascal@12570 | 214 esac |
pankso@12803 | 215 |
pankso@12294 | 216 # |
pankso@12294 | 217 # Standard kernel |
pankso@12294 | 218 # |
pankso@12294 | 219 [ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first" |
pankso@12294 | 220 [ -x /usr/bin/cook ] && echo "Building standard kernel..." |
pankso@12803 | 221 |
pankso@12294 | 222 # Build bzImage without modules first |
pankso@12294 | 223 cp -f $stuff/$PACKAGE-slitaz.config .config |
pankso@12294 | 224 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config |
pankso@12803 | 225 |
pankso@12803 | 226 # We can't keep every driver in staging |
pankso@12294 | 227 sed -i -e 's/^CONFIG_RTL8192/#&/' \ |
pankso@12294 | 228 -e 's/^CONFIG_R8187SE/#&/' \ |
pankso@12294 | 229 -e 's/^CONFIG_RT2870/#&/' .config |
pascal@15743 | 230 echo "Configure bzImage without modules..." |
pascal@15670 | 231 yes '' | make ARCH=i386 oldconfig |
pascal@15743 | 232 echo "Build bzImage without modules..." |
pankso@12294 | 233 if [ -x /usr/bin/cook ]; then |
pascal@15670 | 234 make ARCH=i386 -j 4 bzImage || exit 1 |
pankso@12294 | 235 elif [ -x /usr/bin/tazwok ]; then |
pascal@15670 | 236 make ARCH=i386 -j 4 bzImage || { report close-bloc; return 1; } |
pankso@12294 | 237 fi |
pankso@12294 | 238 [ -d $DESTDIR ] || mkdir -p $DESTDIR |
pankso@12294 | 239 mv arch/x86/boot/bzImage $DESTDIR |
pankso@12294 | 240 mv System.map System.map-without-modules |
pankso@12294 | 241 |
pankso@12294 | 242 [ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules" |
pankso@12803 | 243 |
pankso@12294 | 244 # Build bzImage with modules |
pankso@12294 | 245 cp -f $stuff/$PACKAGE-slitaz.config .config |
pascal@15743 | 246 echo "Configure bzImage with modules..." |
pascal@15733 | 247 yes '' | make ARCH=i386 oldconfig |
pankso@12294 | 248 ln .config $WOK/$PACKAGE/source/slitaz/config |
pascal@15743 | 249 echo "Build bzImage with modules..." |
pascal@15670 | 250 make ARCH=i386 -j 4 bzImage && |
pascal@15670 | 251 make ARCH=i386 -j 4 modules && |
pascal@15670 | 252 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install && |
pascal@15670 | 253 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install && |
pankso@12294 | 254 if [ -x /usr/bin/cook ]; then |
pankso@12294 | 255 [ -s arch/x86/boot/bzImage ] || return 1 |
pankso@12294 | 256 elif [ -x /usr/bin/tazwok ]; then |
pankso@12294 | 257 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; } |
pankso@12294 | 258 fi |
pankso@12294 | 259 mkdir -p $DESTDIR/boot 2> /dev/null |
pankso@12294 | 260 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz |
pankso@12803 | 261 |
gokhlayeh@11395 | 262 [ ! -x /usr/bin/cook ] && report step "Compressing all modules" |
pankso@12803 | 263 |
slaxemulator@6719 | 264 # Compress all modules. |
pankso@12285 | 265 $stuff/gztazmod.sh $DESTDIR/lib/modules/$KBASEVER-slitaz |
pankso@12285 | 266 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$KBASEVER-slitaz |
pascal@7667 | 267 ln System.map System.map-modules |
pascal@7667 | 268 ln Module.symvers Module.symvers-modules |
pankso@12803 | 269 |
gokhlayeh@11395 | 270 if [ ! -x /usr/bin/cook ]; then |
gokhlayeh@11395 | 271 report close-bloc |
gokhlayeh@11395 | 272 fi |
pankso@3864 | 273 } |
erjo@253 | 274 |
pankso@3 | 275 # Rules to gen a SliTaz package suitable for Tazpkg. |
pankso@3 | 276 genpkg_rules() |
pankso@3 | 277 { |
pankso@12803 | 278 case "$ARCH" in |
pankso@12803 | 279 arm) |
pankso@12803 | 280 echo "Packing: ARM Kernel" |
pankso@12803 | 281 cp -a $install/* $fs |
pankso@12803 | 282 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source |
pankso@12803 | 283 return 0 ;; |
pankso@12803 | 284 x86_64) |
pankso@12803 | 285 echo "TODO: use default or custom x86_64 packing" |
pankso@12803 | 286 return 0 ;; |
pankso@12803 | 287 esac |
pankso@12803 | 288 |
pascal@12300 | 289 export PACKAGE VERSION |
pascal@521 | 290 local path |
pascal@15603 | 291 cp -a $install/boot $fs |
pankso@3 | 292 # Compress all modules. |
pankso@12285 | 293 path=$fs/lib/modules/$KBASEVER-slitaz/kernel |
pascal@521 | 294 mkdir -p $path |
pascal@15603 | 295 cp -a $install/lib/modules/$KBASEVER-slitaz/mo* \ |
pankso@12285 | 296 $fs/lib/modules/$KBASEVER-slitaz |
pascal@14003 | 297 [ "$KBASEVER" != "$VERSION" ] && |
pascal@14003 | 298 ln -s $KBASEVER-slitaz $fs/lib/modules/$VERSION-slitaz |
pankso@5640 | 299 # Get the base modules |
pascal@886 | 300 export src |
pascal@886 | 301 export _pkg |
pankso@12285 | 302 mkdir -p $WOK/$PACKAGE/source/tmp |
pascal@13577 | 303 # Warning stuff/list_modules.sh must find the generated modules.list |
slaxemulator@9701 | 304 $stuff/list_modules.sh \ |
pankso@12285 | 305 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list |
pankso@3864 | 306 while read module; do |
pascal@521 | 307 dir=$(dirname $module) |
pankso@535 | 308 [ -d $path/$dir ] || mkdir -p $path/$dir |
pascal@15603 | 309 cp -a $install/lib/modules/$KBASEVER-slitaz/kernel/$module $path/$dir |
pankso@12285 | 310 done < $WOK/$PACKAGE/source/tmp/modules.list |
pascal@397 | 311 # Remove unresolved links |
pankso@12285 | 312 rm -f $fs/lib/modules/$KBASEVER-slitaz/build |
pankso@12285 | 313 rm -f $fs/lib/modules/$KBASEVER-slitaz/source |
pankso@12285 | 314 # Cook all packages with a kernel module |
pascal@13937 | 315 for i in $(cd $WOK; grep -l 'cook linux$' */receipt) |
pankso@12285 | 316 do |
pascal@13937 | 317 echo cook ${i%/receipt} |
pankso@12285 | 318 done |
pankso@12285 | 319 # Fixed modules.dep to use right path |
pankso@12285 | 320 # saves 100kb of space too |
pankso@12285 | 321 sed -i "s|$_pkg||g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep |
pankso@12285 | 322 sed -i "s|99.98.$KBASEVER-slitaz|$KBASEVER-slitaz|g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep |
pankso@12803 | 323 # Check and echo any module in kernel .config that's not added to |
pankso@5640 | 324 # one of linux-* pkgs |
pankso@12803 | 325 $stuff/check_modules.sh |
pankso@3 | 326 } |
pankso@3 | 327 |
pankso@3 | 328 # Pre and post install commands for Tazpkg. |
pankso@3 | 329 post_install() |
pankso@3 | 330 { |
pascal@521 | 331 echo "Processing post-install commands..." |
pankso@12803 | 332 case "$ARCH" in |
pankso@12803 | 333 arm) |
pankso@12803 | 334 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH" |
pankso@12803 | 335 echo "Modules: /lib/modules/$VERSION-slitaz" |
pankso@12803 | 336 return 0 ;; |
pankso@12803 | 337 esac |
pankso@12285 | 338 chroot "$1/" depmod -a $KBASEVER-slitaz |
pankso@5640 | 339 # GRUB stuff. |
pankso@1154 | 340 if [ -f "$1/boot/grub/menu.lst" ]; then |
border@13797 | 341 root_dev="/dev/`lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*'`" # current root device |
border@13797 | 342 grub_part="$(( `echo $root_dev | grep -o '[0-9]*$'`-1 ))" |
border@13797 | 343 grub_dev="`grep $(echo $root_dev | grep -o '^/dev/.d.' ) $1/boot/grub/device.map |\ |
border@13797 | 344 cut -f1 | sed "s/)$/.$grub_part)/g"`" # use device.map to find grub device number |
border@13797 | 345 |
border@13797 | 346 # Add and clean kernel entrys in case of upgrade for installed system. |
border@13797 | 347 if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then |
border@13797 | 348 |
border@13797 | 349 #clean the old entry |
border@13797 | 350 # TODO somewhere, the old vmlinuz file is removed. |
border@13797 | 351 # but the entry is still there. this cause a grub error:15 when selected |
border@13797 | 352 # see http://bugs.slitaz.org/?id=74 |
border@13797 | 353 |
border@13797 | 354 #add the new |
border@13797 | 355 cat >> $1/boot/grub/menu.lst << EOT |
pankso@4056 | 356 |
pankso@4056 | 357 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
border@13754 | 358 $grub_dev |
border@13754 | 359 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet |
pankso@4056 | 360 EOT |
border@13754 | 361 # Make it the default entry |
border@13754 | 362 last_entry=$(( $(grep -c '^title' $1/boot/grub/menu.lst)-1 )) |
border@13754 | 363 sed -e "s/^default.*/default $last_entry/g" -i $1/boot/grub/menu.lst |
pankso@4056 | 364 fi |
pankso@4056 | 365 # Display information message. |
border@13754 | 366 cat <<EOT |
pankso@4056 | 367 ---- |
pankso@4056 | 368 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst: |
pankso@1154 | 369 |
pankso@1154 | 370 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
pankso@1154 | 371 $grub_dev |
pankso@4056 | 372 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev |
pascal@886 | 373 ---- |
pascal@886 | 374 EOT |
pankso@1154 | 375 fi |
pankso@3 | 376 } |