[Popcon-developers] Re: Asking for popularity-contest participation at install time

Petter Reinholdtsen pere@hungry.com
Thu Jul 7 16:34:19 UTC 2005


[Petter Reinholdtsen]
> Here is a proposed patch for base-config to enable it again.

After discussing it a bit on IRC with Joey Hess, here is a second
draft.  Any protests?  It no longer uses the debconf answer to check
if the package is enabled, but looks in the config file to check the
current value instead.  It also ignore errors from apt-get, and try
harder to get the pacakge installed.

OK to commit?  It is completely untested by me, as I do not have a
test environment available at the moment.

Index: lib/menu/pkgsel
===================================================================
--- lib/menu/pkgsel	(revisjon 1579)
+++ lib/menu/pkgsel	(arbeidskopi)
@@ -26,13 +26,6 @@
 	ln -sf /bin/true /usr/bin/scrollkeeper-update
 	ln -sf /bin/true /usr/bin/scrollkeeper-rebuilddb
 
-	# Make popularity-contest be selected for installation by default. It
-	# lets the user choose whether or not to enable it. We need more
-	# people using this so we can hope to get better data about who is
-	# using what packages in debian.
-	# (Doesn't work with new tasksel.)
-	#echo popularity-contest install | dpkg --set-selections
-	
 	# X needs some packages installed before its debconf config is run
 	# to make it do hardware autodetection. The only way to make sure these
 	# are installed properly is to install them now, before packages are
@@ -56,6 +49,25 @@
 		fi
 	fi
 
+	# Install popularity-contest if not already installed to ask
+	# if the user want to participate.  If the user say no, remove
+	# it again.
+	# It lets the user choose whether or not to enable it. We need
+	# more people using this so we can hope to get better data
+	# about who is using what packages in debian.
+	# Using apt-get and dpkg --purge to make sure it is not
+	# registered as a wanted package by aptitude.
+	if ! dpkg --get-selections |
+	    egrep -q 'popularity-contest[[:space:]]+install'; then
+		# Ignore errors from apt-get, and only remove if it
+		# was installed but not enabled
+		if apt-get -y -f install popularity-contest ; then
+			if grep -q '^PARTICIPATE=\"*yes\"*' /etc/popularity-contest.conf ; then
+				dpkg --purge popularity-contest
+			fi
+		fi
+	fi
+	
 	if [ "$KEEP_BASE_DEBS" != yes ]; then
 		apt-get -f clean || true
 	fi




More information about the Popcon-developers mailing list