source: trunk/debirf/fs/usr/share/debirf/plugins/install-kernel @ 782

Last change on this file since 782 was 782, checked in by jrollins, 5 years ago

debirf: added one line to install-kernel to remove old kernel modules
if they exist.

  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#!/bin/bash -e
2
3# debirf plugin: install-kernel
4# install a kernel package, indicated by the expected environment
5# variables:
6#  DEBIRF_PATH
7#  DEBIRF_ROOT
8#  DEBIRF_KERNEL_PACKAGE
9#
10# The debirf scripts were written by
11# Jameson Rollins <jrollins@fifthhorseman.net>
12# and
13# Daniel Kahn Gillmor <dkg-debian.org@fifthhorseman.net>.
14#
15# They are Copyright 2007, and are all released under the GPL,
16# version 3 or later.
17
18# clear out old modules if they exist, to avoid confusion
19rm -rf "$DEBIRF_ROOT/lib/modules"
20
21# download/copy in kernel package
22if [ -z "$DEBIRF_KERNEL_PACKAGE" ] ; then
23    # otherwise, try to figure out the kernel to install
24    # assume arch of build host
25    KERNEL_ARCH=$(uname -r | tr '-' '\n' | tail -1)
26    debirf_exec apt-get --assume-yes --download-only install linux-image-2.6-"$KERNEL_ARCH"
27else
28    # install kernel deb if given at command line
29    cp "$DEBIRF_KERNEL_PACKAGE" "$DEBIRF_ROOT"/var/cache/apt/archives/
30fi
31
32KNAME=$(basename "$DEBIRF_ROOT"/var/cache/apt/archives/linux-image-2.6.*)
33
34echo "extracting kernel package $KNAME..."
35debirf_exec dpkg --extract /var/cache/apt/archives/"$KNAME" /
36
37# install the module init tools, since they are needed for depmod
38debirf_exec apt-get --assume-yes install module-init-tools
39
40# depmod to create module list
41KERNEL_VERS=$(ls -1 "$DEBIRF_ROOT/lib/modules" | head -n1)
42echo "generating modules.dep..."
43debirf_exec depmod -a "$KERNEL_VERS"
44
45# extract kernel and debian stock initrd:
46mv "$DEBIRF_ROOT"/boot/vmlinu* "$DEBIRF_BUILDD"
47
48# remove kernel symlinks
49if [ -L "$DEBIRF_ROOT"/vmlinuz ] ; then
50    rm "$DEBIRF_BUILDD"/vmlinuz
51fi
Note: See TracBrowser for help on using the repository browser.