Skip to content
Snippets Groups Projects
0_setup.py 660 B
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)
Stéphane Diemer's avatar
Stéphane Diemer committed
        p.communicate(input=b'%(pwd)s\n%(pwd)s' % {b'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')