aboutsummaryrefslogtreecommitdiff
path: root/debian/pbuilder.postinst
diff options
context:
space:
mode:
authorEddy Petrisor <eddy@bounty.eddyp.homelinux.net>2007-06-25 19:40:48 +0300
committerEddy Petrisor <eddy@bounty.eddyp.homelinux.net>2007-06-28 02:16:32 +0300
commit7ed913ae27fe872aaa8b2cca4f906849ce1ca541 (patch)
tree84354d8248cc740a2a189726bb01568f99fe9231 /debian/pbuilder.postinst
parent397152d72ef3f637780ea5c9a28ad219daa9e327 (diff)
downloadpbuilder-7ed913ae27fe872aaa8b2cca4f906849ce1ca541.tar
pbuilder-7ed913ae27fe872aaa8b2cca4f906849ce1ca541.tar.gz
a crude first version of the default mirror selection code
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"
+