[SCM] Packaging for Google Go branch, weekly-debian-sid, updated. debian-weekly/2011.09.07-1-48-ge4a4b27
Ondřej Surý
ondrej at sury.org
Fri Mar 9 08:43:47 UTC 2012
The following commit has been merged in the weekly-debian-sid branch:
commit c42855af9e2e363d4134394c232bf90d3d95b94f
Author: Ondřej Surý <ondrej at sury.org>
Date: Fri Mar 9 09:25:15 2012 +0100
Re-add template with goinstall question
diff --git a/debian/golang-weekly-go.config b/debian/golang-weekly-go.config
new file mode 100644
index 0000000..7ca7b66
--- /dev/null
+++ b/debian/golang-weekly-go.config
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+conffile=/etc/golang/goinstall.conf
+
+. /usr/share/debconf/confmodule
+
+if [ -f $conffile ] ; then
+ if grep -q DASHBOARD $conffile; then
+ :;
+ fi
+ . $conffile
+ if [ "$DASHBOARD" = "yes" ] ; then
+ DASHBOARD=true
+ else
+ DASHBOARD=false
+ fi
+ db_set golang-weekly-go/dashboard "$DASHBOARD"
+fi
+
+db_get golang-weekly-tools/dashboard || true
+if [ "$RET" = "yes" ] || [ "$RET" = "YES" ] || [ "$RET" = "true" ]; then
+ DASHBOARD=true
+elif [ "$RET" = "no" ] || [ "$RET" = "no" ] || [ "$RET" = "false" ]; then
+ DASHBOARD=false
+fi
+# Remove old settings from golang-weekly-tools package
+[ -n "$RET" ] && golang-weekly-tools/dashboard
+
+[ -n "$DASHBOARD" ] && db_set golang-weekly-go/dashboard "$DASHBOARD"
+
+db_input high golang-weekly-go/dashboard || [ $? -eq 30 ]
+db_go || true
diff --git a/debian/golang-weekly-go.postinst b/debian/golang-weekly-go.postinst
new file mode 100644
index 0000000..1385c66
--- /dev/null
+++ b/debian/golang-weekly-go.postinst
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# Load debconf variables
+. /usr/share/debconf/confmodule
+
+confdir=/etc/golang
+conffile=$confdir/goinstall.conf
+
+set -e
+
+if [ -e $conffile ] ; then
+ # Fetch current values.
+ . $conffile
+fi
+
+# Get this setting from debconf. It was set based on the content of
+# /etc/golang/goinstall.conf in the 'config' script, so it should be
+# safe to ignore the value fetched by loading the file above. This
+# should allow for using debconf to reconfigure the package.
+db_get golang-weekly-go/dashboard || true
+if [ "$RET" = "yes" ] || [ "$RET" = "YES" ] || [ "$RET" = "true" ]; then
+ DASHBOARD="yes"
+else
+ DASHBOARD="no"
+fi
+
+generate_conffile() {
+ if [ ! -d $confdir ]; then
+ mkdir $confdir
+ fi
+ cat <<-EOF >$conffile
+ # Config file for goinstall tool.
+ #
+ # To change this file, use:
+ # dpkg-reconfigure golang-weekly-go
+ #
+ # You can also edit it by hand, if you so choose.
+
+ DASHBOARD="$DASHBOARD"
+ EOF
+
+ # Make sure user nobody can read the file.
+ chmod a+r $conffile
+}
+
+case "$1" in
+ configure)
+ if [ ! -e $conffile ]; then
+ generate_conffile
+ else
+ # Replace only if the content changed, to avoid changing the
+ # config file date when no change was done.
+ sedopts=" \
+ s/^DASHBOARD=.*$/DASHBOARD=\"$DASHBOARD\"/; \
+ "
+ 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.
+ chmod a+r $conffile
+ else
+ rm $conffile.new
+ fi
+ fi
+ ;;
+ *)
+ ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/golang-weekly-go.postrm b/debian/golang-weekly-go.postrm
new file mode 100644
index 0000000..2cf582e
--- /dev/null
+++ b/debian/golang-weekly-go.postrm
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+# purge the config file which is created in the postinst script
+if [ "$1" = purge ] ; then
+ rm -f /etc/golang/goinstall.conf
+ rmdir /etc/golang || true
+fi
+
+if [ "$1" = "purge" ] && [ -e /usr/share/debconf/confmodule ]; then
+ # Source debconf library.
+ . /usr/share/debconf/confmodule
+ # Remove my changes to the db.
+ db_purge
+fi
+
+#DEBHELPER#
+
diff --git a/debian/golang-weekly-go.templates b/debian/golang-weekly-go.templates
new file mode 100644
index 0000000..28094a0
--- /dev/null
+++ b/debian/golang-weekly-go.templates
@@ -0,0 +1,15 @@
+Template: golang-weekly-go/dashboard
+Type: boolean
+Default: true
+_Description: Report installation of public packages to Go Dashboard?
+ goinstall reports the successful installation of the public packages to
+ godashboard.appspot.com, which increments a count associated with the
+ package and the time of its most recent installation. This mechanism
+ powers the package list at the Go Dashboard, allowing Go programmers to
+ learn about popular packages that might be worth looking at.
+ .
+ If you choose to participate, the goinstall will report each successful
+ installation to the Go Dashboard.
+ .
+ This choice can be later modified by running "dpkg-reconfigure
+ golang-weekly-go".
--
Packaging for Google Go
More information about the Pkg-google-commits
mailing list