diff options
author | maximilian attems <maks@debian.org> | 2006-02-27 01:16:09 +0100 |
---|---|---|
committer | maximilian attems <maks@debian.org> | 2006-02-27 01:16:09 +0100 |
commit | 833ebf13b59f2cc2e9af15f2df3727f4e09bec41 (patch) | |
tree | 9566bc333b6c051aa7097136f154c0bc901312ac | |
parent | b32ee94abe4682241d1b00f430858c5f1ac5d955 (diff) | |
download | initramfs-tools-833ebf13b59f2cc2e9af15f2df3727f4e09bec41.tar.gz initramfs-tools-833ebf13b59f2cc2e9af15f2df3727f4e09bec41.zip |
readd the kpkg compat wrapper
-rw-r--r-- | mkinitramfs-kpkg | 94 | ||||
-rw-r--r-- | mkinitramfs-kpkg.8 | 49 |
2 files changed, 143 insertions, 0 deletions
diff --git a/mkinitramfs-kpkg b/mkinitramfs-kpkg new file mode 100644 index 0000000..d36710a --- /dev/null +++ b/mkinitramfs-kpkg @@ -0,0 +1,94 @@ +#!/bin/sh + +STATEDIR=/var/lib/initramfs-tools + +usage() +{ + cat >&2 << EOF + +Usage: ${0} <-o outfile> [version] + +Please use update-initramfs(8): +${0} exists for compatibility by kernel-package(5) calls. +See ${0}(8) for further details. +EOF + exit 1 +} + +OPTIONS=`getopt -o m:o: --long supported-host-version:,supported-target-version: -n "$0" -- "$@"` +# Check for non-GNU getopt +if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi + +eval set -- "$OPTIONS" + +while true; do + case "$1" in + -m) + # ignore + shift 2 + ;; + -o) + touch $2 + outfile="$(readlink -f "$2")" + shift 2 + ;; + --supported-host-version) + supported_host_version="$2" + shift 2 + ;; + --supported-target-version) + supported_target_version="$2" + shift 2 + ;; + --) + shift + break + ;; + *) + echo "Internal error!" >&2 + exit 1 + ;; + esac +done + +if [ -n "$supported_host_version" ] || [ -n "$supported_target_version" ]; then + if [ -n "$supported_host_version" ]; then + host_upstream_version="${supported_host_version%%-*}" + fi + if [ -n "$supported_target_version" ]; then + target_upstream_version="${supported_target_version%%-*}" + if dpkg --compare-versions "$target_upstream_version" lt "2.6.12"; then + exit 2 + fi + fi + exit 0 +fi + + +if [ -z "${outfile}" ]; then + usage +fi + +# And by "version" we really mean path to kernel modules +# This is braindead, and exists to preserve the interface with mkinitrd +version="${1}" + +case "${version}" in +/lib/modules/*/[!/]*) + ;; +/lib/modules/[!/]*) + version="${version#/lib/modules/}" + version="${version%%/*}" + ;; +esac + +case "${version}" in +*/*) + echo "$PROG: ${version} is not a valid kernel version" >&2 + exit 1 + ;; +esac + +# linux-image installs latest version +mkinitramfs -o ${outfile} ${version} +sha1sum "${outfile}" | sed -e 's/\.new//' > "${STATEDIR}/${version}" diff --git a/mkinitramfs-kpkg.8 b/mkinitramfs-kpkg.8 new file mode 100644 index 0000000..34f76db --- /dev/null +++ b/mkinitramfs-kpkg.8 @@ -0,0 +1,49 @@ +.TH MKINITRAMFS-KPKG 8 "$Date: 2006/02/17 $" "" "mkinitramfs-kpkg manual" + +.SH NAME +mkinitramfs-kpkg \- generates an initramfs image for kernel-package + +.SH SYNOPSIS +.B mkinitramfs +.RB [ \-o +.IR outfile ] +.RI [ version ] +.B mkinitramfs +.RB [ \-\-supported-host-version= +.IR hversion ] +.RB [ \-\-supported-target-version= +.IR tversion ] + +.SH DESCRIPTION +The +.B mkinitramfs-kpkg +script calls +.B mkinitramfs +for kernel-package. It's usage is not recommended. +See +.B update-initramfs +for an better alternative. + +.SH OPTIONS + +.TP +\fB \-o \fI outfile +Write the image to +.IR outfile . + +.TP +\fB\-\-supported-host-version=\fIhversion +This option queries if mkinitramfs can create ramdisks on a running kernel of version +.IR hversion . + +.TP +\fB\-\-supported-target-version=\fItversion +This option queries if mkinitramfs can create ramdisks for kernel version +.IR tversion . + +.SH AUTHOR +mkinitramfs-kpkg is maintained by Maximilian Attems <maks@sternwelten.at>. + +.SH SEE ALSO + +.BR initramfs.conf (5), initramfs-tools (8), update-initramfs (8) |