CRUX detection
Patch for thrunk/src/common/connection.py
--- src/common/connection.py 2005-12-27 00:07:43.000000000 +0000
+++ src/common/connection.py 2006-02-26 19:49:07.000000000 +0000
@@ -29,9 +29,11 @@
VCARD_PUBLISHED = 'vcard_published'
VCARD_ARRIVED = 'vcard_arrived'
+import commands
import sys
import sha
import os
+from os import X_OK
import time
import sre
import traceback
@@ -79,6 +81,7 @@
'Arch Linux': '/etc/arch-release',
'Aurox Linux': '/etc/aurox-release',
'Conectiva Linux': '/etc/conectiva-release',
+ 'CRUX': '/usr/bin/crux',
'Debian GNU/Linux': '/etc/debian_release',
'Debian GNU/Linux': '/etc/debian_version',
'Fedora Linux': '/etc/fedora-release',
@@ -134,18 +137,21 @@
for distro_name in distro_info:
path_to_file = distro_info[distro_name]
if os.path.exists(path_to_file):
- fd = open(path_to_file)
- text = fd.readline().strip() #get only first line
- fd.close()
- if path_to_file.endswith('version'):
- # sourcemage_version has all the info we need
- if not os.path.basename(path_to_file).startswith('
sourcemage'):
+ if os.access(path_to_file, X_OK):
+ text = commands.getoutput(path_to_file)
+ else:
+ fd = open(path_to_file)
+ text = fd.readline().strip() # get only first line
+ fd.close()
+ if path_to_file.endswith('version'):
+ # sourcemage_version has all the info we n
eed
+ if not os.path.basename(path_to_file).star
tswith('sourcemage'):
+ text = distro_name + ' ' + text
+ elif path_to_file.endswith('aurox-release'):
+ # file doesn't have version
+ text = distro_name
+ elif path_to_file.endswith('lfs-release'): # file
just has version
text = distro_name + ' ' + text
- elif path_to_file.endswith('aurox-release'):
- # file doesn't have version
- text = distro_name
- elif path_to_file.endswith('lfs-release'): # file just has
version
- text = distro_name + ' ' + text
return text
# our last chance, ask uname and strip it
If you want to ask why CRUX and not CRUX Linux or CRUX GNU/Linux, see FAQ section of CRUX Handbook (http://crux.nu/doc/handbook.txt):
3. Is it called CRUX Linux or CRUX GNU/Linux?
None of the above. It's called CRUX, no more no less.