Module Name: othersrc
Committed By: cheusov
Date: Thu Sep 13 20:09:04 UTC 2012
Modified Files:
othersrc/usr.sbin/pkg_setup: pkg_setup
Log Message:
Support for file:// protocol in URL
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/usr.sbin/pkg_setup/pkg_setup
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: othersrc/usr.sbin/pkg_setup/pkg_setup
diff -u othersrc/usr.sbin/pkg_setup/pkg_setup:1.3 othersrc/usr.sbin/pkg_setup/pkg_setup:1.4
--- othersrc/usr.sbin/pkg_setup/pkg_setup:1.3 Mon Nov 14 11:12:37 2011
+++ othersrc/usr.sbin/pkg_setup/pkg_setup Thu Sep 13 20:09:03 2012
@@ -1,6 +1,6 @@
#!/bin/sh
-# $NetBSD: pkg_setup,v 1.3 2011/11/14 11:12:37 cheusov Exp $
+# $NetBSD: pkg_setup,v 1.4 2012/09/13 20:09:03 cheusov Exp $
#
# Copyright (c) 2011 Aleksey Cheusov <[email protected]>
#
@@ -64,6 +64,16 @@ vecho (){
fi
}
+download (){
+ # $1 - URL
+ file=`echo "$1" | sed -n 's,file://,,p'`
+ if test -z "$file"; then
+ $FTP_CMD "$1"
+ else
+ cp "$file" .
+ fi
+}
+
while getopts hvd:p: f; do
case $f in
h)
@@ -88,7 +98,7 @@ test -n "$tmpdir" || exit 1
cd "$tmpdir"
vecho 'Downloading pkg_summary.gz...'
-$FTP_CMD "$URL/All/pkg_summary.gz"
+download "$URL/All/pkg_summary.gz"
pkgname=`gzip -dc pkg_summary.gz | awk -F= '/^PKGNAME=pkg_install-[0-9]/ {print $2; exit}'`
if test -z "$pkgname"; then
echo 'Cannot find package pkg_install in pkg_summary(5)' 1>&2
@@ -96,7 +106,7 @@ if test -z "$pkgname"; then
fi
vecho "Downloading $pkgname.tgz..."
-$FTP_CMD "$URL/All/$pkgname.tgz"
+download "$URL/All/$pkgname.tgz"
gzip -dc "$pkgname.tgz" | tar -xf -
vecho "Installing pkg_install..."