Exemplo n.º 1
0
def run():
    args = _parse_args()
    cmdline = from_str(args.file)
    cmdline = add_parameters(cmdline, args.parameters_to_add or [])
    if args.in_place:
        to_file(cmdline, args.file)
    else:
        print(to_str(cmdline))
def test_example(boot_cmdline_path):
    boot_cmdline_file = boot_cmdline_path.strpath

    # Example start
    from pibootcmdline.parse import from_file
    from pibootcmdline.write import to_file
    from pibootcmdline.edit import add_parameters, set_parameters, add_to_value

    cmdline = from_file(boot_cmdline_file)
    cmdline = set_parameters(cmdline, 'rootfstype=ext3')
    cmdline = add_parameters(cmdline, 'console=tty2')
    cmdline = add_to_value(cmdline, 'modules-load=g_ether')
    to_file(cmdline, boot_cmdline_file)
    # Example end

    assert boot_cmdline_path.read() == _cmdline_after
Exemplo n.º 3
0
def test_add_nothing():
    assert add_parameters([]) == []
Exemplo n.º 4
0
def test_add_simple_parameter():
    assert add_parameters([], 'rootwait') == [Parameter('rootwait', [])]
Exemplo n.º 5
0
def test_add_keyval_parameter():
    assert add_parameters([Parameter('foo', ['bar'])], 'foo=moo') == \
           [Parameter('foo', ['bar']), Parameter('foo', ['moo'])]