Make detection of HAL on linux a little more intelligent

This commit is contained in:
Kovid Goyal 2008-05-24 10:08:42 -07:00
parent 7e270ac92e
commit 103703aef5

View File

@ -4,7 +4,7 @@ import shutil
''' Post installation script for linux ''' ''' Post installation script for linux '''
import sys, os, re import sys, os, re
from subprocess import check_call from subprocess import check_call, call
from calibre import __version__, __appname__ from calibre import __version__, __appname__
from calibre.devices import devices from calibre.devices import devices
@ -301,16 +301,15 @@ def setup_udev_rules(group_file, reload, fatal_errors):
fdi.write('\n</deviceinfo>\n') fdi.write('\n</deviceinfo>\n')
fdi.close() fdi.close()
if reload: if reload:
try: called = False
check_call('/etc/init.d/hald restart', shell=True) for hal in ('hald', 'hal', 'haldaemon'):
except: hal = os.path.join('/etc/init.d', hal)
try: if os.access(hal, os.X_OK):
check_call('/etc/init.d/hal restart', shell=True) call((hal, 'restart'))
except: called = True
try: break
check_call('/etc/init.d/haldaemon restart', shell=True) if not called and os.access('/etc/rc.d/rc.hald', os.X_OK):
except: call(('/etc/rc.d/rc.hald', 'restart'))
check_call('/etc/rc.d/rc.hald restart', shell=True)
try: try:
check_call('udevcontrol reload_rules', shell=True) check_call('udevcontrol reload_rules', shell=True)