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

Bug#543256: Make installing recommends optional



tag 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).

IMO this option is well within the scope of the installer which is all 
about providing flexibility where reasonable.

Attached patches (untested, but straightforward) for three components:
- base-installer, where the question is asked (at medium priority) and APT
  is configured accordingly; the setting will persist for the installed
  system;
- di-utils: apt-install will now respect the global setting instead of
  always ignoring Recommends;
- pkgsel: same, and drop now redundant option to include Recommends for
  "include" (preseeded additional) packages.

The template that asks the question is a first draft, but I do think we 
have to be fairly explicit.

Notes:
- in order for the base system to honor Recommends, we'd have to modify
  debootstrap, but I'm not sure whether it's very relevant there; the
  "standard" task _will_ honor the recommends choice;
- Recommends will still only be installed *if available*, which will
  depend on the installation method, but note that this is similar to
  what we already have for non-key packages in tasks; this mainly affects
  full CD based installs without mirror; should be documented;
- if we go this way it will mean that we'll have to continue to support
  the few "required Recommends" that have been identified in the past;
  one example is busybox for initramfs-tools, another that IMO is worth
  keeping is libgl1-mesa-dri for X.Org; we'll have to review the changes
  made by Joey in tasksel that dropped some packages from tasks, but I
  doubt many would need to be added back;

I see two main advantages to going this way:
- empower our more professional and experienced users;
- D-I will be a lot more consistent, instead of some components behaving
  one way and some the other.

Cheers,
FJP

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
commit c3f0a3f84678030e9b5e87e6132b02238b51f046
Author: Frans Pop <fjp@debian.org>
Date:   Sun Aug 23 23:24:04 2009 +0200

    Installing Recommends is now a global setting

diff --git a/packages/pkgsel/debian/pkgsel.templates b/packages/pkgsel/debian/pkgsel.templates
index a8e0e6f..6ce4290 100644
--- a/packages/pkgsel/debian/pkgsel.templates
+++ b/packages/pkgsel/debian/pkgsel.templates
@@ -45,13 +45,6 @@ Type: string
 Description: for internal use; can be preseeded
  Comma/space-separated list of extra packages to install
 
-Template: pkgsel/include/install-recommends
-Type: boolean
-Default: false
-Description: for internal use; can be preseeded
- If set to true, then also install packages Recommended by those listed in
- pkgsel/include.
-
 Template: pkgsel/progress/fallback
 Type: text
 _Description: Running ${SCRIPT}...
diff --git a/packages/pkgsel/debian/postinst b/packages/pkgsel/debian/postinst
index ae88bea..357e043 100755
--- a/packages/pkgsel/debian/postinst
+++ b/packages/pkgsel/debian/postinst
@@ -90,7 +90,7 @@ else
 	sleep 2 # allow the message to be seen
 
 	log "checking for (security) updates to the base system"
-	in-target sh -c "debconf-apt-progress --from 50 --to 100 --logstderr -- aptitude -q --without-recommends -y -o DPkg::options=--force-confnew '$upgrade_type'" || aptfailed
+	in-target sh -c "debconf-apt-progress --from 50 --to 100 --logstderr -- aptitude -q -y -o DPkg::options=--force-confnew '$upgrade_type'" || aptfailed
 	tasksel_start=100
 fi
 
@@ -142,12 +142,6 @@ log "starting tasksel"
 db_progress INFO pkgsel/progress/tasksel
 in-target sh -c "tasksel --new-install --debconf-apt-progress='--from $tasksel_start --to $tasksel_end --logstderr'" || aptfailed
 
-db_get pkgsel/include/install-recommends
-if [ "$RET" = true ]; then
-	recommends=
-else
-	recommends='--without-recommends'
-fi
 db_get pkgsel/include
 if [ "$RET" ]; then
 	log "installing additional packages"
@@ -155,7 +149,7 @@ if [ "$RET" ]; then
 	# Allow comma-separation so that this can more easily be preseeded
 	# at the kernel command line.
 	RET="$(printf '%s' "$RET" | sed 's/,/ /g')"
-	in-target sh -c "debconf-apt-progress --from 900 --to 950 --logstderr -- aptitude -q $recommends -y install -- $RET" || aptfailed
+	in-target sh -c "debconf-apt-progress --from 900 --to 950 --logstderr -- aptitude -q -y install -- $RET" || aptfailed
 fi
 
 log "finishing up"
diff --git a/packages/pkgsel/pre-pkgsel.d/10popcon b/packages/pkgsel/pre-pkgsel.d/10popcon
index 1110a06..e435284 100755
--- a/packages/pkgsel/pre-pkgsel.d/10popcon
+++ b/packages/pkgsel/pre-pkgsel.d/10popcon
@@ -4,7 +4,7 @@ set -e
 
 # Install popularity-contest but remove it if the user decides not to
 # participate.
-if in-target sh -c "debconf-apt-progress --no-progress --logstderr -- apt-get -o APT::Install-Recommends=false -q -y -f install popularity-contest"; then
+if in-target sh -c "debconf-apt-progress --no-progress --logstderr -- apt-get -q -y -f install popularity-contest"; then
 	if ! grep -q '^PARTICIPATE=\"*yes\"*' /target/etc/popularity-contest.conf; then
 		in-target dpkg --purge popularity-contest
 	fi

Reply to: