about summary refs log tree commit diff
path: root/fedora/glibc.spec.in
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2010-11-11 11:40:13 +0100
committerAndreas Schwab <schwab@redhat.com>2010-11-12 12:00:08 +0100
commit56b7a6e949178b27895074cdf041030f1f0da22a (patch)
treec04f0d979bd39694f329b5e457cbcee1dc2b0d0d /fedora/glibc.spec.in
parentfb33a006c1caba244158f8c9f5bfe8b44c82539f (diff)
downloadglibc-56b7a6e949178b27895074cdf041030f1f0da22a.tar.gz
glibc-56b7a6e949178b27895074cdf041030f1f0da22a.tar.xz
glibc-56b7a6e949178b27895074cdf041030f1f0da22a.zip
Check that the running kernel is new enough
Diffstat (limited to 'fedora/glibc.spec.in')
-rw-r--r--fedora/glibc.spec.in20
1 files changed, 20 insertions, 0 deletions
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index dd78bf09a7..2ef87ef826 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 <lua>
+-- 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