def run_stages(stages_path, root_fs_path): remote_stages = os.path.join(root_fs_path, 'stages') sudo_run(['cp', '-R', stages_path, remote_stages]) stages = os.listdir(remote_stages) stages.sort() print_log(stages) for stage in stages: stage_path = os.path.join('stages', stage) sudo_run(['arch-chroot', root_fs_path, 'bash', '-ex', stage_path])
def build_raw_disk(image_path): run(['qemu-img', 'create', image_path, '4G']) # install boot sector run(['dd', 'bs=440', 'conv=notrunc', 'count=1', 'if=/usr/lib/syslinux/bios/gptmbr.bin', 'of=' + image_path]) build_partitions(image_path) loop_device = constants.LOOP_DEVICE_PATH sudo_run(['losetup', '-P', loop_device, image_path]) try: loop_partition = loop_device + 'p1' sudo_run(['mkfs.ext4', loop_partition]) sudo_run(['tune2fs', '-L', 'rootfs', loop_partition]) finally: sudo_run(['losetup', '-d', loop_device])
def bootstrap_base(root_fs_path): # sudo_run(['pacstrap', root_fs_path, 'base', 'base-devel', 'linux', 'linux-firmware']) sudo_run(['pacstrap', root_fs_path, 'base', 'linux', 'linux-firmware'])
def submit_resources(root_fs_path): sudo_run(["cp", "-R", "./resources/", os.path.join(root_fs_path, "root/resources")])
def install_bootloader(root_fs_path): sudo_run(['extlinux', '--install', os.path.join(root_fs_path, 'boot')])