File: installkernel

package info (click to toggle)
debianutils 1.13.3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 148 kB
  • ctags: 35
  • sloc: ansic: 588; sh: 312; makefile: 50
file content (46 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# 
# Copyright (C) 1995 - 1998, Ian A. Murdock <imurdock@debian.org>
#
# Install the kernel on a Debian Linux system.
#
# This script is called from /usr/src/linux/arch/i386/boot/install.sh.
# If you install it as /sbin/installkernel, you can do a "make install"
# from a generic kernel source tree, and the image will be installed to
# the proper place for Debian GNU/Linux.

set -e

if [ $# = 4 ] ; then
  img="$2"
  map="$3"
  ver="$1"
  # $(INSTALL_PATH), passed as $4, is ignored--Debian uses /boot.
else
  echo "Usage: installkernel <version> <zImage> <System.map> <directory>"
  exit 1
fi

updatever () {
  if [ -f /boot/$1-$ver ] ; then
    mv /boot/$1-$ver /boot/$1-$ver.old
  fi

  cat $2 > /boot/$1-$ver

  if [ -f /boot/$1 ] ; then
    if [ -L /boot/$1 -a $(ls -l /boot/$1 | awk '{print $11}') \
     = $1-$ver ] ; then
      ln -sf $1-$ver.old /boot/$1.old
    else
      mv /boot/$1 /boot/$1.old
    fi
  fi

  ln -sf $1-$ver /boot/$1
}

updatever vmlinuz $img
updatever System.map $map

mkboot -installkernel