logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>
commit: b2747cb6cff590a750c06c5a5da7da4d65caa876
parent f51fb080b1a6b023f58206f1e7934e3dd1b7770b
Author: fosslinux <fosslinux@aussies.space>
Date:   Wed, 10 Jan 2024 07:16:32 +0000

Merge pull request #392 from Googulator/bare-metal-move-disk

Make move_disk work on bare metal

Diffstat:

Msteps/jump/move_disk.sh16++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/steps/jump/move_disk.sh b/steps/jump/move_disk.sh @@ -10,13 +10,25 @@ mkdir -p /dev /etc mount -t devtmpfs none /dev &> /junk || true # no /dev/null yet rm /junk &> /dev/null || true +timeout=120 +while ! dd if=/dev/${DISK} of=/dev/null bs=512 count=1; do + sleep 1 + # shellcheck disable=SC2219 + let timeout-- + if [ "${timeout}" -le 0 ]; then + echo "Timeout reached for disk to become accessible" + false + fi +done + # Create partition if it doesn't exist if [ $(($(stat -c "%Lr" "/dev/${DISK}") % 8)) -eq 0 ]; then echo "Creating partition table..." - echo ";" | sfdisk "/dev/${DISK}" + # Start at 1GiB, use -S32 -H64 to align to MiB rather than cylinder boundary + echo "2097152;" | sfdisk -uS -S32 -H64 --force "/dev/${DISK}" fdisk -l "/dev/${DISK}" echo "Creating ext4 partition..." - mkfs.ext4 "/dev/${DISK}1" + mkfs.ext4 -F -F "/dev/${DISK}1" DISK="${DISK}1" fi