Commit 69a80e8c authored by Josua Mayer's avatar Josua Mayer

runme: fix nameserver within chroot

Change the ip configuration for the temporary VM to be performed
directly by the kernel; then copy the kernel reported resolv config to
rootfs + chroot.

This will avoid firewall issues that may be experienced in paranoid
homes, or coprorate networks where direct access to public DNS servers
is not allowed.
parent db443a11
......@@ -281,7 +281,7 @@ case "\$1" in
mkfs.ext4 -F /dev/vda -b 4096
mount /dev/vda /mnt
cd /mnt/
udhcpc -i eth0
cat /proc/net/pnp > /etc/resolv.conf
wget -c -P /tmp/ http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04.1-base-arm64.tar.gz
tar zxf /tmp/ubuntu-base-20.04.1-base-arm64.tar.gz -C /mnt
mount -o bind /proc /mnt/proc/
......@@ -290,7 +290,7 @@ case "\$1" in
mount -o bind /dev/pts /mnt/dev/pts
mount -t tmpfs tmpfs /mnt/var/lib/apt/
mount -t tmpfs tmpfs /mnt/var/cache/apt/
echo "nameserver 8.8.8.8" > /mnt/etc/resolv.conf
cat /proc/net/pnp > /mnt/etc/resolv.conf
echo "localhost" > /mnt/etc/hostname
echo "127.0.0.1 localhost" > /mnt/etc/hosts
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C
......@@ -310,7 +310,7 @@ EOF
make
IMG=ubuntu-core.ext4.tmp
truncate -s $ROOTFS_SIZE $IMG
qemu-system-aarch64 -m 1G -M virt -cpu cortex-a57 -nographic -smp 1 -kernel output/images/Image -append "console=ttyAMA0" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -initrd output/images/rootfs.cpio.gz -drive file=$IMG,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -no-reboot
qemu-system-aarch64 -m 1G -M virt -cpu cortex-a57 -nographic -smp 1 -kernel output/images/Image -append "console=ttyAMA0 ip=dhcp" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -initrd output/images/rootfs.cpio.gz -drive file=$IMG,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -no-reboot
mv $IMG $ROOTDIR/build/ubuntu-core.ext4
fi
......@@ -338,7 +338,7 @@ case "\$1" in
mkfs.ext4 -F /dev/vda -b 4096
mount /dev/vda /mnt
cd /tmp
udhcpc -i eth0
cat /proc/net/pnp > /etc/resolv.conf
wget http://deb.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.123.tar.gz
tar zxf debootstrap*.tar.gz
cd debootstrap
......@@ -356,7 +356,7 @@ case "\$1" in
mount -t tmpfs tmpfs /mnt/var/cache/apt/
debootstrap --no-check-certificate --verbose --arch arm64 --cache-dir=/tmp/cache --include=fdisk,e2fsprogs,isc-dhcp-client,ntpdate,sudo bullseye /mnt
#debootstrap --no-check-certificate --verbose --arch arm64 --cache-dir=/tmp/cache --include=locales,less,wget,procps,openssh-server,ifupdown,net-tools,isc-dhcp-client,ntpdate,lm-sensors,i2c-tools,psmisc,sudo,htop,iproute2,iputils-ping,kmod,network-manager,iptables,rng-tools,apt-utils bullseye /mnt
echo "nameserver 8.8.8.8" > /mnt/etc/resolv.conf
cat /proc/net/pnp > /mnt/etc/resolv.conf
echo "localhost" > /mnt/etc/hostname
echo "127.0.0.1 localhost" > /mnt/etc/hosts
echo -e "root\nroot" | chroot /mnt passwd
......@@ -371,7 +371,7 @@ EOF
make
IMG=debian-bullseye.ext4.tmp
truncate -s 350M $IMG
qemu-system-aarch64 -m 1G -M virt -cpu cortex-a57 -nographic -smp 1 -kernel output/images/Image -append "console=ttyAMA0" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -initrd output/images/rootfs.cpio.gz -drive file=$IMG,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -no-reboot
qemu-system-aarch64 -m 1G -M virt -cpu cortex-a57 -nographic -smp 1 -kernel output/images/Image -append "console=ttyAMA0 ip=dhcp" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -initrd output/images/rootfs.cpio.gz -drive file=$IMG,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -no-reboot
mv $IMG $ROOTDIR/build/debian-bullseye.ext4
fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment