Add options for;

- disk to be created (blank disk given to live-bootstrap) (default)
- disk to already exist but sources downloaded within live-bootstrap
- sources to be downloaded outside live-bootstrap (non-blank disk given
  to live-bootstrap)

Also migrate sysb to use sys_transfer in QEMU mode also.

Note that this means copy_sysc is now irrelevant. sysc is *always*
sourced from sysa.
This commit is contained in:
fosslinux 2022-05-22 10:03:21 +10:00
parent 6ea1b8e295
commit 0ce50a6393
9 changed files with 219 additions and 51 deletions

View file

@ -7,7 +7,31 @@
set -e
. /usr/src/helpers.sh
export PATH=/usr/bin
export PREFIX=/usr
export SOURCES=/usr/src
echo
echo "Installing packages into sysb"
install_tar() {
echo "${1}: installing package"
src_apply_tar "$@"
}
# Install needed packages.
install_tar coreutils-5.0 0
install_tar sed-4.0.9 0
install_tar bzip2-1.0.8 0
install_tar coreutils-6.10 0
install_tar e2fsprogs-1.45.7 0
install_tar grep-2.4 0
install_tar kexec-tools-2.0.22 0
install_tar util-linux-2.19.1 0
# Begin sysb bootstrapping process
mv ./run.sh /usr/src
cd /usr/src
./run.sh

View file

@ -34,10 +34,15 @@ create_hdx
ask_disk() {
echo
echo "What disk would you like to use for live-bootstrap?"
echo "(live-bootstrap assumes you have pre-prepared the disk)."
echo "Please provide in format sdxx (as you would find under /dev)."
echo "This disk may have pre-prepared sources on it."
echo "If there is no partition we will make one".
echo "Please provide in format sdxx (as you would find under /dev),"
echo "or sdx if it is a blank disk. An ext4 partition is expected on"
echo "existing disks."
echo "You can type 'list' to get a list of disks to help you figure"
echo "out which is the right disk."
echo "NO WARRANTY IS PROVIDED FOR BUGGY BEHAVIOUR, INCLUDING THAT"
echo "REGARDING DISKS & DATA."
echo
read -r DISK
@ -57,6 +62,15 @@ if [ -z "${DISK}" ] || ! [ -e "/dev/${DISK}" ]; then
echo "DISK=${DISK}" >> /usr/src/bootstrap.cfg
fi
if [ -z "$(fdisk -l "/dev/${DISK}" | grep -E "${DISK}p?[0-9]")" ]; then
echo "Creating partition table and partition"
echo ";" | sfdisk "/dev/${DISK}"
mkfs.ext4 "/dev/${DISK}1"
DISK="${DISK}1"
fi
echo "export DISK=${DISK}" >> /usr/src/bootstrap.cfg
PREFIX=/usr
SOURCES="${PREFIX}/src"
SYSC=/sysc
@ -68,7 +82,7 @@ mount -t ext4 "/dev/${DISK}" /sysc
# Copy over appropriate data
echo "Copying data into sysc"
sys_transfer "${SYSC}" gzip patch
sys_transfer "${SYSC}" /sysc_src gzip patch
sync
# switch_root into sysc 1. for simplicity 2. to avoid kexecing again