[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,8 +130,12 @@ 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):
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) fd = open(path_to_file)
text = fd.readline().strip() #get only first line text = fd.readline().strip() # get only first line
fd.close() fd.close()
if path_to_file.endswith('version'): if path_to_file.endswith('version'):
# sourcemage_version has all the info we need # sourcemage_version has all the info we need