From 5b6dce8527f40857e8a01cda7022b8ee2c45dfdf Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Fri, 14 Jun 2019 10:33:17 +0200 Subject: some more small network device fixes and using correct os-type for libvirt --- archauto.sh | 5 +---- createvm.sh | 50 +++++++++++++++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/archauto.sh b/archauto.sh index c4eb965..d2cde4f 100755 --- a/archauto.sh +++ b/archauto.sh @@ -106,7 +106,7 @@ echo ${HOSTNAME} > ${MOUNT_PATH}/etc/hostname cat > ${MOUNT_PATH}/etc/systemd/network/25-wired.network <>${MOUNT_PATH}/etc/ssh/sshd_config arch-chroot ${MOUNT_PATH} systemctl enable sshd -# some networking and debugging tools, decent editor -arch-chroot ${MOUNT_PATH} pacman --noconfirm -S iputils iproute2 joe - # maybe later, when pacman knows the Archlinux32 developer keys #sed -i 's/^SigLevel.*/SigLevel = Required DatabaseOptional/g' ${MOUNT_PATH}/etc/pacman.conf diff --git a/createvm.sh b/createvm.sh index f9e2511..3c9dd7e 100755 --- a/createvm.sh +++ b/createvm.sh @@ -26,7 +26,7 @@ mount -o loop,ro /data/arch32/mirror/archisos/archlinux-2019.03.07-i686.iso arch darkhttpd . --port 8088 & -virt-install --name ${NAME} -r 1536 --vcpus=1 --os-type=linux --os-variant=virtio26 \ +virt-install --name ${NAME} -r 1536 --vcpus=1 --os-type=linux --os-variant=archlinux \ --disk pool=default,size=4,format=qcow2 --network bridge=br0,model=virtio \ --arch i686 --cpu coreduo --graphics none \ --boot kernel=archiso/arch/boot/i686/vmlinuz,initrd=archiso/arch/boot/i686/archiso.img,kernel_args="archisobasedir=archiso/arch archiso_http_srv=http://${HOST}:8088/ script=http://${HOST}:8088/archauto.sh ip=${CLIENT}:::${NETMASK}:${NAME}::off nomodeset i915.modeset=0" & @@ -39,32 +39,40 @@ sleep 15 wait_for_vm_to_stop ${NAME} -virsh dumpxml ${NAME} > ${NAME}.xml +virsh dumpxml ${NAME} | xmllint -format - > ${NAME}.xml -xmlstarlet ed -d '/domain/os/kernel' ${NAME}.xml | xmlstarlet ed -d '/domain/os/initrd' | xmlstarlet ed -d '/domain/os/cmdline' > ${NAME}-new.xml +# remove explicit kernel used for installation, boot from hard disk via boot manager now +xmlstarlet ed \ + --inplace \ + --delete '/domain/os/kernel' \ + --delete '/domain/os/initrd' \ + --delete '/domain/os/cmdline' \ + ${NAME}.xml +# append VNC console (virt-install was with graphics=none, so we add it here) xmlstarlet ed \ - -a /domain/devices/rng -t elem -n graphics -v '' \ - -i /domain/devices/graphics \ - -t attr -n type -v vnc \ - -i /domain/devices/graphics \ - -t attr -n port -v 5909 \ - -i /domain/devices/graphics \ - -t attr -n autoport -v yes \ - -i /domain/devices/graphics \ - -t attr -n listen -v '0.0.0.0' \ - -s /domain/devices/graphics -t elem -n listen -v '' \ - -i /domain/devices/graphics/listen \ - -t attr -n type -v address \ - -i /domain/devices/graphics/listen \ - -t attr -n address -v '0.0.0.0' \ - ${NAME}-new.xml > ${NAME}-new2.xml - -virsh define ${NAME}-new2.xml + --inplace \ + --append /domain/devices/rng --type elem -n graphics --value '' \ + --insert /domain/devices/graphics \ + --type attr -n type --value vnc \ + --insert /domain/devices/graphics \ + --type attr -n port --value 5909 \ + --insert /domain/devices/graphics \ + --type attr -n autoport --value no \ + --insert /domain/devices/graphics \ + --type attr -n listen --value '0.0.0.0' \ + -s /domain/devices/graphics --type elem -n listen --value '' \ + --insert /domain/devices/graphics/listen \ + --type attr -n type --value address \ + --insert /domain/devices/graphics/listen \ + --type attr -n address --value '0.0.0.0' \ + ${NAME}.xml + +virsh define ${NAME}.xml virsh start ${NAME} -rm -f ${NAME}-new.xml ${NAME}.xml +rm -f ${NAME}.xml pkill darkhttpd umount archiso -- cgit v1.2.3-54-g00ecf