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

Bug#543256: Make installing recommends optional



tags 543256 patch
thanks

On Sunday 23 August 2009, Marc 'HE' Brockschmidt wrote:
> Please make installation of recommended packages in d-i optional, at
> least by adding a question in expert mode. This is one of the features
> quite a lot admins turn off right after installations (found out by an
> ad-hoc survey here at FrOSCon).

I think that supporting this option is well within the normal scope of 
D-I, which is very much about flexibility where possible.

Attached patches (untested, but straightforward) for three components:
- base-installer, where the question will be asked and which will
  configure apt accordingly; this means the base system installation
  will now also install Recommends (for CD-based installs [1]: only if
  available on the CD [2]!); the selected setting will persist for the
  installed system
- di-utils: apt-install will now respect the global option instead of
  always disabling Recommends
- pkgsel: same, plus removes now redundant question for additional
  packages

I've not yet included patches for the manual, but will update if the 
patches are accepted.

These patches have one consequence: we'll have to continue to support the 
few "required" recommends that have been identified in the past.
Off the top of head, one is busybox for initramfs-tools. Another I think 
is reasonable to keep is libgl1-mesa-dri for X.Org.

Cheers,
FJP

[1] Except businesscard which installs base from a mirror.
[2] This needs to be documented.

commit f5f7b6c5313984bc5b7b700a302aa4f48f6f4b22
Author: Frans Pop <fjp@debian.org>
Date:   Sun Aug 23 23:20:01 2009 +0200

    Ask whether to install recommended packages
    
    Question is asked at medium priority and defaults to installing them.
    APT in the target system is configured for the choice and the setting
    will be preserved for the installed system.

diff --git a/packages/base-installer/debian/bootstrap-base.postinst b/packages/base-installer/debian/bootstrap-base.postinst
index 433433f..2577622 100755
--- a/packages/base-installer/debian/bootstrap-base.postinst
+++ b/packages/base-installer/debian/bootstrap-base.postinst
@@ -54,6 +54,11 @@ fi
 
 FLAVOUR="$(arch_get_kernel_flavour || true)"
 
+ask_install_recommends () {
+	db_input medium base-installer/install-recommends || true
+	db_go || exit 10 # back-up to menu
+}
+
 install_base_system () {
 	if [ -s /cdrom/.disk/base_include ]; then
 		INCLUDES="$INCLUDES,`grep -v '^#' /cdrom/.disk/base_include | tr '\n' , | sed 's/^,//g;s/,$//'`"
@@ -133,6 +138,7 @@ install_base_system () {
 
 waypoint 1	check_target
 waypoint 1	get_mirror_info
+waypoint 1	ask_install_recommends
 waypoint 100	install_base_system
 waypoint 1	pre_install_hooks
 waypoint 1	setup_dev
diff --git a/packages/base-installer/debian/bootstrap-base.templates b/packages/base-installer/debian/bootstrap-base.templates
index 17a40da..e647371 100644
--- a/packages/base-installer/debian/bootstrap-base.templates
+++ b/packages/base-installer/debian/bootstrap-base.templates
@@ -5,6 +5,23 @@ Type: text
 # :sl1:
 _Description: Install the base system
 
+Template: base-installer/install-recommends
+Type: boolean
+Default: true
+_Description: Install recommended packages?
+ By default the package management system will automatically install
+ packages recommended by other packages. These are packages which are
+ not required for the core functionality of the selected software, but
+ which do enhance that software.
+ .
+ This option allows to have a leaner system, but can also result in
+ features being missing that you might normally expect to be available.
+ You'd may have to manually install some of the recommended packages
+ to obtain the full functionality you want.
+ .
+ You should not deselect this option unless you are an experienced user.
+ Your choice will also determine the setting for the installed system.
+
 Template: base-installer/cannot_install
 Type: error
 # The base system is the minimal Debian system 
diff --git a/packages/base-installer/library.sh b/packages/base-installer/library.sh
index 55c0801..2127ee6 100644
--- a/packages/base-installer/library.sh
+++ b/packages/base-installer/library.sh
@@ -155,6 +155,13 @@ install_filesystems () {
 configure_apt_preferences () {
 	[ ! -d "$APT_CONFDIR" ] && mkdir -p "$APT_CONFDIR"
 
+	# Install Recommends?
+	if db_get debian-installer/install-recommends && [ "$RET" = false ];
+		cat >$APT_CONFDIR/00InstallRecommends <<EOT
+APT::Install-Recommends "false";
+EOT
+	fi
+
 	# Make apt trust Debian CDs. This is not on by default (we think).
 	# This will be left in place on the installed system.
 	cat > $APT_CONFDIR/00trustcdrom <<EOT
commit 67aa5bf78fcf3aa4f8dc1cf9916020f5f682d6fc
Author: Frans Pop <fjp@debian.org>
Date:   Sun Aug 23 23:24:43 2009 +0200

    Installing Recommends is now a global setting

diff --git a/packages/debian-installer-utils/apt-install b/packages/debian-installer-utils/apt-install
index c15757e..d067bff 100755
--- a/packages/debian-installer-utils/apt-install
+++ b/packages/debian-installer-utils/apt-install
@@ -30,7 +30,7 @@ if [ -e /var/lib/install-cd.id ] && \
 fi
 
 ERRCODE=0
-in-target sh -c "debconf-apt-progress --no-progress --logstderr -- apt-get -o APT::Install-Recommends=false -q -y --no-remove install $packages" || ERRCODE=$?
+in-target sh -c "debconf-apt-progress --no-progress --logstderr -- apt-get -q -y --no-remove install $packages" || ERRCODE=$?
 
 if [ "$REMOUNT_CD" ]; then
 	load-install-cd "/target" || true

Reply to: