From fe1abd115324d2e706626ed567d1f234fd300e64 Mon Sep 17 00:00:00 2001 From: Joseph Bisch Date: Thu, 12 Nov 2015 10:05:58 -0500 Subject: [PATCH 1/5] Fix flavour for i386 arch Wheezy on up has linux-image-686-pae. Squeeze on down has linux-image-686. --- bin/make-base-vm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/make-base-vm b/bin/make-base-vm index e886a56..10f1db0 100755 --- a/bin/make-base-vm +++ b/bin/make-base-vm @@ -94,8 +94,10 @@ fi if [ $DISTRO = "debian" -a $ARCH = "amd64" ]; then FLAVOUR=amd64 -elif [ $DISTRO = "debian" -a $ARCH = "i386" ]; then - FLAVOUR=i686-pae +elif [ $DISTRO = "debian" -a $ARCH = "i386" -a \($SUITE = "wheezy" -o $SUITE = "jessie" -o $SUITE = "stretch" -o $SUITE = "sid"\) ]; then + FLAVOUR=686-pae +elif [ $DISTRO = "debian" ]; then + FLAVOUR=686 fi LOCALE_PKG=language-pack-en From 4f69707c4df4224506a64b760cbd4fd14eb83c8f Mon Sep 17 00:00:00 2001 From: Joseph Bisch Date: Thu, 12 Nov 2015 12:42:58 -0500 Subject: [PATCH 2/5] Fix issue with apt in Debian <= Squeeze --- bin/make-base-vm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/make-base-vm b/bin/make-base-vm index 10f1db0..056072a 100755 --- a/bin/make-base-vm +++ b/bin/make-base-vm @@ -107,15 +107,18 @@ fi addpkg=pciutils,build-essential,git-core,subversion,$LOCALE_PKG,wget,lsb-release -KERNEL_PKG=linux-image-generic -if [ $DISTRO = "debian" ]; then - KERNEL_PKG= +if [ $DISTRO = "ubuntu" ]; then + # Need comma at end to work around an issue with apt for Debian <= Squeeze regarding empty strings + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744940 + # http://anonscm.debian.org/cgit/apt/apt.git/commit/?h=1.0.3&id=d99854cac4065bc7b337815fb2116269d58dab73 + KERNEL_PKG=linux-image-generic, fi if [ $LXC = "1" ]; then addpkg=$addpkg,lxc else - addpkg=$addpkg,$KERNEL_PKG,grub-pc,openssh-server + # Lack of comma after KERNEL_PKG is not a typo + addpkg=$addpkg,${KERNEL_PKG}grub-pc,openssh-server fi # Remove cron to work around vmbuilder issue when umounting /dev on target From 5b7c52b2310e851251cf4222b1527ccb0cc3e791 Mon Sep 17 00:00:00 2001 From: Joseph Bisch Date: Fri, 13 Nov 2015 09:05:46 -0500 Subject: [PATCH 3/5] Swap Debian i386 flavour checks Check for older suites with 686 flavour before checking for 686-pae flavour suites, because the former should never change, but the latter would have to be changed whenever a new suite was released if it wasn't the last if statement. --- bin/make-base-vm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/make-base-vm b/bin/make-base-vm index 056072a..ddd2c54 100755 --- a/bin/make-base-vm +++ b/bin/make-base-vm @@ -94,10 +94,10 @@ fi if [ $DISTRO = "debian" -a $ARCH = "amd64" ]; then FLAVOUR=amd64 -elif [ $DISTRO = "debian" -a $ARCH = "i386" -a \($SUITE = "wheezy" -o $SUITE = "jessie" -o $SUITE = "stretch" -o $SUITE = "sid"\) ]; then - FLAVOUR=686-pae -elif [ $DISTRO = "debian" ]; then +elif [ $DISTRO = "debian" -a $ARCH = "i386" -a \($SUITE = "squeeze" -o $SUITE = "lenny" -o $SUITE = "etch" -o $SUITE = "sarge" -o $SUITE = "woody" -o $SUITE = "potato" -o $SUITE = "slink" -o $SUITE = "hamm" -o $SUITE = "bo" -o $SUITE = "rex" -o $SUITE = "buzz"\) ]; then FLAVOUR=686 +elif [ $DISTRO = "debian" ]; then + FLAVOUR=686-pae fi LOCALE_PKG=language-pack-en From 1aad9f407975e4b16426ba4243242224fd1a0dbd Mon Sep 17 00:00:00 2001 From: Joseph Bisch Date: Fri, 13 Nov 2015 09:22:19 -0500 Subject: [PATCH 4/5] Expand on apt issue/workaround and correct affected Debian suites --- bin/make-base-vm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/make-base-vm b/bin/make-base-vm index ddd2c54..8102951 100755 --- a/bin/make-base-vm +++ b/bin/make-base-vm @@ -108,7 +108,15 @@ fi addpkg=pciutils,build-essential,git-core,subversion,$LOCALE_PKG,wget,lsb-release if [ $DISTRO = "ubuntu" ]; then - # Need comma at end to work around an issue with apt for Debian <= Squeeze regarding empty strings + # Need comma at end to work around an issue with apt for Debian <= Wheezy regarding empty strings + # + # If we left the comma down below when adding KERNEL_PKG to addpkg, the fact that KERNEL_PKG is undefined + # if DISTRO is debian would result in two commas in a row (,,), which is interpreted by apt-get as the + # package with the name empty string (""). This triggers a bug with apt versions < 1.0.3. So by adding the + # comma to the end of KERNEL_PKG, we are including that comma if the distro is ubuntu (and therefore we do + # have a kernel package that needs to be installed). If KERNEL_PKG is not set (i.e. we have Debian as the + # distro), then we don't add that extra comma and therefore, we don't end up with two commas in a row. + # # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744940 # http://anonscm.debian.org/cgit/apt/apt.git/commit/?h=1.0.3&id=d99854cac4065bc7b337815fb2116269d58dab73 KERNEL_PKG=linux-image-generic, From 23ccc3d1dd64104c6358718303c1a5b48fa1f6c9 Mon Sep 17 00:00:00 2001 From: Joseph Bisch Date: Fri, 13 Nov 2015 10:04:50 -0500 Subject: [PATCH 5/5] Use grub package instead of grub-pc unless distro is ubuntu According to the Debian wiki, installing the package grub installs the correct version of grub for your suite automatically. This fixes a "you have held broken packages" error when creating the package manifest due to a conflict between grub-pc and grub-legacy (at least with Wheezy). --- bin/make-base-vm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/make-base-vm b/bin/make-base-vm index 8102951..b978a8e 100755 --- a/bin/make-base-vm +++ b/bin/make-base-vm @@ -122,11 +122,16 @@ if [ $DISTRO = "ubuntu" ]; then KERNEL_PKG=linux-image-generic, fi +GRUB_PKG=grub +if [ $DISTRO = "ubuntu" ]; then + GRUB_PKG=grub-pc +fi + if [ $LXC = "1" ]; then addpkg=$addpkg,lxc else # Lack of comma after KERNEL_PKG is not a typo - addpkg=$addpkg,${KERNEL_PKG}grub-pc,openssh-server + addpkg=$addpkg,${KERNEL_PKG}${GRUB_PKG},openssh-server fi # Remove cron to work around vmbuilder issue when umounting /dev on target