Various improvements for 'pmbootstrap export' (Fix #232) (#250)

* Various improvements for 'pmbootstrap export' (Fix #232)
* Do not try to generate the system image, but print a notice that
  it was not generated yet
* Display export path
* New default path: /tmp/postmarketOS-export (instead of current
  working dir)
* Create the export folder, if it does not exist yet
* Prettier output in the export message
* Adjust export message in install for consistency
This commit is contained in:
Oliver Smith 2017-07-27 17:40:38 +00:00 committed by GitHub
parent 2257bb6f2a
commit 6a034f1409
4 changed files with 13 additions and 8 deletions

View File

@ -30,6 +30,8 @@ def export(args, flavor, folder):
""" """
Create convenience symlinks to the system image and boot files. Create convenience symlinks to the system image and boot files.
""" """
logging.info("Export symlinks to: " + folder)
# File descriptions # File descriptions
info = { info = {
"boot.img-" + flavor: "Fastboot compatible boot.img file," "boot.img-" + flavor: "Fastboot compatible boot.img file,"
@ -58,7 +60,7 @@ def export(args, flavor, folder):
link = folder + "/" + basename link = folder + "/" + basename
# Display a readable message # Display a readable message
msg = "Symlink: " + basename msg = " * " + basename
if basename in info: if basename in info:
msg += " (" + info[basename] + ")" msg += " (" + info[basename] + ")"
logging.info(msg) logging.info(msg)

View File

@ -98,11 +98,15 @@ def list_devices(args):
def export(args): def export(args):
# Generate system image # Create the export folder
if not os.path.exists(args.export_folder):
pmb.helpers.run.user(args, ["mkdir", "-p", args.export_folder])
# System image note
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) logging.info("NOTE: To export the system image, run 'pmbootstrap"
pmb.install.install(args, False) " install' first (without the 'sdcard' parameter).")
# Rebuild the initramfs, just to make sure (see #69) # Rebuild the initramfs, just to make sure (see #69)
flavor = parse_flavor_arg(args) flavor = parse_flavor_arg(args)

View File

@ -153,4 +153,4 @@ def install(args):
# Export information # Export information
logging.info("* If the above steps do not work, you can also create" logging.info("* If the above steps do not work, you can also create"
" symlinks to the generated files with 'pmbootstrap flasher" " symlinks to the generated files with 'pmbootstrap flasher"
" export <target_dir>' and flash outside of pmbootstrap.") " export [export_folder]' and flash outside of pmbootstrap.")

View File

@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>. along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
""" """
import argparse import argparse
import os
import pmb.config import pmb.config
import pmb.parse.arch import pmb.parse.arch
@ -45,8 +44,8 @@ def arguments_flasher(subparser):
# Export: additional arguments # Export: additional arguments
export.add_argument("export_folder", help="export folder, defaults to" export.add_argument("export_folder", help="export folder, defaults to"
" the current working directory.", " /tmp/postmarketOS-export",
default=os.getcwd(), nargs="?") default="/tmp/postmarketOS-export", nargs="?")
return ret return ret