[Artur Tulyulya] Also detect CRUX. fixes #1626

This commit is contained in:
Nikos Kouremenos 2006-02-27 15:19:56 +00:00
parent 6c34669780
commit a1b1538c54
1 changed files with 42 additions and 37 deletions

View File

@ -74,6 +74,7 @@ distro_info = {
'Arch Linux': '/etc/arch-release', 'Arch Linux': '/etc/arch-release',
'Aurox Linux': '/etc/aurox-release', 'Aurox Linux': '/etc/aurox-release',
'Conectiva Linux': '/etc/conectiva-release', 'Conectiva Linux': '/etc/conectiva-release',
'CRUX': '/usr/bin/crux',
'Debian GNU/Linux': '/etc/debian_release', 'Debian GNU/Linux': '/etc/debian_release',
'Debian GNU/Linux': '/etc/debian_version', 'Debian GNU/Linux': '/etc/debian_version',
'Fedora Linux': '/etc/fedora-release', 'Fedora Linux': '/etc/fedora-release',
@ -129,18 +130,22 @@ def get_os_info():
for distro_name in distro_info: for distro_name in distro_info:
path_to_file = distro_info[distro_name] path_to_file = distro_info[distro_name]
if os.path.exists(path_to_file): if os.path.exists(path_to_file):
fd = open(path_to_file) if os.access(path_to_file, os.X_OK): # is the file executable?
text = fd.readline().strip() #get only first line # yes, then run it and get output. (CRUX ONLY ATM)
fd.close() text = helpers.get_output_of_command(path_to_file)
if path_to_file.endswith('version'): else:
# sourcemage_version has all the info we need fd = open(path_to_file)
if not os.path.basename(path_to_file).startswith('sourcemage'): 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'):
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 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 return text
# our last chance, ask uname and strip it # our last chance, ask uname and strip it
@ -161,7 +166,7 @@ class Connection:
self.status = '' self.status = ''
self.old_show = '' self.old_show = ''
# increase/decrease default timeout for server responses # increase/decrease default timeout for server responses
self.try_connecting_for_foo_secs = 45 self.try_connecting_for_foo_secs = 45
# holds the actual hostname to which we are connected # holds the actual hostname to which we are connected
self.connected_hostname = None self.connected_hostname = None
self.time_to_reconnect = None self.time_to_reconnect = None