pmbootstrap-meow/pmb/export/frontend.py
Oliver Smith ef047137d0
install: rename --sdcard arg to --disk
Rename the argument, because any block device can be passed to the
argument. Use "disk", because the other short word "device" usually
means the target device/phone to install.

Keep --sdcard as alias for compatibility with existing scripts and
muscle memory.

Reviewed-by: Clayton Craft <clayton@craftyguy.net>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20231119182302.2415-1-ollieparanoid@postmarketos.org%3E
2023-11-19 20:27:37 +01:00

33 lines
1 KiB
Python

import glob
import logging
import os
import pmb.helpers.run
import pmb.helpers.frontend
import pmb.chroot.initfs
import pmb.export
def frontend(args):
# Create the export folder
target = args.export_folder
if not os.path.exists(target):
pmb.helpers.run.user(args, ["mkdir", "-p", target])
# Rootfs image note
chroot = args.work + "/chroot_native"
pattern = chroot + "/home/pmos/rootfs/" + args.device + "*.img"
if not glob.glob(pattern):
logging.info("NOTE: To export the rootfs image, run 'pmbootstrap"
" install' first (without the 'disk' parameter).")
# Rebuild the initramfs, just to make sure (see #69)
flavor = pmb.helpers.frontend._parse_flavor(args, args.autoinstall)
if args.autoinstall:
pmb.chroot.initfs.build(args, flavor, "rootfs_" + args.device)
# Do the export, print all files
logging.info("Export symlinks to: " + target)
if args.odin_flashable_tar:
pmb.export.odin(args, flavor, target)
pmb.export.symlinks(args, flavor, target)