Skip to content

Instantly share code, notes, and snippets.

@shimaore
Created November 5, 2013 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shimaore/7328080 to your computer and use it in GitHub Desktop.
Save shimaore/7328080 to your computer and use it in GitHub Desktop.
Adapt media-relay kernel detection to recent Debian format.
--- mediaproxy-2.5.2/media-relay 2013-11-06 00:03:30.069952020 +0100
+++ /usr/bin/media-relay 2013-11-06 00:12:24.970318048 +0100
@@ -20,7 +20,8 @@
IP_FORWARD_FILE = "/proc/sys/net/ipv4/ip_forward"
CONNTRACK_ACCT_FILE = "/proc/sys/net/netfilter/nf_conntrack_acct"
- KERNEL_VERSION_FILE = "/proc/sys/kernel/osrelease"
+ OS_RELEASE_FILE = "/proc/sys/kernel/osrelease"
+ KERNEL_VERSION_FILE = "/proc/sys/kernel/version"
name = "media-relay"
fullname = "MediaProxy Relay"
@@ -50,10 +51,13 @@
sys.exit(1)
try:
- major, minor, revision = [int(num) for num in open(KERNEL_VERSION_FILE).read().split(" ", 1)[3].split(".")[:3]]
+ major, minor, revision = [int(num) for num in open(OS_RELEASE_FILE).read().split("-", 1)[0].split(".")[:3]]
except:
- log.fatal("Could not determine Linux kernel version")
- sys.exit(1)
+ try:
+ major, minor, revision = [int(num) for num in open(KERNEL_VERSION_FILE).read().split(" ", 4)[3].split("-", 1)[0].split(".")[:3]]
+ except:
+ log.fatal("Could not determine Linux kernel version")
+ sys.exit(1)
if (major, minor, revision) < (2, 6, 18):
log.fatal("A mimimum Linux kernel version of 2.6.18 is required")
sys.exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment