[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] allow to include and exclude packages of base using presseding



It's now possible to include and exclude packages from the base system
by preseeding base-installer/includes and
base-installer/excludes. Adding packages using base_include and
base_include CD files still works and the packages are added to the
preseeded ones.

The INCLUDE and EXCLUDE variable were move from library to
bootstrap-base.postinst since it's only used by it.
---
 .../base-installer/debian/bootstrap-base.postinst  |   16 ++++++++++++++++
 .../base-installer/debian/bootstrap-base.templates |   10 ++++++++++
 packages/base-installer/debian/changelog           |    6 ++++++
 packages/base-installer/library.sh                 |    9 ---------
 4 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/packages/base-installer/debian/bootstrap-base.postinst b/packages/base-installer/debian/bootstrap-base.postinst
index e1ab5e6..fef7348 100755
--- a/packages/base-installer/debian/bootstrap-base.postinst
+++ b/packages/base-installer/debian/bootstrap-base.postinst
@@ -10,6 +10,14 @@ ETCDIR=/target/etc
 ARCH=`udpkg --print-architecture`
 KEYRING=/usr/share/keyrings/archive.gpg
 
+# Set initial value to includes and excludes
+db_get base-installer/includes
+INCLUDES="$(printf '%s' "$RET" | sed 's/ /,/g')" || true
+
+db_get base-installer/excludes
+EXCLUDES="$(printf '%s' "$RET" | sed 's/ /,/g')" || true
+
+
 # Avoid debconf sending email during the base install process
 DEBCONF_ADMIN_EMAIL=""
 export DEBCONF_ADMIN_EMAIL
@@ -37,6 +45,14 @@ fi
 FLAVOUR="$(arch_get_kernel_flavour || true)"
 
 install_base_system () {
+	if [ -s /cdrom/.disk/base_include ]; then
+		INCLUDES="$INCLUDES,`grep -v '^#' /cdrom/.disk/base_include | tr '\n' , | sed 's/^,//g;s/,$//'`"
+	fi
+
+	if [ -s /cdrom/.disk/base_exclude ]; then
+		EXCLUDES="$EXCLUDES,`grep -v '^#' /cdrom/.disk/base_exclude | tr '\n' , | sed 's/^,//g;s/,$//'`"
+	fi
+
 	db_progress INFO base-installer/progress/preparing
 
 	if [ "${INCLUDES}" ]; then
diff --git a/packages/base-installer/debian/bootstrap-base.templates b/packages/base-installer/debian/bootstrap-base.templates
index ea48daa..524312c 100644
--- a/packages/base-installer/debian/bootstrap-base.templates
+++ b/packages/base-installer/debian/bootstrap-base.templates
@@ -359,3 +359,13 @@ Template: base-installer/section/install_kernel_package
 Type: text
 # SUBST0 is a package name
 _Description: Installing the kernel - retrieving and installing ${SUBST0}...
+
+Template: base-installer/includes
+Type: string
+Description: for internal use; can be preseeded
+ Packages to be included in base installation
+
+Template: base-installer/excludes
+Type: string
+Description: for internal use; can be preseeded
+ Packages to be excluded in base installation
diff --git a/packages/base-installer/debian/changelog b/packages/base-installer/debian/changelog
index 94edb52..2313efc 100644
--- a/packages/base-installer/debian/changelog
+++ b/packages/base-installer/debian/changelog
@@ -10,6 +10,12 @@ base-installer (1.89) UNRELEASED; urgency=low
     requires the D-I kernel to have SMP support, which it hasn't.
     Thanks to Grant Grundler for his suggestions.
 
+  [ Otavio Salvador ]
+  * Add facility to include and exclude packages from the base system by
+    preseeding base-installer/includes and base-installer/excludes. Adding
+    packages using base_include and base_include CD files still works and
+    the packages are added to the preseeded ones.
+
  -- Frans Pop <fjp@debian.org>  Mon, 18 Feb 2008 16:21:34 +0100
 
 base-installer (1.88) unstable; urgency=low
diff --git a/packages/base-installer/library.sh b/packages/base-installer/library.sh
index e235d91..e3a589f 100644
--- a/packages/base-installer/library.sh
+++ b/packages/base-installer/library.sh
@@ -12,8 +12,6 @@ MIRROR=
 DIRECTORY=
 COMPONENTS=
 DISTRIBUTION=
-INCLUDES=
-EXCLUDES=
 KERNEL=
 KERNEL_LIST=/tmp/available_kernels.txt
 KERNEL_MAJOR="$(uname -r | cut -d . -f 1,2)"
@@ -267,13 +265,6 @@ get_mirror_info () {
 		else
 			COMPONENTS="*"
 		fi
-		if [ -s /cdrom/.disk/base_include ]; then
-			INCLUDES=`grep -v '^#' /cdrom/.disk/base_include | tr '\n' , | sed 's/,$//'`
-		fi
-
-		if [ -s /cdrom/.disk/base_exclude ]; then
-			EXCLUDES=`grep -v '^#' /cdrom/.disk/base_exclude | tr '\n' , | sed 's/,$//'`
-		fi
 
 		# Sanity check: an error reading /cdrom/.disk/base_components can cause
 		# ugly errors in debootstrap because $COMPONENTS will be empty.
-- 
1.5.4.3


Reply to: