Newer
Older
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import subprocess
import utils
def setup(interactive=True):
cmds = [
'apt-get install -y python3-mediaserver-monitor',
]
utils.run_commands(cmds)
# Set ubicast password if any
pwd = utils.get_conf('MONITOR_SHELL_PWD')
if pwd:
p = subprocess.Popen(['passwd', '-q', 'msmonitor'], stdin=subprocess.PIPE)
p.communicate(input=b'%(pwd)s\n%(pwd)s' % dict(pwd=pwd.encode('utf-8')))
if p.returncode != 0:
raise Exception('Failed to set msmonitor account password.')
utils.log('\033[1;33m The msmonitor account password has been set. \033[0m')