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

Bug#447326: updated patch



On Tue, Oct 23, 2007 at 09:42:43AM -0200, Otavio Salvador wrote:
> Frans Pop <elendil@planet.nl> writes:
> 
> > Otavio wrote:
> >> > +            # be careful to preserve exit code
> >> > +         if log-output -t pkgsel "$script"; then
> >> > +             :
> >>         ^^^^^^^ indentation errors
> >
> > Also, please always use tabs and not spaces for indentation in D-I scripts 
> > as it saves memory.

Ah, got my space/tab wires crossed while hacking on netcfg - which of
course doesn't have the same issue because its in C.

Here's another version that moves the popcon hook as per Otavio's
suggestion, and should cleanup the whitespace issues. Inline this
time, for easier commenting.

Index: debian/pkgsel.templates
===================================================================
--- debian/pkgsel.templates	(revision 49858)
+++ debian/pkgsel.templates	(working copy)
@@ -31,3 +31,7 @@
 Type: string
 Description: for internal use; can be preseeded
  Comma/space-separated list of extra packages to install
+
+Template: pkgsel/progress/fallback
+Type: text
+_Description: Running ${SCRIPT}...
Index: debian/postinst
===================================================================
--- debian/postinst	(revision 49858)
+++ debian/postinst	(working copy)
@@ -39,12 +39,25 @@
 
 db_progress STEP 1
 
-# Install popularity-contest but remove it if the user decides not to
-# participate.
-if in-target sh -c "$config debconf-apt-progress --from 1 --to 5 --logstderr -- apt-get -o APT::Install-Recommends=false -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
+partsdir="/usr/lib/pre-pkgsel.d"
+if [ -d "$partsdir" ]; then
+	for script in `ls "$partsdir"/*`; do
+		base=$(basename $script | sed 's/[0-9]*//')
+		if ! db_progress INFO pkgsel/progress/$base; then
+			db_subst pkgsel/progress/fallback SCRIPT "$base"
+			db_progress INFO pkgsel/progress/fallback
+		fi
+		if [ -x "$script" ] ; then
+			# be careful to preserve exit code
+			if log-output -t pkgsel "$script"; then
+				:
+			else
+				warning "$script returned error code $?"
+			fi
+		else
+			error "Unable to execute $script"
+		fi
+	done
 fi
 
 db_get pkgsel/include
Index: debian/pkgsel.dirs
===================================================================
--- debian/pkgsel.dirs	(revision 0)
+++ debian/pkgsel.dirs	(revision 0)
@@ -0,0 +1 @@
+usr/lib/pre-pkgsel.d
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 49858)
+++ debian/changelog	(working copy)
@@ -1,3 +1,9 @@
+pkgsel (0.16) UNRELEASED; urgency=low
+
+  * Add support for a /usr/lib/pre-pkgsel.d run-parts syle directory
+
+ -- dann frazier <dannf@debian.org>  Fri, 19 Oct 2007 23:31:05 -0600
+
 pkgsel (0.15) unstable; urgency=low
 
   [ Frans Pop ]
Index: debian/rules
===================================================================
--- debian/rules	(revision 49858)
+++ debian/rules	(working copy)
@@ -12,6 +12,8 @@
 	dh_testdir
 	dh_testroot
 	dh_clean -k
+	dh_installdirs
+	install -m755 pre-pkgsel.d/10popcon debian/pkgsel/usr/lib/pre-pkgsel.d
 	dh_install
 
 binary-indep: build install
Index: pre-pkgsel.d/10popcon
===================================================================
--- pre-pkgsel.d/10popcon	(revision 0)
+++ pre-pkgsel.d/10popcon	(revision 0)
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+# get debconf-apt-progress config, which will make it run properly later
+config=$(chroot /target debconf-apt-progress --config| sed "s/$/;/")
+
+# Install popularity-contest but remove it if the user decides not to
+# participate.
+if in-target sh -c "$config debconf-apt-progress --from 1 --to 5 --logstderr -- apt-get -o APT::Install-Recommends=false -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
+fi

Property changes on: pre-pkgsel.d/10popcon
___________________________________________________________________
Name: svn:executable
   + *





Reply to: