Skip to content

Commit

Permalink
Support popularity-contest >= 1.61 encrypting submissions
Browse files Browse the repository at this point in the history
- provide GPG public key for encryption of submissions
  • Loading branch information
yarikoptic committed Aug 6, 2014
1 parent 0c66e6b commit f0f927a
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 4 deletions.
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
neurodebian (0.33~a1) UNRELEASED; urgency=medium

* Support popularity-contest >= 1.61 encrypting submissions:
- provide GPG public key for encryption of submissions

-- Yaroslav Halchenko <[email protected]> Wed, 06 Aug 2014 16:21:04 -0400

neurodebian (0.32) neurodebian; urgency=low

[ Michael Hanke ]
Expand Down
2 changes: 2 additions & 0 deletions debian/neurodebian-popularity-contest.dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
usr/share/popularity-contest
etc/popularity-contest.d
2 changes: 2 additions & 0 deletions debian/neurodebian-popularity-contest.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
popcon/neurodebian.conf /etc/popularity-contest.d
popcon/neurodebian-popcon.gpg /usr/share/popularity-contest
39 changes: 38 additions & 1 deletion debian/neurodebian-popularity-contest.postinst
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
#!/bin/bash -e

# following to be duplicated within postrm as well, but may be with
# "Removing" message
popcon_conf=/etc/popularity-contest.conf
if [ "$1" = "configure" -o "$1" = "abort-upgrade" ]; then
nd_popcon_conf=/etc/popularity-contest.d/neurodebian.conf
remove_neurodebian_popcon_pre161() {
# Adjust popularity-contest.conf
if [ -e "$popcon_conf" ] \
&& grep -q "http://neuro.debian.net/cgi-bin/popcon-submit.cgi" $popcon_conf; then
#echo "Removing NeuroDebian url for Popularity Contest submissions."
# First remove any explicit mentioning and then empty additions
sed -i -e 's,http://neuro.debian.net/cgi-bin/popcon-submit.cgi,,g' \
-e '/SUBMITURLS+=" *"/d' \
-e '/SUBMITURLS="$SUBMITURLS *"/d' \
"$popcon_conf"
fi
}

add_neurodebian_popcon_pre161() {
# Adjust main popularity-contest configuration file. Should be
# used only with older versions of the popularity contest.
if [ -e "$popcon_conf" ]; then
# Fix dashism missing += operator
if grep -q 'SUBMITURLS+="' "$popcon_conf"; then
Expand All @@ -14,6 +31,26 @@ if [ "$1" = "configure" -o "$1" = "abort-upgrade" ]; then
echo -e 'SUBMITURLS="$SUBMITURLS http://neuro.debian.net/cgi-bin/popcon-submit.cgi"' >> "$popcon_conf"
fi
fi
}

add_neurodebian_popcon_161() {
# 1.60 introduced encryption and a way to provide multiple keys to
# encrypt submissions to multiple servers.

# "Installation" is taken care of through installing files under
# /etc/popularity-contest.d, so no additional actions necessary here
:
}

popcon_version=$(dpkg -l popularity-contest | tail -n 1 | awk '{print $3;}')

if [ "$1" = "configure" -o "$1" = "abort-upgrade" ]; then
if dpkg --compare-versions $popcon_version lt 1.61; then
add_neurodebian_popcon_pre161
else
# Assure that we have no "old" settings for submission
remove_neurodebian_popcon_pre161 || :
fi
fi

#DEBHELPER#
12 changes: 9 additions & 3 deletions debian/neurodebian-popularity-contest.postrm
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@

#DEBHELPER#

# If requested to be purged -- remove our entry
popcon_conf=/etc/popularity-contest.conf
if [ "$1" = "purge" ]; then
nd_popcon_conf=/etc/popularity-contest.d/neurodebian.conf
remove_neurodebian_popcon_pre161() {
# Adjust popularity-contest.conf
if [ -e "$popcon_conf" ]; then
if [ -e "$popcon_conf" ] \
&& grep -q "http://neuro.debian.net/cgi-bin/popcon-submit.cgi" $popcon_conf; then
echo "Removing NeuroDebian url for Popularity Contest submissions."
# First remove any explicit mentioning and then empty additions
sed -i -e 's,http://neuro.debian.net/cgi-bin/popcon-submit.cgi,,g' \
-e '/SUBMITURLS+=" *"/d' \
-e '/SUBMITURLS="$SUBMITURLS *"/d' \
"$popcon_conf"
fi
}

# If requested to be purged -- remove our entry
if [ "$1" = "purge" ]; then
remove_neurodebian_popcon_pre161
fi
Binary file added popcon/neurodebian-popcon.gpg
Binary file not shown.
3 changes: 3 additions & 0 deletions popcon/neurodebian.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
KEYRING="$KEYRING --keyring /usr/share/popularity-contest/neurodebian-popcon.gpg"
POPCONKEY="$POPCONKEY -r 0x544665CB8B48DE1D"
SUBMITURLS="$SUBMITURLS http://neuro.debian.net/cgi-bin/popcon-submit.cgi"

0 comments on commit f0f927a

Please sign in to comment.