forked from Mirror/pmbootstrap
chroot: add --usb flag to make usb devices available (MR 2554)
Add a flag to bind-mount in the necessary sysfs directories for USB devices to be accessed inside the chroot. This is the same as how we do it for "pmbootstrap flasher" but allows running arbitrary commands in the chroot. This is useful to allow using pmbootstrap chroot's as a sandbox for custom flashing procedures. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
192a29fb1b
commit
67773c4293
3 changed files with 13 additions and 0 deletions
|
@ -27,6 +27,7 @@ import pmb.helpers.devices
|
|||
import pmb.helpers.git
|
||||
import pmb.helpers.lint
|
||||
import pmb.helpers.logging
|
||||
import pmb.helpers.mount
|
||||
import pmb.helpers.pmaports
|
||||
import pmb.helpers.repo
|
||||
import pmb.helpers.repo_missing
|
||||
|
@ -211,6 +212,11 @@ def chroot(args: PmbArgs) -> None:
|
|||
size_reserve = 2048 # 2 GiB
|
||||
pmb.install.blockdevice.create_and_mount_image(args, size_boot, size_root, size_reserve)
|
||||
|
||||
# Bind mount in sysfs dirs to accessing USB devices (e.g. for running fastboot)
|
||||
if args.chroot_usb:
|
||||
for folder in pmb.config.flash_mount_bind:
|
||||
pmb.helpers.mount.bind(folder, Chroot.native() / folder)
|
||||
|
||||
pmb.helpers.apk.update_repository_list(chroot.path, user_repository=True)
|
||||
|
||||
# Run the command as user/root
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue