Skip to content

Commit

Permalink
fix oe.execute() and service startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lu-Fi committed Aug 20, 2013
1 parent 0e9950c commit 60dbeca
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.openelec.settings"
name="OpenELEC Configuration"
version="0.2.8"
version="0.2.9"
provider-name="OpenELEC">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2013-08-20 v0.2.9
(fix) wait for execute to close
(fix) dont restart services (SYSTEMD) on startup

2013-08-19 v0.2.8
(change) move service configs to .cache/settings/*.conf

Expand Down
17 changes: 11 additions & 6 deletions oe.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def _(code):
return __addon__.getLocalizedString(code)

def dbg_log(source, text, level=4):
if os.environ.get('DEBUG', 'no') == 'no':
return
#if os.environ.get('DEBUG', 'no') == 'no':
# return

xbmc.log('## OpenELEC Addon ## ' + source + ' ## ' + text, level)
xbmc.log(traceback.format_exc())
Expand Down Expand Up @@ -177,14 +177,18 @@ def execute(command_line, get_result=0):
shell=True,
close_fds=True)

return process.pid
process.wait()

else:
result = ''
process = subprocess.Popen(command_line,
shell=True,
close_fds=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)

process.wait()

for line in process.stdout.readlines():
result = result + line

Expand Down Expand Up @@ -300,9 +304,10 @@ def set_service(service, options, state):
if os.path.exists(cfo):
os.rename(cfo, cfn)

if service in defaults._services:
for svc in defaults._services[service]:
execute("systemctl restart %s" % svc)
if not __oe__.is_service:
if service in defaults._services:
for svc in defaults._services[service]:
execute("systemctl restart %s" % svc)

dbg_log('oe::set_service', 'exit_function')
except Exception, e:
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/modules/connman.py
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,6 @@ def do_init(self):
self.oe.dbg_log('connman::do_init', 'enter_function', 0)

self.visible = True
self.load_values()

self.oe.dbg_log('connman::do_init', 'exit_function', 0)
except Exception, e:
Expand Down Expand Up @@ -2533,6 +2532,7 @@ def start_service(self):
self.oe.dbg_log('connman::start_service', 'enter_function',
0)

self.load_values()
self.mount_drives()

self.oe.dbg_log('connman::start_service', 'exit_function',
Expand Down

0 comments on commit 60dbeca

Please sign in to comment.