Making the filesystems but copying files is failing.

This commit is contained in:
Tom Alexander 2022-02-26 16:30:07 -05:00
parent 8df79dfc4f
commit e57607b3be
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -11,17 +11,17 @@ function cleanup {
>&2 echo "Stopping jail $f"
sudo jail -r "$f"
done
for f in "${mountedfolders[@]}"; do
>&2 echo "Unmounting folder $f"
umount "$f"
for (( idx=${#mountedfolders[@]}-1 ; idx>=0 ; idx-- )) ; do
>&2 echo "Unmounting folder ${mountedfolders[idx]}"
sudo umount "${mountedfolders[idx]}"
done
for f in "${memorydevices[@]}"; do
>&2 echo "Removing memory device $f"
mdconfig -d -u "$f"
sudo mdconfig -d -u "$f"
done
for f in "${folders[@]}"; do
>&2 echo "Deleting $f"
sudo rm -rf "$f"
# sudo rm -rf "$f"
done
}
folders=()
@ -131,7 +131,7 @@ function precheck {
die 1 "Need linux kernel module for building initramfs."
fi
for bin in gpg sha256; do
for bin in gpg sha256 mkfs.ext4; do
if ! command -V "$bin" &> /dev/null; then
die 1 "Need $bin installed."
fi
@ -187,10 +187,31 @@ EOF
function make_image {
dd if=/dev/zero of="$image_file" bs=1 count=0 seek=10G
# image_device=$(mdconfig -a -t vnode -f "$image_file")
local image_device=$(mdconfig -f "$image_file")
local image_device
# image_device=$(sudo mdconfig -a -t vnode -f "$image_file")
image_device=$(sudo mdconfig -f "$image_file")
memorydevices+=("$image_device")
efi_partition="${image_device}p1"
data_partition="${image_device}p2"
sudo gpart create -s gpt "$image_device"
sudo gpart add -t efi -l efi -a4k -s492k "$image_device"
sudo newfs_msdos "${efi_partition}"
sudo gpart add -t linux-data -l DIB -a4k "$image_device"
sudo mkfs.ext4 "/dev/${data_partition}"
sudo mount -t ext2fs "/dev/${data_partition}" "${mount_directory}"
mountedfolders+=("$mount_directory")
boot_directory="${mount_directory}/boot"
sudo mkdir -p "$boot_directory"
sudo mount_msdosfs "/dev/${efi_partition}" "${boot_directory}"
mountedfolders+=("$boot_directory")
sudo cp -pr "${chroot}/*" "${mount_directory}/"
# mount -t ext2fs /dev/ada1s1 /mnt
# mountedfolders+=("$mount_directory")
}