logMessage Script $0 starting
-# To avoid UDP checksum problems.
-
-installDebianPackage ${prefix} ethtool
-
#
# Install the xen kernel. linux-image-xen is in ubuntu,
-# linux-image-xen-amd64 in debian.
-installDebianPackage ${prefix} linux-image-xen
-installDebianPackage ${prefix} linux-image-xen-amd64
+# linux-image-xen-{amd64,686} in debian.
+#
+
+# First we need to figure out whether we're dealing with Debian or
+# Ubuntu. Unfortunately, Debian doesn't install lsb_release by
+# default, and its lsb-release package Recommends a bunch of stuff
+installDebianPackage ${prefix} -o="Apt::Install-Recommends=false" lsb-release
+if [ "Debian" = "$(chroot ${prefix} lsb_release -si)" ]; then
+ # One of these exists in the amd64 repo, and one of them exists in
+ # the i386 repo. The one that doesn't exist won't get installed
+ installDebianPackage ${prefix} linux-image-xen-amd64
+ installDebianPackage ${prefix} linux-image-xen-686
+else
+ installDebianPackage ${prefix} linux-image-xen
+fi
installDebianPackage ${prefix} grub