diff -u cloud-init-0.5.10/debian/update-grub-legacy-ec2 cloud-init-0.5.10/debian/update-grub-legacy-ec2 --- cloud-init-0.5.10/debian/update-grub-legacy-ec2 +++ cloud-init-0.5.10/debian/update-grub-legacy-ec2 @@ -1396,6 +1396,13 @@ ucfr grub $ucf_menu_file fi +if [ "$indomU" = "detect" ]; then + if [ -e /proc/xen/capabilities ] && ! grep -q "control_d" /proc/xen/capabilities; then + indomU="true" + else + indomU="false" + fi +fi if ! type is_xen_kernel >/dev/null 2>&1; then is_xen_kernel() { @@ -1407,6 +1414,12 @@ local ver="" ver=${1##*/}; ver=${ver#vmlinuz-}; ver=${ver%-virtual}; dpkg --compare-versions ${ver} gt 2.6.35-13 && return 0 + ;; + *) + local ver="" + ver=${1##*/}; ver=${ver#vmlinuz-}; + test ! -f /boot/config-$ver && return 1 + grep -q 'CONFIG_XEN=y' /boot/config-$ver && return 0 esac return 1; } @@ -1418,6 +1431,22 @@ done xen_verlist=${xen_verlist# } +# +# If the linux-ec2 meta-package is installed and we are in domU, then +# the image that this package points to should be first (this will allow +# to pull installs on and off the virtual kernel by modifying the meta- +# package). +# +latestEC2="" +if $indomU && dpkg -l linux-ec2 >/dev/null 2>&1; then + latestEC2="$(dpkg-query -W -f'${Depends}' linux-image-ec2 | + awk 'match($0, /linux-image-[^,]*/){ + print substr($0, RSTART, RLENGTH) + }' + )" + latestEC2="$(dpkg -L $latestEC2|grep '/boot/vmlinuz')" +fi + xenKernels="" for ver in ${xen_verlist}; do # ver is a kernel version @@ -1441,27 +1470,18 @@ done xenKernels=" ${xenKernels} " -if [ "$indomU" = "detect" ]; then - if [ -e /proc/xen/capabilities ] && ! grep -q "control_d" /proc/xen/capabilities; then - indomU="true" - else - indomU="false" - fi -fi - sortedKernels="" for kern in $(/bin/ls -1vr /boot | grep -v "dpkg-*" | grep "^vmlinuz-") ; do - if `echo "$xenKernels" | grep -q "$kern "` || `echo "$kern" | grep -q "xen"`; then - is_xen=1 - else - is_xen= - fi + case $kern in + ec2) is_ec2=true;; + *) is_ec2=false;; + esac - if [ "$indomU" = "false" ] && [ "$is_xen" ]; then + if [ "$indomU" = "false" ] && [ "$is_ec2" ]; then # We aren't running in a Xen domU, skip xen kernels echo "Ignoring Xen kernel on non-Xen host: $kern" continue - elif [ "$indomU" = "true" ] && ! [ "$is_xen" ]; then + elif [ "$indomU" = "true" ] && ! is_xen_kernel $kern; then # We are running in a Xen domU, skip non-xen kernels echo "Ignoring non-Xen Kernel on Xen domU host: $kern" continue @@ -1470,7 +1490,11 @@ kern="/boot/$kern" newerKernels="" for i in $sortedKernels ; do - res=$(CompareVersions "$kern" "$i") + if [ "$kern" != "" -a "$kern" = "$latestEC2" ]; then + res=1 + else + res=$(CompareVersions "$kern" "$i") + fi if [ "$kern" != "" ] && [ "$res" -gt 0 ] ; then newerKernels="$newerKernels $kern $i" kern="" diff -u cloud-init-0.5.10/debian/changelog cloud-init-0.5.10/debian/changelog --- cloud-init-0.5.10/debian/changelog +++ cloud-init-0.5.10/debian/changelog @@ -1,3 +1,11 @@ +cloud-init (0.5.10-0ubuntu1.8) lucid-proposed; urgency=low + + * Add ability to select the kernel which linux-image-ec2 provices + as the first kernel when running in a domU and linux-ec2 is also + installed (LP: #1176159) + + -- Stefan Bader Tue, 11 Jun 2013 16:04:06 +0200 + cloud-init (0.5.10-0ubuntu1.7) lucid-proposed; urgency=low * add ability to configure Acquire::http::Pipeline-Depth via