From 704fa1b0aaf4c60a50f02586f7ec12a4452e3cf6 Mon Sep 17 00:00:00 2001 From: Matt Knoop Date: Sun, 16 Nov 2025 20:49:44 -0700 Subject: [PATCH] updates nov 16th. --- build_filesystem.sh | 10 ++++++++++ container_cmd.sh | 1 + create_image.sh | 11 ++++++++++- init.sh | 9 +++++++-- 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100755 build_filesystem.sh diff --git a/build_filesystem.sh b/build_filesystem.sh new file mode 100755 index 0000000..464895c --- /dev/null +++ b/build_filesystem.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e +cd "$(dirname "$0")" +dir=$(dirname "$0") +echo $dir +podman run --rm -d --name ubuntu ubuntu:latest /bin/bash -c "while true; do sleep 1; done" +podman export -o ./ubuntu.tar ubuntu +echo 'exported.' +podman stop ubuntu + diff --git a/container_cmd.sh b/container_cmd.sh index 1ae0403..194e3b1 100644 --- a/container_cmd.sh +++ b/container_cmd.sh @@ -12,4 +12,5 @@ echo "CONFIG_EFI=y" >> ./.config echo "CONFIG_SYSFB=y" >> ./.config echo "CONFIG_FB=y" >> ./.config echo "CONFIG_FRAMEBUFFER_CONSOLE=y" >> ./.config +/usr/bin/make olddefconfig /usr/bin/make -j ${cores} diff --git a/create_image.sh b/create_image.sh index b5e26b5..a29eeaf 100755 --- a/create_image.sh +++ b/create_image.sh @@ -1,4 +1,8 @@ #!/bin/bash +if [ "$(id -u)" -ne 0 ]; then + echo "switching from $(id -un) to root" + exec sudo "$0" "$@" +fi set -e cd "$(dirname "$0")" dir=$(dirname "$0") @@ -35,7 +39,8 @@ mkdir -p $dir/mnt/ mkdir -p $dir/mnt/{efi,sys,grub} mount -t vfat /dev/mapper/${disk_efi} $dir/mnt/efi mount -t ext4 /dev/mapper/${disk_sys} $dir/mnt/sys - +tar -xvf ./ubuntu.tar --directory ./mnt/sys/ +rm ./ubuntu.tar #--grub-mkdevicemap=$dir/mnt/device.map #echo "(hd0) /dev/${disk_grub}" > $dir/mnt/device.map #--efi-directory=$dir/mnt/efi --boot-directory=$dir/mnt/grub --root-directory=$dir/mnt/sys @@ -57,6 +62,10 @@ cp $dir/initramfs.cpio.gz $dir/mnt/efi/EFI/patronage/ cp $dir/grub.cfg $dir/mnt/efi/EFI/patronage/ #cp $dir/grub.cfg $dir/mnt/sys/boot/grub/ cp $dir/grub.cfg $dir/mnt/efi/EFI/BOOT/ + + + + sync #exit if mountpoint -q "$dir/mnt/efi"; then diff --git a/init.sh b/init.sh index 85a1eb8..99c85e8 100644 --- a/init.sh +++ b/init.sh @@ -1,8 +1,13 @@ #!/bin/busybox sh /bin/busybox mount -t devtmpfs devtmpfs /dev -/bin/busybox mount -t proc none /proc +/bin/busybox mount -t proc proc /proc /bin/busybox mount -t sysfs none /sys +/bin/busybox mount -t sysfs none /run +/bin/busybox mkdir -p /newroot +/bin/busybox mount /dev/sda2 /newroot #/bin/busybox ln -s "/lib/modules/" "/lib/modules/$(uname -r)" #depmod -a #/bin/busybox modprobe nbd max_part=2 -exec /bin/busybox sh + +exec switch_root /newroot /bin/bash +#exec /bin/busybox sh