From 9fadf2c64882f8ffe3c5cc7698f2fc9b85733521 Mon Sep 17 00:00:00 2001
From: Oliver Grawert <ogra@ubuntu.com>
Date: Sun, 10 Apr 2016 17:23:05 +0200
Subject: [PATCH] Import patches-unapplied version 2.399 to
 ubuntu/xenial-proposed

Imported using git-ubuntu import.

Changelog parent: 01521cefe4108a2a62c47eb2bdbc978a70f0ed20

New changelog entries:
  [ Oliver Grawert ]
  * live-build/ubuntu-core/hooks/25-create-generic-initrd.chroot:
    kill the snappy os build if the initramfs-tools-ubuntu-core package
    is not found
  * make s390x known to the snappy builds
  * skip kernel snap an device tarball builds for s390x and ppc64el
  * drop listing of the device tarballs, this was only for debugging
  [ Adam Conrad ]
  * live-build/ubuntu-cpc/hooks/032-disk-image.binary: Install s390-tools
    and sysconfig-hardware before we attempt to configure zipl.
---
 debian/changelog                                 | 16 ++++++++++++++++
 live-build/auto/build                            |  8 +++++---
 .../hooks/25-create-generic-initrd.chroot        |  3 +++
 .../ubuntu-cpc/hooks/032-disk-image.binary       |  1 +
 4 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 45fde6b4..1709a4f6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,19 @@
+livecd-rootfs (2.399) xenial; urgency=medium
+
+  [ Oliver Grawert ]
+  * live-build/ubuntu-core/hooks/25-create-generic-initrd.chroot:
+    kill the snappy os build if the initramfs-tools-ubuntu-core package
+    is not found
+  * make s390x known to the snappy builds
+  * skip kernel snap an device tarball builds for s390x and ppc64el
+  * drop listing of the device tarballs, this was only for debugging
+
+  [ Adam Conrad ]
+  * live-build/ubuntu-cpc/hooks/032-disk-image.binary: Install s390-tools
+    and sysconfig-hardware before we attempt to configure zipl.
+
+ -- Oliver Grawert <ogra@ubuntu.com>  Sun, 10 Apr 2016 17:23:05 +0200
+
 livecd-rootfs (2.398) xenial; urgency=medium
 
   * switch snappy package builds from "snappy build" to "snapcraft snap"
diff --git a/live-build/auto/build b/live-build/auto/build
index 1e619edb..391f616d 100755
--- a/live-build/auto/build
+++ b/live-build/auto/build
@@ -379,7 +379,7 @@ case $PROJECT:$SUBPROJECT in
           arm64)
             subarches="generic dragonboard"
             ;;
-          i386|amd64|powerpc|ppc64el)
+          i386|amd64|powerpc|ppc64el|s390x)
             subarches="generic"
             ;;
       esac
@@ -410,6 +410,10 @@ case $PROJECT:$SUBPROJECT in
                   linux_package="linux-image-4.4.0-1009-snapdragon dragon410c-firmware"
               fi
               ;;
+            ppc64el|s390x)
+              echo "I: skipping kernel and device tarball for $ARCH"
+              return
+              ;;
         esac
 
         # make sure all virtual filesystems are available
@@ -586,8 +590,6 @@ EOF
       done
     fi
 
-    ls -l *device.tar.gz
-
     LB_LINUX_FLAVOURS=none
     ;;
 esac
diff --git a/live-build/ubuntu-core/hooks/25-create-generic-initrd.chroot b/live-build/ubuntu-core/hooks/25-create-generic-initrd.chroot
index 896cfa48..c967bc7c 100755
--- a/live-build/ubuntu-core/hooks/25-create-generic-initrd.chroot
+++ b/live-build/ubuntu-core/hooks/25-create-generic-initrd.chroot
@@ -5,6 +5,9 @@ set -ex
 IVER="$(dpkg -s initramfs-tools-ubuntu-core | \
 			sed -n '/^Version:/{s/^[^: ]*: \([^: ]*\).*/\1/;p;}')"
 
+# fail the build if we did not find the snappy initrd package
+[ -n "$IVER" ] || exit 1
+
 # force lzma
 mkdir -p /etc/initramfs-tools/conf.d
 echo "COMPRESS=lzma" >/etc/initramfs-tools/conf.d/snappy-generic-initrd.conf
diff --git a/live-build/ubuntu-cpc/hooks/032-disk-image.binary b/live-build/ubuntu-cpc/hooks/032-disk-image.binary
index bc0a1777..386fbe3b 100755
--- a/live-build/ubuntu-cpc/hooks/032-disk-image.binary
+++ b/live-build/ubuntu-cpc/hooks/032-disk-image.binary
@@ -115,6 +115,7 @@ fi
 
 if [ "$ARCH" = "s390x" ]; then
     # Do ZIPL install bits
+    chroot mountpoint apt-get -qqy install s390-tools sysconfig-hardware
 
     # Write out cloudy zipl.conf for future kernel updates
     cat << EOF > mountpoint/etc/zipl.conf