示例#1
0
def main():
    cards = DeviceManager.get_sd_cards()
    card = select_sd_card(cards)
    with card:
        time.sleep(1)

        print("----")
        configurator = PiConfigurator(card)

        hostname = configurator.get_hostname()
        ssh_enabled = configurator.is_ssh_enabled()
        default_pw = configurator.is_default_password()
        static_ip = configurator.get_static_ip()
        is_group_dialout = configurator.check_user_in_group("pi", "dialout")

        print(f"{check_not(hostname, 'raspberrypi')} Hostname: {hostname}")
        print(
            f"{check(ssh_enabled, True)} SSH: {'enabled' if ssh_enabled else 'disabled'}"
        )
        print(
            f"{check_not(default_pw, True)} Password: {'unchanged' if default_pw else 'changed'}"
        )
        print(f"{check_not(static_ip, None)} Static IP: {static_ip}")
        print(
            f"{check(is_group_dialout, True)} User pi is"
            f"{' ' if is_group_dialout else ' not '}a member of the group dialout."
        )

        print(list_networks(configurator.rootfs))
示例#2
0
    def test_i2c(self):
        cards = DeviceManager.get_sd_cards()
        card = select_sd_card(cards)
        with card:
            time.sleep(1)

            print("----")
            configurator = PiConfigurator(card)
            configurator.enable_i2c(True)
示例#3
0
    def test_read_target(self):
        cards = DeviceManager.get_sd_cards()
        card = select_sd_card(cards)
        with card:
            time.sleep(1)

            print("----")
            configurator = PiConfigurator(card)
            configurator.set_default_target("graphical")
            configurator.set_autologin("pi")
            configurator.tty_service()
            print(configurator.get_default_target())
示例#4
0
 def test_ls_sd_cards(self):
     cards = DeviceManager.get_sd_cards()
     print(cards)
示例#5
0
 def test_mount(self):
     cards = DeviceManager.get_sd_cards()
     card = select_sd_card(cards)
     card.unmount_children()
     card.mount_children()
     card.unmount_children()
示例#6
0
 def test_auto_select(self):
     cards = DeviceManager.get_sd_cards()
     card = select_sd_card(cards)
     print(card)
示例#7
0
def list():
    sd_cards = DeviceManager.get_sd_cards()
    #print([x.label for x in sd_cards])
    for x in sd_cards:
        x.pretty_print()
示例#8
0
def main(config_path: Union[str, Path]) -> None:
    cards = DeviceManager.get_sd_cards()
    card = select_sd_card(cards)
    with card:
        configurator = PiConfigurator(card)
        parse_yaml(configurator, config_file=config_path)