aboutsummaryrefslogtreecommitdiff
path: root/debian/pbuilder.postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/pbuilder.postinst')
-rwxr-xr-xdebian/pbuilder.postinst20
1 files changed, 20 insertions, 0 deletions
diff --git a/debian/pbuilder.postinst b/debian/pbuilder.postinst
new file mode 100755
index 0000000..f326182
--- /dev/null
+++ b/debian/pbuilder.postinst
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+. /usr/share/debconf/confmodule
+
+CONFFILE=/etc/pbuilderrc
+
+db_get pbuilder/mirrorsite
+MIRRORSITE="$RET"
+
+if [ "$MIRRORSITE" = "_" ]
+then
+ MIRRORSITE=$(grep -E '^deb ' /etc/apt/sources.list | head -n 1 | awk '{print $2;}')
+ db_set pbuilder/mirrorsite "$MIRRORSITE"
+ db_input medium pbuilder/mirrorsite
+ db_go
+fi
+
+TMPFILE=`mktemp`
+cat "$CONFFILE" | sed "s#MIRRORSITE=.*\$#MIRRORSITE=$MIRRORSITE#" > "$TMPFILE" && mv "$TMPFILE" "$CONFFILE"
+