linux-image-manager/scripts/image/chroot.sh

32 lines
621 B
Bash
Raw Normal View History

2020-05-02 11:46:39 +02:00
#!/bin/bash
2020-05-15 10:41:44 +02:00
# shellcheck source=/dev/null # Deactivate SC1090
# shellcheck disable=SC2015 # Deactivating bool hint
2020-05-19 11:10:06 +02:00
# shellcheck disable=SC2154 # Deactivate not referenced link
2020-05-15 12:00:03 +02:00
source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh failed." && exit 1)
2020-05-15 10:41:44 +02:00
2020-05-15 12:23:07 +02:00
info "Starting chroot..."
set_device_path
2020-05-15 14:10:24 +02:00
make_working_folder
2020-05-15 10:41:44 +02:00
2020-05-15 14:10:24 +02:00
make_mount_folders
2020-05-15 12:23:07 +02:00
set_partition_paths
2020-05-15 12:00:03 +02:00
2020-05-15 14:10:24 +02:00
mount_partitions
2020-05-15 10:41:44 +02:00
2020-05-21 19:22:14 +02:00
mount_chroot_binds
2020-05-15 10:41:44 +02:00
2020-05-21 19:22:14 +02:00
copy_qemu
2020-05-15 10:41:44 +02:00
2020-05-21 19:22:14 +02:00
copy_resolve_conf
2020-05-15 18:11:30 +02:00
2020-05-21 19:22:14 +02:00
info "Bash shell starts..." &&
2020-05-15 12:00:03 +02:00
chroot "$root_mount_path" /bin/bash ||
2020-05-15 11:18:19 +02:00
error
2020-05-15 10:41:44 +02:00
info "unmount everything" &&
2020-05-15 12:00:03 +02:00
umount "$root_mount_path"/{dev/pts,dev,sys,proc,boot,} ||
2020-05-15 11:18:19 +02:00
error