Remove tabs. Add a safe way to default to a distro.

This commit is contained in:
Chris Johns 2013-03-15 16:15:23 +11:00
parent 2feb624768
commit c3ab00c2a4

View File

@ -67,21 +67,24 @@ def load():
'__tar': ('exe', 'required', '/bin/tar') '__tar': ('exe', 'required', '/bin/tar')
} }
variations = { variations = {
'Ubuntu' : {'__bzip2': ('exe', 'required', '/bin/bzip2'), 'Ubuntu' : {'__bzip2': ('exe', 'required', '/bin/bzip2'),
'__chgrp': ('exe', 'required', '/bin/chgrp'), '__chgrp': ('exe', 'required', '/bin/chgrp'),
'__chown': ('exe', 'required', '/bin/chown'), '__chown': ('exe', 'required', '/bin/chown'),
'__grep': ('exe', 'required', '/bin/grep'), '__grep': ('exe', 'required', '/bin/grep'),
'__sed': ('exe', 'required', '/bin/sed') }, '__sed': ('exe', 'required', '/bin/sed') },
'Fedora' : { '__install_info': ('exe', 'required', '/sbin/install-info') }, 'Fedora' : { '__install_info': ('exe', 'required', '/sbin/install-info') },
'Arch' : { '__gzip': ('exe', 'required', '/usr/bin/gzip'), 'Arch' : { '__gzip': ('exe', 'required', '/usr/bin/gzip'),
'__chown': ('exe', 'required', '/usr/bin/chown') } '__chown': ('exe', 'required', '/usr/bin/chown') }
} }
# Works for LSB distros # Works for LSB distros
distro = platform.dist()[0] distro = platform.dist()[0]
# Non LSB - fail over to issue # Non LSB - fail over to issue
if distro == '': if distro == '':
issue = open('/etc/issue').read() try:
distro = issue.split(' ')[0] issue = open('/etc/issue').read()
distro = issue.split(' ')[0]
except:
distro = 'Ubuntu'
if variations.has_key(distro): if variations.has_key(distro):
for v in variations[distro]: for v in variations[distro]: