forked from Mirror/pmbootstrap
* Usage: pmbootstrap install --split * Make obvious that export is the next step when split images are created * Fix note for missing rootfs image on export * Change wording from "system image" to "rootfs image" * The idea was to show the note only when the rootfs image was not generated yet. But this was broken, because the path we checked for was missing the chroot path prefix (which is added now). * Also don't display the message, when the split image files exist
78 lines
2.7 KiB
Python
78 lines
2.7 KiB
Python
"""
|
|
Copyright 2018 Oliver Smith
|
|
|
|
This file is part of pmbootstrap.
|
|
|
|
pmbootstrap is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
pmbootstrap is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
|
"""
|
|
import logging
|
|
import os
|
|
import glob
|
|
|
|
import pmb.build
|
|
import pmb.chroot.apk
|
|
import pmb.config
|
|
import pmb.flasher
|
|
import pmb.helpers.file
|
|
|
|
|
|
def symlinks(args, flavor, folder):
|
|
"""
|
|
Create convenience symlinks to the system image and boot files.
|
|
"""
|
|
|
|
# File descriptions
|
|
info = {
|
|
"boot.img-" + flavor: "Fastboot compatible boot.img file,"
|
|
" contains initramfs and kernel",
|
|
"blob-" + flavor: "Asus boot blob for TF101",
|
|
"initramfs-" + flavor: "Initramfs",
|
|
"uInitrd-" + flavor: "Initramfs, legacy u-boot image format",
|
|
"uImage-" + flavor: "Kernel, legacy u-boot image format",
|
|
"vmlinuz-" + flavor: "Linux kernel",
|
|
args.device + ".img": "Rootfs with partitions for /boot and /",
|
|
args.device + "-boot.img": "Boot partition image",
|
|
args.device + "-root.img": "Root partition image",
|
|
"pmos-" + args.device + ".zip": "Android recovery flashable zip",
|
|
}
|
|
|
|
# Generate a list of patterns
|
|
path_native = args.work + "/chroot_native"
|
|
path_boot = args.work + "/chroot_rootfs_" + args.device + "/boot"
|
|
path_buildroot = args.work + "/chroot_buildroot_" + args.deviceinfo["arch"]
|
|
patterns = [path_boot + "/*-" + flavor,
|
|
path_native + "/home/pmos/rootfs/" + args.device + ".img",
|
|
path_native + "/home/pmos/rootfs/" + args.device + "-boot.img",
|
|
path_native + "/home/pmos/rootfs/" + args.device + "-root.img",
|
|
path_buildroot +
|
|
"/var/lib/postmarketos-android-recovery-installer/pmos-" +
|
|
args.device + ".zip"]
|
|
|
|
# Generate a list of files from the patterns
|
|
files = []
|
|
for pattern in patterns:
|
|
files += glob.glob(pattern)
|
|
|
|
# Iterate through all files
|
|
for file in files:
|
|
basename = os.path.basename(file)
|
|
link = folder + "/" + basename
|
|
|
|
# Display a readable message
|
|
msg = " * " + basename
|
|
if basename in info:
|
|
msg += " (" + info[basename] + ")"
|
|
logging.info(msg)
|
|
|
|
pmb.helpers.file.symlink(args, file, link)
|