chiark / gitweb /
debman: With a version of debget that supports file: via curl, using it is
authorColin Watson <cjwatson@chiark.greenend.org.uk>
Sat, 11 Jan 2003 17:33:48 +0000 (17:33 +0000)
committerColin Watson <cjwatson@chiark.greenend.org.uk>
Sat, 11 Jan 2003 17:33:48 +0000 (17:33 +0000)
now feasible.

debman

diff --git a/debman b/debman
index 76c0b35..04fe31a 100755 (executable)
--- a/debman
+++ b/debman
@@ -83,12 +83,13 @@ TEMPDIR=`mktemp -dt debman.XXXXXXXXXX`
 trap 'rm -rf "$TEMPDIR"' EXIT ERR HUP INT QUIT TERM
 
 if [ -n "$PACKAGE" ]; then
-    # This duplicates debget; if an option is added there to use an
-    # externally-specified filename then we can use it instead.
-    FILENAME="$TEMPDIR/$PACKAGE.deb"
-    wget -O "$FILENAME" \
-        $(apt-get -q2 --print-uris --reinstall install "$PACKAGE" | \
-          sed -ne "\$s/^'\([^']*\)'.*$/\1/p")
+    (cd "$TEMPDIR" && debget "$PACKAGE")
+    # There should be at most one file in $TEMPDIR now.
+    FILENAME="`find \"$TEMPDIR\" -name \*.deb -print`"
+    if [ -z "$FILENAME" ]; then
+        echo "Failed to fetch package $PACKAGE; exiting." >&2
+        exit 1
+    fi
 fi
 
 # Ignore errors from tar (though not dpkg). They'll generally just be of the