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" >&2 echo "Stopping jail $f"
sudo jail -r "$f" sudo jail -r "$f"
done done
for f in "${mountedfolders[@]}"; do for (( idx=${#mountedfolders[@]}-1 ; idx>=0 ; idx-- )) ; do
>&2 echo "Unmounting folder $f" >&2 echo "Unmounting folder ${mountedfolders[idx]}"
umount "$f" sudo umount "${mountedfolders[idx]}"
done done
for f in "${memorydevices[@]}"; do for f in "${memorydevices[@]}"; do
>&2 echo "Removing memory device $f" >&2 echo "Removing memory device $f"
mdconfig -d -u "$f" sudo mdconfig -d -u "$f"
done done
for f in "${folders[@]}"; do for f in "${folders[@]}"; do
>&2 echo "Deleting $f" >&2 echo "Deleting $f"
sudo rm -rf "$f" # sudo rm -rf "$f"
done done
} }
folders=() folders=()
@ -131,7 +131,7 @@ function precheck {
die 1 "Need linux kernel module for building initramfs." die 1 "Need linux kernel module for building initramfs."
fi fi
for bin in gpg sha256; do for bin in gpg sha256 mkfs.ext4; do
if ! command -V "$bin" &> /dev/null; then if ! command -V "$bin" &> /dev/null; then
die 1 "Need $bin installed." die 1 "Need $bin installed."
fi fi
@ -187,10 +187,31 @@ EOF
function make_image { function make_image {
dd if=/dev/zero of="$image_file" bs=1 count=0 seek=10G 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
local image_device=$(mdconfig -f "$image_file") # image_device=$(sudo mdconfig -a -t vnode -f "$image_file")
image_device=$(sudo mdconfig -f "$image_file")
memorydevices+=("$image_device") 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") # mountedfolders+=("$mount_directory")
} }