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

View File

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