From be9e81b56176bdb5c3240e76c183fa45cee2c776 Mon Sep 17 00:00:00 2001
From: Iain Lane <iain.lane@canonical.com>
Date: Fri, 23 Feb 2018 15:37:42 +0000
Subject: [PATCH] Import patches-unapplied version 2.506 to
 ubuntu/bionic-proposed

Imported using git-ubuntu import.

Changelog parent: c050b677966eb3a0806859d2d124b7c803e29efc

New changelog entries:
  * live-build-auto/{build,config}: Support fetching a file from the seed
    mirror (BASE_SEED.minimal-remove) and putting it into the livefs build as
    filesystem.manifest-minimal-remove. It's intended for ubiquity to read
    this file as a list of packages to remove when doing a 'minimal' desktop
    installation.
---
 debian/changelog       | 10 ++++++++++
 live-build/auto/build  |  4 ++++
 live-build/auto/config | 14 ++++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index d958834d..8b419598 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+livecd-rootfs (2.506) bionic; urgency=medium
+
+  * live-build-auto/{build,config}: Support fetching a file from the seed
+    mirror (BASE_SEED.minimal-remove) and putting it into the livefs build as
+    filesystem.manifest-minimal-remove. It's intended for ubiquity to read
+    this file as a list of packages to remove when doing a 'minimal' desktop
+    installation.
+
+ -- Iain Lane <iain.lane@canonical.com>  Fri, 23 Feb 2018 15:37:42 +0000
+
 livecd-rootfs (2.505) bionic; urgency=medium
 
   * Move casper from filesystem.squashfs to installer.squashfs. 
diff --git a/live-build/auto/build b/live-build/auto/build
index 41c887cd..20a2d551 100755
--- a/live-build/auto/build
+++ b/live-build/auto/build
@@ -468,6 +468,10 @@ for OUTPUT in ext2 ext3 ext4 manifest manifest-remove size squashfs; do
 	chmod 644 "$PREFIX.$OUTPUT"
 done
 
+if [ -e config/manifest-minimal-remove ]; then
+        cp config/manifest-minimal-remove  "$PREFIX.manifest-minimal-remove"
+fi
+
 for ISO in binary.iso binary.hybrid.iso; do
 	[ -e "$ISO" ] || continue
 	ln "$ISO" "$PREFIX.iso"
diff --git a/live-build/auto/config b/live-build/auto/config
index a94fd990..6dc8881f 100755
--- a/live-build/auto/config
+++ b/live-build/auto/config
@@ -698,6 +698,20 @@ if [ -n "${BASE_SEED}" ]; then
 	fi
 fi
 
+# grab a list of packags to remove for a "minimal" installation from the seed
+# mirror for this project
+if [ -n "${BASE_SEED}" ] && [ -n "${BASE_SEED}" ]; then
+	minimal_packages_url=${SEEDMIRROR}/${SEED}/${BASE_SEED}.minimal-remove
+	echo -n "Checking ${minimal_packages_url} for a minimal installation list... "
+	minimal_packages_remove=$(wget -q -O- ${minimal_packages_url} | sed -e '/\s*#.*$/d' -e '/^\s*$/d')
+	if [ -n "${minimal_packages_remove}" ]; then
+		echo "${minimal_packages_remove}" > config/manifest-minimal-remove
+		echo "$(echo ${minimal_packages_remove} | tr '\n' ' ')"
+	else
+		echo "failed to retrieve, not including."
+	fi
+fi
+
 export APT_OPTIONS
 
 if [ "$PREINSTALLED" != "true" ] && [ "$LIVE_TASK" ]; then