summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2016-01-27 20:49:46 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2016-01-27 20:49:46 +0000
commit7674bf80eba363498f3e3301c879962fb4059a4b (patch)
tree5f153301c6e723cd5f1f4457dd82e7871c77f704 /usr.sbin/pkg_add
parent193b43f889a3d021cb93e1db9b8afb322f12d086 (diff)
Allow pkg.conf's installpath to be set to a bare hostname (no /), which
implies http://hostname/pub/OpenBSD/[snapshots-or-version]/packages/[arch]. This could be handled at a different location in the code to support PKG_PATH but this approach is pretty simple and I have something else to make use of it. ok espie@ for now.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocator.pm3
-rw-r--r--usr.sbin/pkg_add/pkg.conf.512
2 files changed, 9 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index 90886529a17..cfbbf18e1e5 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageLocator.pm,v 1.103 2014/03/18 18:53:29 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.104 2016/01/27 20:49:45 sthen Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -44,6 +44,7 @@ sub build_default_path
return unless defined $state->config->value('installpath');
for my $i ($state->config->value("installpath")) {
+ $i =~ s/(^[a-z0-9][a-z0-9.]+\.[a-z0-9.]+$)/http:\/\/$1\/%m/;
$default_path->add(OpenBSD::PackageRepository->new($i, $state));
}
}
diff --git a/usr.sbin/pkg_add/pkg.conf.5 b/usr.sbin/pkg_add/pkg.conf.5
index 2dced2311eb..55a3eb5ba58 100644
--- a/usr.sbin/pkg_add/pkg.conf.5
+++ b/usr.sbin/pkg_add/pkg.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pkg.conf.5,v 1.8 2015/04/16 19:59:28 jmc Exp $
+.\" $OpenBSD: pkg.conf.5,v 1.9 2016/01/27 20:49:45 sthen Exp $
.\"
.\" Copyright (c) 2010 Marc Espie
.\"
@@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: April 16 2015 $
+.Dd $Mdocdate: January 27 2016 $
.Dt PKG.CONF 5
.Os
.Sh NAME
@@ -82,10 +82,12 @@ will be expanded to
.Sq full mirror path
and
.Sq OS version
-respectively, e.g.\&
+respectively.
+If a bare hostname is given, the standard /pub/OpenBSD path will be
+used automatically, e.g.\&
.Bd -literal -offset indent
-installpath = http://somesite/pub/OpenBSD/%c/packages/%a/
-installpath += http://othersite/%m/
+installpath = http://somesite.example.org/updates/%c/%a/
+installpath += openbsd-mirror.example.org
.Ed
.Pp
should work.