Skip to content
Commits on Source (4)
hw-detect (1.138) UNRELEASED; urgency=medium
[ Cyril Brulebois ]
* Remove Christian Perrier from Uploaders, with many thanks for all
his contributions over the years! (Closes: #927504)
[ Raphaël Hertzog ]
* Add finish-install.d/08hw-detect.sh to install virtualization related
packages when virtualization is detected. (Closes: #782287)
* Bump dependency on di-utils to >= 1.132~
We want to ensure that modprobe gets disabled during package
installation. Without this, installation of virtualbox-guest-dkms
breaks the X server used by the graphical installer.
-- Cyril Brulebois <kibi@debian.org> Sat, 20 Apr 2019 22:34:47 +0200
hw-detect (1.137) unstable; urgency=medium
......
......@@ -10,7 +10,7 @@ Vcs-Git: https://salsa.debian.org/installer-team/hw-detect.git
Package: hw-detect
Package-Type: udeb
Architecture: any
Depends: rootskel (>= 1.30), archdetect, cdebconf-udeb (>= 0.75), di-utils (>= 1.73), pciutils-udeb, udpkg (>= 1.14)
Depends: rootskel (>= 1.30), archdetect, cdebconf-udeb (>= 0.75), di-utils (>= 1.132~), pciutils-udeb, udpkg (>= 1.14)
Description: Detect hardware and load kernel drivers for it
Package: ethdetect
......
#!/bin/sh
set -e
# This logic to detect virtualization technology is inspired
# from systemd-detect-virt (detect_vm() in src/basic/virt.c)
detect_virt_dmi_entry() {
local entry=$1
if [ ! -e "$entry" ]; then
return
fi
case "$(cat $entry)" in
KVM*) echo "kvm";;
QEMU*) echo "qemu";;
VMware*) echo "vmware";;
VMW*) echo "vmware";;
innotek*) echo "oracle";;
Xen*) echo "xen";;
Bochs*) echo "bochs";;
Parallels*) echo "parallels";;
BHYVE*) echo "bhyve";;
esac
}
detect_virt_dmi() {
local path
local result
for path in /sys/class/dmi/id/product_name \
/sys/class/dmi/id/sys_vendor \
/sys/class/dmi/id/board_vendor \
/sys/class/dmi/id/bios_vendor; do
result=$(detect_virt_dmi_entry $path)
if [ -n "$result" ]; then
echo "$result"
return
fi
done
}
log() {
logger -t hw-detect "$@"
}
mount_sys_and_proc() {
local to_umount=""
if [ ! -e /target/sys/class ]; then
mount -t sysfs none /target/sys
to_umount="/target/sys"
fi
if [ ! -e /target/proc/sys ]; then
mount -t proc none /target/proc
to_umount="$to_umount /target/proc"
fi
echo "$to_umount"
}
detect_virt() {
# First try to use systemd-detect-virt, it knows a lot more.
if [ -x /target/usr/bin/systemd-detect-virt ]; then
to_umount=$(mount_sys_and_proc)
virt=$(chroot /target systemd-detect-virt || true)
for path in $to_umount; do
umount $path || true
done
log "detected virtualization '$virt' (with systemd-detect-virt)"
fi
# Otherwise, rely on DMI information
if [ -z "$virt" ]; then
virt=$(detect_virt_dmi)
log "detected virtualization '$virt' (with DMI data)"
fi
echo -n "$virt"
}
detect_desktop() {
if chroot /target dpkg-query -W -f='${db:Status-Status}\n' \
xserver-xorg-core task-desktop | grep -q ^installed; then
return 0
fi
return 1
}
case "$(detect_virt)" in
vmware)
if detect_desktop; then
apt-install --with-recommends open-vm-tools-desktop || true
else
apt-install --with-recommends open-vm-tools || true
fi
;;
oracle)
if detect_desktop; then
apt-install --with-recommends virtualbox-guest-x11 || true
else
apt-install --with-recommends virtualbox-guest-utils || true
fi
;;
microsoft)
apt-install --with-recommends hyperv-daemons || true
;;
kvm|qemu)
apt-install --with-recommends qemu-guest-agent || true
;;
xen)
# XXX: do we need anything for Xen?
;;
esac
#!/bin/sh
set -e
# This file is modified at run-time by hw-detect.sh to execute
# commands at the end of the installation process.