summaryrefslogtreecommitdiff
path: root/hook-functions
diff options
context:
space:
mode:
Diffstat (limited to 'hook-functions')
-rw-r--r--hook-functions31
1 files changed, 31 insertions, 0 deletions
diff --git a/hook-functions b/hook-functions
index 6d41f2e..fe10cfe 100644
--- a/hook-functions
+++ b/hook-functions
@@ -226,3 +226,34 @@ EOF
}
+# minimal supported kernel version
+check_minkver()
+{
+ curversion=${1}
+ initdir=${2}
+ set_initlist
+ if [ -z ${initdir} ]; then
+ DPKG_ARCH=`dpkg --print-installation-architecture`
+ case ${DPKG_ARCH} in
+ ia64|hppa)
+ minversion="2.6.15"
+ ;;
+ *)
+ minversion="2.6.12"
+ ;;
+ esac
+ if dpkg --compare-versions "${curversion}" lt "${minversion}"; then
+ echo "W: kernerl ${curversion} too old for initramfs on ${DPKG_ARCH}" >&2
+ echo "W: not generating requested initramfs for kernel ${curversion}" >&2
+ exit 2
+ fi
+ fi
+ [ -z ${initdir} ] || for cm_x in ${initlist}; do
+ tmp=$(eval echo $(grep ^MINKVER ${initdir}/${cm_x} | cut -d'=' -f2))
+ if dpkg --compare-versions "${curversion}" lt "${tmp}"; then
+ echo "W: ${cm_x} hook script requires at least kernel version ${tmp}" >&2
+ echo "W: not generating requested initramfs for kernel ${curversion}" >&2
+ exit 2
+ fi
+ done
+}