[TG3]: Add tagged status support.
[linux-2.6/verdex.git] / scripts / package / builddeb
blobc279b6310f02f11bc88c0d2d0c7f10c94b690764
1 #!/bin/sh
3 # builddeb 1.2
4 # Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
6 # Simple script to generate a deb package for a Linux kernel. All the
7 # complexity of what to do with a kernel after it is installer or removed
8 # is left to other scripts and packages: they can install scripts in the
9 # /etc/kernel/{pre,post}{inst,rm}.d/ directories that will be called on
10 # package install and removal.
12 set -e
14 # Some variables and settings used throughout the script
15 version=$KERNELRELEASE
16 tmpdir="$objtree/debian/tmp"
18 # Setup the directory structure
19 rm -rf "$tmpdir"
20 mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
22 # Build and install the kernel
23 cp System.map "$tmpdir/boot/System.map-$version"
24 cp .config "$tmpdir/boot/config-$version"
25 cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version"
27 if grep -q '^CONFIG_MODULES=y' .config ; then
28 INSTALL_MOD_PATH="$tmpdir" make modules_install
31 # Install the maintainer scripts
32 for script in postinst postrm preinst prerm ; do
33 mkdir -p "$tmpdir/etc/kernel/$script.d"
34 cat <<EOF > "$tmpdir/DEBIAN/$script"
35 #!/bin/sh
37 set -e
39 test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d
40 exit 0
41 EOF
42 chmod 755 "$tmpdir/DEBIAN/$script"
43 done
45 name="Kernel Compiler <$(id -nu)@$(hostname -f)>"
46 # Generate a simple changelog template
47 cat <<EOF > debian/changelog
48 linux ($version) unstable; urgency=low
50 * A standard release
52 -- $name $(date -R)
53 EOF
55 # Generate a control file
56 cat <<EOF > debian/control
57 Source: linux
58 Section: base
59 Priority: optional
60 Maintainer: $name
61 Standards-Version: 3.6.1
63 Package: linux-$version
64 Architecture: any
65 Description: Linux kernel, version $version
66 This package contains the Linux kernel, modules and corresponding other
67 files version $version.
68 EOF
70 # Fix some ownership and permissions
71 chown -R root:root "$tmpdir"
72 chmod -R go-w "$tmpdir"
74 # Perform the final magic
75 dpkg-gencontrol -isp
76 dpkg --build "$tmpdir" ..
78 exit 0