[setup] Ask whether this is a VM; install qemu-guest-agent

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Fabian IsingandClaude Opus 5.5 committed 2026-10-19 12:06:00 +02:00
1 parent 9951ecf7a4
commit eff5309ae9
2 files changed
+26

No files matched your search

+13
View File
@@ -11,6 +11,19 @@ sudo apt -y update
sudo apt -y dist-upgrade
sudo apt -y install curl zsh tmux virtualenvwrapper powerline fonts-powerline python3 python3-pip python3-pynvim fzf
sudo snap install --classic nvim
# VMs: the guest agent lets the hypervisor read OS info (virsh guestinfo --os)
default=N; [[ $(systemd-detect-virt 2>/dev/null) == @(kvm|qemu) ]] && default=Y
read -r -p "Is this a VM? [$( [[ $default == Y ]] && echo Y/n || echo y/N )] " vm
if [[ ${vm:-$default} == [yY]* ]]; then
sudo apt -y install qemu-guest-agent
# Static unit, started by udev; it only runs if the VM defines the channel
if [[ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]]; then
sudo systemctl start qemu-guest-agent
else
echo "No guest agent channel: add org.qemu.guest_agent.0 to the VM definition" >&2
fi
fi
./clone_and_link.sh; true
if [ $SHELL != "/bin/zsh" ]; then
chsh -s /usr/bin/zsh;
+13
View File
@@ -9,6 +9,19 @@ sudo apt -y update
sudo apt -y dist-upgrade
sudo apt -y install curl zsh tmux virtualenvwrapper powerline fonts-powerline python3 python3-pip python3-pynvim fzf
sudo snap install --classic nvim
# VMs: the guest agent lets the hypervisor read OS info (virsh guestinfo --os)
default=N; [[ $(systemd-detect-virt 2>/dev/null) == (kvm|qemu) ]] && default=Y
read -r "vm?Is this a VM? [$( [[ $default == Y ]] && echo Y/n || echo y/N )] "
if [[ ${vm:-$default} == [yY]* ]]; then
sudo apt -y install qemu-guest-agent
# Static unit, started by udev; it only runs if the VM defines the channel
if [[ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]]; then
sudo systemctl start qemu-guest-agent
else
echo "No guest agent channel: add org.qemu.guest_agent.0 to the VM definition" >&2
fi
fi
./clone_and_link.sh shared; true
if [ $SHELL != "/bin/zsh" ]; then
chsh -s /usr/bin/zsh;