Ejemplo n.º 1
0
def start_app(app_name = 'backintime'):
    """
    Start the requested command or return config if there was no command
    in arguments.

    app_name:   string representing the current application
    """
    create_parsers(app_name)
    #open log
    logger.APP_NAME = app_name
    logger.openlog()

    #parse args
    args = arg_parse(None)

    #add source path to $PATH environ if running from source
    if tools.running_from_source():
        tools.add_source_to_path_environ()

    #warn about sudo
    if tools.usingSudo() and os.getenv('BIT_SUDO_WARNING_PRINTED', 'false') == 'false':
        os.putenv('BIT_SUDO_WARNING_PRINTED', 'true')
        logger.warning("It looks like you're using 'sudo' to start %(app)s. "
                       "This will cause some troubles. Please use either 'sudo -i %(app_name)s' "
                       "or 'pkexec %(app_name)s'."
                       %{'app_name': app_name, 'app': config.Config.APP_NAME})

    #call commands
    if 'func' in dir(args):
        args.func(args)
    else:
        setQuiet(args)
        printHeader()
        return getConfig(args, False)
Ejemplo n.º 2
0
def start_app(app_name='backintime'):
    """
    Start the requested command or return config if there was no command
    in arguments.

    app_name:   string representing the current application
    """
    create_parsers(app_name)
    #open log
    logger.APP_NAME = app_name
    logger.openlog()

    #parse args
    args = arg_parse(None)

    #add source path to $PATH environ if running from source
    if tools.running_from_source():
        tools.add_source_to_path_environ()

    #warn about sudo
    if tools.usingSudo() and os.getenv('BIT_SUDO_WARNING_PRINTED',
                                       'false') == 'false':
        os.putenv('BIT_SUDO_WARNING_PRINTED', 'true')
        logger.warning(
            "It looks like you're using 'sudo' to start %(app)s. "
            "This will cause some troubles. Please use either 'sudo -i %(app_name)s' "
            "or 'pkexec %(app_name)s'." % {
                'app_name': app_name,
                'app': config.Config.APP_NAME
            })

    #call commands
    if 'func' in dir(args):
        args.func(args)
    else:
        setQuiet(args)
        printHeader()
        return getConfig(args, False)
Ejemplo n.º 3
0
 def test_running_from_source(self):
     self.assertTrue(tools.running_from_source())