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

Bug#447326: pkgsel: add support for pre-hooks



Package: pkgsel
Version: 0.15
Severity: wishlist
Tags: patch

This patch adds an /usr/lib/pre-pkgsel.d/ directory where hooks can be
added in a run-parts fashion. popcon handling has been factored out
into its own script in this directory.

My main motivation for this patch is that I wanted the ability to
install a package containing a task definition into /target just
before tasksel gets executed.

-- 
dann frazier

Index: debian/postinst
===================================================================
--- debian/postinst	(revision 49834)
+++ debian/postinst	(working copy)
@@ -39,12 +39,20 @@
 
 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
+        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 49834)
+++ 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 49834)
+++ debian/rules	(working copy)
@@ -12,6 +12,8 @@
 	dh_testdir
 	dh_testroot
 	dh_clean -k
+	dh_installdirs
+	install -m755 popcon debian/pkgsel/usr/lib/pre-pkgsel.d/
 	dh_install
 
 binary-indep: build install
Index: popcon
===================================================================
--- popcon	(revision 0)
+++ popcon	(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: popcon
___________________________________________________________________
Name: svn:executable
   + *


Reply to: