From: Andreas Schwab Date: Thu, 11 Nov 2010 10:40:13 +0000 (+0100) Subject: Check that the running kernel is new enough X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56b7a6e949178b27895074cdf041030f1f0da22a;p=thirdparty%2Fglibc.git Check that the running kernel is new enough --- diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in index dd78bf09a70..2ef87ef8265 100644 --- a/fedora/glibc.spec.in +++ b/fedora/glibc.spec.in @@ -858,6 +858,26 @@ touch $RPM_BUILD_ROOT/var/run/nscd/{socket,nscd.pid} mkdir -p $RPM_BUILD_ROOT/var/cache/ldconfig > $RPM_BUILD_ROOT/var/cache/ldconfig/aux-cache +%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 +end + %post -p /usr/sbin/glibc_post_upgrade.%{_target_cpu} %postun -p /sbin/ldconfig