Created
November 5, 2013 23:14
-
-
Save shimaore/7328080 to your computer and use it in GitHub Desktop.
Adapt media-relay kernel detection to recent Debian format.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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