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

Bug#479431: pkgsel: Upgrade packages if (security) updates are available



I can't test this path set right now, but I think it should work.

-- 
see shy jo
From 6ad146f53afb3c4df08a218a698162f4b65769ec Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kodama.kitenet.net>
Date: Thu, 26 Jun 2008 15:47:50 -0400
Subject: [PATCH] Move redundant error handling code into a function.

---
 packages/pkgsel/debian/changelog |    6 ++++
 packages/pkgsel/debian/postinst  |   49 +++++++++++++++----------------------
 2 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/packages/pkgsel/debian/changelog b/packages/pkgsel/debian/changelog
index 61fc410..a6debbd 100644
--- a/packages/pkgsel/debian/changelog
+++ b/packages/pkgsel/debian/changelog
@@ -1,3 +1,9 @@
+pkgsel (0.21) UNRELEASED; urgency=low
+
+  * Move redundant error handling code into a function.
+
+ -- Joey Hess <joeyh@debian.org>  Thu, 26 Jun 2008 15:46:48 -0400
+
 pkgsel (0.20) unstable; urgency=low
 
   [ Updated translations ]
diff --git a/packages/pkgsel/debian/postinst b/packages/pkgsel/debian/postinst
index a7d1284..24dce2b 100755
--- a/packages/pkgsel/debian/postinst
+++ b/packages/pkgsel/debian/postinst
@@ -20,6 +20,23 @@ cleanup () {
 	done
 }
 
+aptfailed () {
+	ret=$?
+	if [ "$ret" != 0 ]; then
+		# In case packages failed to install, try to clean up.
+		in-target dpkg --configure -a || true
+
+		# TODO useful error message here (for ret != 30)
+		db_progress INFO pkgsel/progress/cleanup
+		if ! cleanup; then
+			log "cleanup failed"
+		fi
+		db_progress STOP
+		load_install_cd
+		exit $ret
+	fi
+}
+
 load_install_cd() {
 	if [ "$REMOUNT_CD" ]; then
 		load-install-cd "/target" || true
@@ -82,47 +99,21 @@ else
 fi
 
 db_progress INFO pkgsel/progress/tasksel
-ret=0
-in-target sh -c "$config tasksel --new-install --debconf-apt-progress='--from 5 --to $tasksel_end --logstderr'" || ret=$?
-if [ "$ret" != 0 ]; then
-	# In case packages failed to install, try to clean up.
-	in-target dpkg --configure -a || true
-	
-	# TODO useful error message here (for ret != 30)
-	db_progress INFO pkgsel/progress/cleanup
-	if ! cleanup; then
-		log "cleanup failed"
-	fi
-	db_progress STOP
-	load_install_cd
-	exit $ret
-fi
+in-target sh -c "$config tasksel --new-install --debconf-apt-progress='--from 5 --to $tasksel_end --logstderr'" || aptfailed
 
 db_get pkgsel/include
 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 "$config debconf-apt-progress --from 90 --to 95 --logstderr -- aptitude -q --without-recommends -y install -- $RET" || ret=$?
-	if [ "$ret" != 0 ]; then
-		# In case packages failed to install, try to clean up.
-		in-target dpkg --configure -a || true
-
-		# TODO useful error message here (for ret != 30)
-		db_progress INFO pkgsel/progress/cleanup
-		if ! cleanup; then
-			log "cleanup failed"
-		fi
-		db_progress STOP
-		load_install_cd
-		exit $ret
-	fi
+	in-target sh -c "$config debconf-apt-progress --from 90 --to 95 --logstderr -- aptitude -q --without-recommends -y install -- $RET" || aptfailed
 fi
 
 db_progress INFO pkgsel/progress/cleanup
 if ! cleanup; then
 	log "cleanup failed"
 fi
+
 db_progress STEP 2
 
 if [ -x /target/usr/bin/scrollkeeper-update ]; then
-- 
1.5.5.4

From a627831eb70a3ac2de9d797b67192488cf6791c4 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kodama.kitenet.net>
Date: Thu, 26 Jun 2008 15:59:13 -0400
Subject: [PATCH] Add a call to aptitude safe-upgrade before running tasksel

So that security fixes not present on install CDs will be pulled in.
Closes: #479431

* debconf prompts during the upgrade will be provied to d-i
* dpkg is forced to install new verisons of conffiles
---
 packages/pkgsel/debian/changelog        |    5 +++++
 packages/pkgsel/debian/pkgsel.templates |    6 ++++++
 packages/pkgsel/debian/postinst         |    5 ++++-
 3 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/packages/pkgsel/debian/changelog b/packages/pkgsel/debian/changelog
index a6debbd..164c92e 100644
--- a/packages/pkgsel/debian/changelog
+++ b/packages/pkgsel/debian/changelog
@@ -1,6 +1,11 @@
 pkgsel (0.21) UNRELEASED; urgency=low
 
   * Move redundant error handling code into a function.
+  * Add a call to aptitude safe-upgrade before running tasksel,
+    so that security fixes not present on install CDs will be pulled in.
+    Closes: #479431
+  * debconf prompts during the upgrade will be provied to d-i
+  * dpkg is forced to install new verisons of conffiles
 
  -- Joey Hess <joeyh@debian.org>  Thu, 26 Jun 2008 15:46:48 -0400
 
diff --git a/packages/pkgsel/debian/pkgsel.templates b/packages/pkgsel/debian/pkgsel.templates
index 88f990e..f794f8c 100644
--- a/packages/pkgsel/debian/pkgsel.templates
+++ b/packages/pkgsel/debian/pkgsel.templates
@@ -13,6 +13,12 @@ Type: text
 # The text is used when pkgsel is launched, before it installs packages
 _Description: Setting up...
 
+Template: pkgsel/progress/upgrade
+Type: text
+# This appears in a progress bar when running pkgsel
+# The text is used when upgrading already installed packages.
+_Description: Upgrading software...
+
 Template: pkgsel/progress/tasksel
 Type: text
 # This appears in a progress bar when running pkgsel
diff --git a/packages/pkgsel/debian/postinst b/packages/pkgsel/debian/postinst
index 24dce2b..fabace1 100755
--- a/packages/pkgsel/debian/postinst
+++ b/packages/pkgsel/debian/postinst
@@ -91,6 +91,9 @@ if [ -d "$partsdir" ]; then
 	done
 fi
 
+db_progress INFO pkgsel/progress/upgrade
+in-target sh -c "$config debconf-apt-progress --from 5 --to 10 --logstderr -- aptitude safe-upgrade -o DPkg::options=--force-confnew" || aptfailed
+
 db_get pkgsel/include
 if [ "$RET" ]; then
 	tasksel_end=90
@@ -99,7 +102,7 @@ else
 fi
 
 db_progress INFO pkgsel/progress/tasksel
-in-target sh -c "$config tasksel --new-install --debconf-apt-progress='--from 5 --to $tasksel_end --logstderr'" || aptfailed
+in-target sh -c "$config tasksel --new-install --debconf-apt-progress='--from 10 --to $tasksel_end --logstderr'" || aptfailed
 
 db_get pkgsel/include
 if [ "$RET" ]; then
-- 
1.5.5.4

Attachment: signature.asc
Description: Digital signature


Reply to: