[Artur Tulyulya] Also detect CRUX. fixes #1626
This commit is contained in:
parent
6c34669780
commit
a1b1538c54
1 changed files with 42 additions and 37 deletions
|
@ -74,6 +74,7 @@ distro_info = {
|
|||
'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',
|
||||
|
@ -129,18 +130,22 @@ def get_os_info():
|
|||
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, os.X_OK): # is the file executable?
|
||||
# yes, then run it and get output. (CRUX ONLY ATM)
|
||||
text = helpers.get_output_of_command(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 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
|
||||
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
|
||||
|
@ -161,7 +166,7 @@ class Connection:
|
|||
self.status = ''
|
||||
self.old_show = ''
|
||||
# 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
|
||||
self.connected_hostname = None
|
||||
self.time_to_reconnect = None
|
||||
|
|
Loading…
Add table
Reference in a new issue