[Popcon-commits] cvs commit to popularity-contest/debian by pere
popcon-commits@lists.alioth.debian.org
popcon-commits@lists.alioth.debian.org
Sat, 20 Mar 2004 01:26:30 -0700
Update of /cvsroot/popcon/popularity-contest/debian
In directory haydn:/tmp/cvs-serv28235/debian
Modified Files:
changelog postinst templates
Log Message:
Replace MY_HOSTID on upgrades if it is the empty ID mentioned in bug #237874.
Index: changelog
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/debian/changelog,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- changelog 19 Mar 2004 23:42:46 -0000 1.77
+++ changelog 20 Mar 2004 08:26:28 -0000 1.78
@@ -11,6 +11,8 @@
Carlos Z.F. Liu. (Closes: #238302)
- Updated German debconf translation. Patch from Dennis
Stampfer. (Closes: #238953)
+ - Replace MY_HOSTID on upgrades if it is the empty ID mentioned in
+ bug #237874
-- Petter Reinholdtsen <pere@debian.org> Sun, 14 Mar 2004 22:45:41 +0100
Index: postinst
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/debian/postinst,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- postinst 15 Mar 2004 15:16:54 -0000 1.8
+++ postinst 20 Mar 2004 08:26:28 -0000 1.9
@@ -23,13 +23,24 @@
PARTICIPATE="no"
fi
-generate_conffile() {
+# The md5 sum of an empty file
+EMPTYID="d41d8cd98f00b204e9800998ecf8427e"
+
+generate_id() {
if [ -x /usr/bin/uuidgen ] ; then
MY_HOSTID=`uuidgen | tr -d -`
else
MY_HOSTID=`dd if=/dev/urandom bs=1k count=1 2>/dev/null | md5sum | sed 's/ -//'''`
fi
+ if [ "$MY_HOSTID" == "$EMPTYID" ] ; then
+ db_input critical popularity-contest/hostid-failed || [ $? -eq 30 ]
+ db_go || true
+ exit 1
+ fi
+}
+generate_conffile() {
+ generate_id
cat <<-EOF >$conffile
# Config file for Debian's popularity-contest package.
#
@@ -53,20 +64,30 @@
if [ ! -e $conffile ]; then
generate_conffile
else
+
+ # Workaround for bug #237874 triggered on hurd. The
+ # problem was fixed in version 1.15, 2004-03-20.
+ if [ "$MY_HOSTID" == "$EMPTYID" ] ; then
+ generate_id
+ fi
+
# Replace only if the content changed, to avoid changing the
# config file date when no change was done.
# Commenting out the obsolete addresses, to use the
# default config from /usr/share/ on hosts where
- # the old default was unchanged
+ # the old default was unchanged. Replace the "empty" id.
- if sed " \
+ sedopts=" \
s/^PARTICIPATE=.*$/PARTICIPATE=\"$PARTICIPATE\"/; \
s/^\(MAILTO=\"erich-survey@debian.org\"\)$/#\1/; \
s/^\(MAILTO=\"apenwarr-survey@debian.org\"\)$/#\1/; \
s/^\(MAILTO=\"survey@popcon.debian.org\"\)$/#\1/; \
- " < $conffile > $conffile.new &&
+ s/^MY_HOSTID="\\?$EMPTYID"\\?/MY_HOSTID=\"$MY_HOSTID\"/; \
+ "
+
+ if sed "$sedopts" < $conffile > $conffile.new &&
! cmp $conffile $conffile.new > /dev/null; then
mv $conffile.new $conffile
# Make sure user nobody can read the file.
Index: templates
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/debian/templates,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- templates 25 Jan 2004 23:51:32 -0000 1.5
+++ templates 20 Mar 2004 08:26:28 -0000 1.6
@@ -19,3 +19,13 @@
.
(NOTE: e-mail servers add their own tracing information and your data
won't be completely anonymous while in transit.)
+
+Template: popularity-contest/hostid-failed
+Type: error
+_Description: Generating unique host id failed
+ The install script are unable to generate a unique host id. This
+ is a fatal error, as all hosts submitting info need to have an unique
+ id.
+ .
+ Please report this problem as a bug against popularity-contest, and
+ include info on your configuration.