From b2d0904a139ab839c65b6f26dba1ee6a27490937 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 25 May 2019 11:48:56 +0200 Subject: small fixes --- README | 8 ++++---- archauto.sh | 26 ++++++++++++++++++++++---- createvm.sh | 14 +++++--------- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/README b/README index 5722245..7790c07 100644 --- a/README +++ b/README @@ -16,10 +16,10 @@ local network: # hangs!? why!? #ip link add name br0 type bridge -#ip addr add dev br0 192.168.130.1/24 +#ip addr add dev br0 192.168.120.1/24 brctl addbr br0 ip link set br0 up -ip addr add dev br0 192.168.130.1/24 +ip addr add dev br0 192.168.120.1/24 # We mount it and make it accessible over the 'darkhttpd' webserver: @@ -64,7 +64,7 @@ qemu-img create arch32.img 2G qemu-system-i386 -drive file=arch32.img,index=0,media=disk,format=raw,if=virtio -net nic \ -enable-kvm \ - -net user,id=net0,net=192.168.130.2/24,host=192.168.130.1,tftp=$PWD/tftproot,bootfile=pxelinux.0 \ + -net user,id=net0,net=192.168.120.101/24,host=192.168.120.1,tftp=$PWD/tftproot,bootfile=pxelinux.0 \ -m 2048 \ -machine accel=kvm -redir tcp:2222::22 @@ -74,7 +74,7 @@ qemu-system-i386 -drive file=arch32.img,index=0,media=disk,format=raw,if=virtio qemu-system-i386 -drive file=arch32.img,index=0,media=disk,format=raw,if=virtio -net nic \ -enable-kvm \ - -net user,id=net0,net=192.168.130.2/24,host=192.168.130.1 \ + -net user,id=net0,net=192.168.120.101/24,host=192.168.120.1 \ -m 2048 \ -machine accel=kvm -redir tcp:2222::22 diff --git a/archauto.sh b/archauto.sh index 4f8ce69..d478355 100755 --- a/archauto.sh +++ b/archauto.sh @@ -1,5 +1,9 @@ #!/bin/bash +# enable for debugging (single stepping line by line) +#set -x +#trap read debug + exec > >(tee -i logfile.txt) exec 2>&1 @@ -10,13 +14,22 @@ PARTITION_BOOT=1 PARTITION_ROOT=2 LABEL_ROOT=ROOT MOUNT_PATH=/mnt -HOST=192.168.130.1 +HOST=192.168.120.1 HTTP_SERVER=http://${HOST}:8088 -IP=192.168.130.2 +IP=192.168.120.101 +NETWORK=192.168.120.0 NETMASK=255.255.255.0 PREFIX=24 HOSTNAME=arch32 +# set up networking +ip addr add dev eth0 ${IP} +ip route add to ${NETWORK}/${PREFIX} dev eth0 via ${HOST} +ip route add to default dev eth0 via ${HOST} +cat > /etc/resolv.conf <${MOUNT_PATH}/etc/pacman.d/mirrorlist < ${MOUNT_PATH}/etc/fstab @@ -74,8 +90,8 @@ genfstab -L -p ${MOUNT_PATH} > ${MOUNT_PATH}/etc/fstab echo "Installing boot loader.." arch-chroot ${MOUNT_PATH} pacman --noconfirm -S grub -arch-chroot ${MOUNT_PATH} grub-mkconfig -o /boot/grub/grub.cfg arch-chroot ${MOUNT_PATH} grub-install --force /dev/vda +arch-chroot ${MOUNT_PATH} grub-mkconfig -o /boot/grub/grub.cfg echo "Configuring base system.." @@ -97,6 +113,8 @@ Address=${IP}/${PREFIX} Gateway=${HOST} EOF +ln -sf ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf + arch-chroot ${MOUNT_PATH} systemctl enable systemd-networkd arch-chroot ${MOUNT_PATH} systemctl enable systemd-resolved diff --git a/createvm.sh b/createvm.sh index cf84f67..3290a95 100755 --- a/createvm.sh +++ b/createvm.sh @@ -3,10 +3,10 @@ # configuration NAME=arch32 -HOST=192.168.130.1 +HOST=192.168.120.1 NETMASK=255.255.255.0 PREFIX=24 -CLIENT=192.168.130.2 +CLIENT=192.168.120.101 vm_is_running() { if [ "$(virsh domstate $1 2>/dev/null)" == "running" ]; then @@ -22,12 +22,9 @@ wait_for_vm_to_stop() { done } -mount -o loop,ro mirror/archisos/archlinux-2018.08.01-i686.iso archiso +mount -o loop,ro /data/arch32/mirror/archisos/archlinux-2019.03.07-i686.iso archiso -cp archiso/arch/boot/i686/vmlinuz . -cp archiso/arch/boot/i686/archiso.img . - -#darkhttpd . --port 8088 & +darkhttpd . --port 8088 & virt-install --name ${NAME} -r 1536 --vcpus=1 --os-type=linux --os-variant=virtio26 \ --disk pool=default,size=4,format=qcow2 --network bridge=br0,model=virtio \ @@ -36,7 +33,6 @@ virt-install --name ${NAME} -r 1536 --vcpus=1 --os-type=linux --os-variant=virti sleep 15 -exit 0 virsh start ${NAME} sleep 15 @@ -53,5 +49,5 @@ virsh start ${NAME} rm -f ${NAME}-new.xml ${NAME}.xml -#pkill darkhttpd +pkill darkhttpd umount archiso -- cgit v1.2.3-54-g00ecf