From: Andreas Schwab Date: Wed, 17 Nov 2010 15:20:50 +0000 (+0100) Subject: Simplify check for running kernel X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e8ff763f14a0414a0f1eee92011abaaefa4fc46;p=thirdparty%2Fglibc.git Simplify check for running kernel --- diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in index 14a6e27e473..f9eb56496ad 100644 --- a/fedora/glibc.spec.in +++ b/fedora/glibc.spec.in @@ -863,21 +863,9 @@ mkdir -p $RPM_BUILD_ROOT/var/cache/ldconfig %pre -p -- Check that the running kernel is new enough required = '%{enablekernel}' -f = io.open("/proc/sys/kernel/osrelease") -if f then - rel = {} - for v in string.gmatch(f:read(), '%%d+') do - table.insert(rel, tonumber(v)) - end - i = 1 - for r in string.gmatch(required, '%%d+') do - if rel[i] == nil or tonumber(r) > rel[i] then - print("FATAL: kernel too old") - os.exit(1) - end - if tonumber(r) < rel[i] then break end - i = i + 1 - end +rel = posix.uname("%r") +if rpm.vercmp(rel, required) < 0 then + error("FATAL: kernel too old", 0) end %post -p /usr/sbin/glibc_post_upgrade.%{_target_cpu}