Module Name: othersrc
Committed By: cheusov
Date: Mon Nov 14 11:12:38 UTC 2011
Modified Files:
othersrc/usr.sbin/pkg_setup: pkg_setup
Log Message:
Add option '-p <pkgs>' for installing specified packages in addition to
pkg_install.
Example: pkg_setup -v -d http://example.org/pkgsrc/linux/repo -p nih
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.2 othersrc/usr.sbin/pkg_setup/pkg_setup:1.3
--- othersrc/usr.sbin/pkg_setup/pkg_setup:1.2 Sun Nov 6 17:53:52 2011
+++ othersrc/usr.sbin/pkg_setup/pkg_setup Mon Nov 14 11:12:37 2011
@@ -1,6 +1,6 @@
#!/bin/sh
-# $NetBSD: pkg_setup,v 1.2 2011/11/06 17:53:52 cheusov Exp $
+# $NetBSD: pkg_setup,v 1.3 2011/11/14 11:12:37 cheusov Exp $
#
# Copyright (c) 2011 Aleksey Cheusov <[email protected]>
#
@@ -42,10 +42,19 @@ ${0##*/} downloads pkg_install binary pa
usage: ${0##*/} [options] [-- [pkg_add options]]
options:
- -h display this screen
- -v verbose output
- -d url to binary repository, the default is
- http://ftp.netbsd.org/pub/pkgsrc/packages/\$OPSYS/\$ARCH/\$OSVER
+ -h display this screen
+ -v verbose output
+ -d <url> url to binary repository, the default is
+ http://ftp.netbsd.org/pub/pkgsrc/packages/\$OPSYS/\$ARCH/\$OSVER
+ -p <packages> install specified packages in addition to pkg_install
+
+Examples:
+ pkg_setup
+
+ pkg_setup -v -d http://example.org/pkgsrc/linux/repo -p nih
+
+ env FTP_CMD='ftp -4V' ./pkg_setup -v \
+ -d http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/5.0 -- -P /tmp
EOF
}
@@ -55,7 +64,7 @@ vecho (){
fi
}
-while getopts hvd: f; do
+while getopts hvd:p: f; do
case $f in
h)
usage
@@ -64,6 +73,8 @@ while getopts hvd: f; do
verbose=1;;
d)
URL="$OPTARG";;
+ p)
+ packages="$OPTARG";;
\?)
exit 1;;
esac
@@ -88,7 +99,14 @@ vecho "Downloading $pkgname.tgz..."
$FTP_CMD "$URL/All/$pkgname.tgz"
gzip -dc "$pkgname.tgz" | tar -xf -
-vecho "Installing..."
+vecho "Installing pkg_install..."
./sbin/pkg_add "$@" ./"$pkgname.tgz"
+if test -n "$packages"; then
+ vecho "Installing $packages..."
+ PKG_PATH="$URL/All"
+ export PKG_PATH
+ ./sbin/pkg_add "$@" $packages
+fi
+
vecho "done"