]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-changelog
* cmdline/apt-changelog: Read server name from configuration
[apt.git] / cmdline / apt-changelog
index ac2b6e5fbda40b36f5834169770cf11953f23552..6d7c0e95fca2ca219755f1973266f2e971177477 100755 (executable)
@@ -26,7 +26,7 @@ if [ -z "$version" ]; then
 fi
 
 # turn binary package names into source
-if src=`apt-cache show $pkg 2>/dev/null| grep ^Source:`; then
+if src=`apt-cache show $pkg 2>/dev/null| grep -m 1 ^Source:`; then
     pkg=${src#Source: }
 fi
 
@@ -47,10 +47,18 @@ version=${version#*:}
 dir=`echo "$showsrc"| grep ^Directory:`
 dir=${dir#Directory: }
 
+# get configuration
+eval `apt-config shell SERVER Apt::Changelog::Server`
+
+if [ -z "$SERVER" ]; then
+    echo "ERROR: You need to set Apt::Changelog::Server configuration option" >&2
+    exit 1
+fi
+
 # fetch it
 OUT=`mktemp -t "${pkg}.changes.XXXXXX"`
 trap "rm $OUT" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
-if ! wget -q -O- http://changelogs.ubuntu.com/changelogs/$dir/${pkg}_${version}/changelog > "$OUT"
+if ! wget -q -O- ${SERVER}/$dir/${pkg}_${version}/changelog > "$OUT"
 then
     echo "ERROR: changelog for this version is not (yet) available; try https://launchpad.net/ubuntu/+source/$pkg/+changelog" >&2
     exit 1