Fix #162: flash_system: meaningful error for missing image

This commit is contained in:
Oliver Smith 2017-07-21 20:26:56 +02:00
parent 56b34212f6
commit 5651c28b41
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 30 additions and 30 deletions

View File

@ -84,8 +84,8 @@ def system(args):
# Generate system image, install flasher
img_path = "/home/user/rootfs/" + args.device + ".img"
if not os.path.exists(args.work + "/chroot_native" + img_path):
setattr(args, "sdcard", None)
pmb.install.install(args, False)
raise RuntimeError("The system image has not been generated yet,"
" please run 'pmbootstrap install' first.")
pmb.flasher.init(args)
# Run the flasher

View File

@ -78,7 +78,7 @@ def set_user_password(args):
pass
def install(args, show_flash_msg=True):
def install(args):
# Install required programs in native chroot
logging.info("*** (1/5) PREPARE NATIVE CHROOT ***")
pmb.chroot.apk.install(args, pmb.config.install_native_packages,
@ -122,32 +122,32 @@ def install(args, show_flash_msg=True):
fix_mount_folders(args)
pmb.chroot.shutdown(args, True)
# Flash to target device
# Kernel flash information
logging.info("*** (5/5) FLASHING TO DEVICE ***")
if show_flash_msg:
logging.info("Run the following to flash your installation to the"
" target device:")
logging.info("* pmbootstrap flasher flash_kernel")
logging.info(" Flashes the kernel + initramfs to your device:")
logging.info(
" " +
args.work +
"/chroot_rootfs_" +
args.device +
"/boot")
method = args.deviceinfo["flash_methods"]
if (method in pmb.config.flashers and "boot" in
pmb.config.flashers[method]["actions"]):
logging.info(" (NOTE: " + method + " also supports booting"
" the kernel/initramfs directly without flashing."
" Use 'pmbootstrap flasher boot' to do that.)")
logging.info("Run the following to flash your installation to the"
" target device:")
logging.info("* pmbootstrap flasher flash_kernel")
logging.info(" Flashes the kernel + initramfs to your device:")
logging.info(" " + args.work + "/chroot_rootfs_" + args.device +
"/boot")
method = args.deviceinfo["flash_methods"]
if (method in pmb.config.flashers and "boot" in
pmb.config.flashers[method]["actions"]):
logging.info(" (NOTE: " + method + " also supports booting"
" the kernel/initramfs directly without flashing."
" Use 'pmbootstrap flasher boot' to do that.)")
if not args.sdcard:
logging.info("* pmbootstrap flasher flash_system")
logging.info(" Flashes the system image, that has been"
" generated to your device:")
logging.info(" " + args.work + "/chroot_native/home/user/rootfs/" +
args.device + ".img")
logging.info(" (NOTE: This file has a partition table,"
" which contains one currently unused boot"
" partition, and the root partition.)")
# System flash information
if not args.sdcard:
logging.info("* pmbootstrap flasher flash_system")
logging.info(" Flashes the system image, that has been"
" generated to your device:")
logging.info(" " + args.work + "/chroot_native/home/user/rootfs/" +
args.device + ".img")
logging.info(" (NOTE: This file has a partition table,"
" which contains a boot- and root subpartition.)")
# Export information
logging.info("* If the above steps do not work, you can also create"
" symlinks to the generated files with 'pmbootstrap flasher"
" export <target_dir>' and flash outside of pmbootstrap.")