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))
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)
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())
def test_ls_sd_cards(self): cards = DeviceManager.get_sd_cards() print(cards)
def test_mount(self): cards = DeviceManager.get_sd_cards() card = select_sd_card(cards) card.unmount_children() card.mount_children() card.unmount_children()
def test_auto_select(self): cards = DeviceManager.get_sd_cards() card = select_sd_card(cards) print(card)
def list(): sd_cards = DeviceManager.get_sd_cards() #print([x.label for x in sd_cards]) for x in sd_cards: x.pretty_print()
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)