summaryrefslogtreecommitdiff
path: root/hook-functions
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2007-05-27 00:57:02 +0200
committermaximilian attems <maks@debian.org>2007-05-27 00:57:02 +0200
commitfa78f20fc86dabbd6e89485b755cb40f3918895a (patch)
tree4a068efa492148078950b6b004963468d5df85fb /hook-functions
parentbb98536c4c1b597ed326c8729e048eac5526869b (diff)
downloadinitramfs-tools-fa78f20fc86dabbd6e89485b755cb40f3918895a.tar.gz
initramfs-tools-fa78f20fc86dabbd6e89485b755cb40f3918895a.zip
hook-functions: make version check in check_minkver more robust.
Diffstat (limited to 'hook-functions')
-rw-r--r--hook-functions10
1 files changed, 7 insertions, 3 deletions
diff --git a/hook-functions b/hook-functions
index b3264ac..1b38931 100644
--- a/hook-functions
+++ b/hook-functions
@@ -340,9 +340,13 @@ check_minkver()
fi
set_initlist
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
+ # sed: keep last line starting with MINKVER=,
+ # remove MINKVER= and trailing space
+ minver=$(sed '/^MINKVER=/!d;$!d;s/^MINKVER=//;s/[[:space:]]*$//' "${initdir}/${cm_x}")
+ if [ -z "${tmp}" ]; then
+ continue
+ elif dpkg --compare-versions "${curversion}" lt "${minver}"; then
+ echo "W: ${cm_x} hook script requires at least kernel version ${minver}" >&2
echo "W: not generating requested initramfs for kernel ${curversion}" >&2
exit 2
fi