Bug #1983

Moving pkg_radd, pkg_search config to different location

Added by justin about 3 years ago. Updated about 3 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

For configuring pkg_radd/pkg_search, how about /usr/pkg/etc/mk.conf
instead of /etc/settings.conf or /etc/pkg_radd.conf. We create mk.conf
automatically anyway, so it will normally exist.

Putting the config for pkg_radd and pkg_search there makes sense in that
other pkgsrc config options go there. The default values would still work
as expected, even if mk.conf did not exist.

Also, this puts it in a place where it will integrate with the bin-install
target if a user wants to change it. I don't want to have to set the same
variable in multiple places to get the desired results.

diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc
index 71fcfbe..88d330d 100644
--- a/Makefile_upgrade.inc
+++ b/Makefile_upgrade.inc
@@ -1586,4 +1586,3 @@ TO_REMOVE+=/usr/share/man/man4/i386/ndis.4.gz
TO_REMOVE+=/usr/sbin/ndiscvt
TO_REMOVE+=/usr/share/man/cat8/ndiscvt.8.gz
TO_REMOVE+=/usr/share/man/man8/ndiscvt.8.gz
-TO_REMOVE+=/etc/settings.conf
diff --git a/etc/pkg_radd.conf b/etc/pkg_radd.conf
deleted file mode 100644
index e9682b6..0000000
--- a/etc/pkg_radd.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-# This config file controls where pkg_radd looks for pkgsrc binaries.
-# The example here is the default.
-# Consult the dragonflybsd.org website for a list of mirrors.
-# The path should lead to a directory containing the architectures,
-# like 'i386' and x86_64. The correct arch and DragonFly version is
-# automatically appended to the path by pkg_radd.
-#
-# BINPKG_BASE=http://mirror-master.dragonflybsd.org/packages
-#
diff --git a/usr.bin/pkg_radd/pkg_radd.1 b/usr.bin/pkg_radd/pkg_radd.1
index a6d5300..c2c33ae 100644
--- a/usr.bin/pkg_radd/pkg_radd.1
+++ b/usr.bin/pkg_radd/pkg_radd.1
@@ -47,11 +47,11 @@ variable to the
default
.Xr pkgsrc 7
binary package server or uses the global
-.Pa /etc/pkg_radd.conf
+.Pa /usr/pkg/etc/mk.conf
config file to calculate
.Ev PKG_PATH .
In
-.Pa /etc/pkg_radd.conf ,
+.Pa /usr/pkg/etc/mk.conf ,
set
.Ev BINPKG_BASE
to your favorite binary packages mirror URL to allow
@@ -87,7 +87,7 @@ If you add the following line
.Dl "BINPKG_BASE=http://mirror-master.dragonflybsd.org/packages"
.Pp
to
-.Pa /etc/pkg_radd.conf ,
+.Pa /usr/pkg/etc/mk.conf ,
.Nm
fetches packages from the main
.Dx
diff --git a/usr.bin/pkg_radd/pkg_radd.sh b/usr.bin/pkg_radd/pkg_radd.sh
index 10d903c..ef44806 100644
--- a/usr.bin/pkg_radd/pkg_radd.sh
+++ b/usr.bin/pkg_radd/pkg_radd.sh
@@ -31,7 +31,8 @@

osver=`uname -r | awk -F - '{ print $1; }'`
cpuver=`uname -p | awk -F - '{ print $1; }'`
-[ -f /etc/pkg_radd.conf ] && . /etc/pkg_radd.conf
+[ -f /etc/settings.conf ] && . /etc/settings.conf # deprecated
+[ -f /usr/pkg/etc/mk.conf ] && . /usr/pkg/etc/mk.conf
: ${BINPKG_BASE:=http://mirror-master.dragonflybsd.org/packages}
: ${BINPKG_SITES:=$BINPKG_BASE/$cpuver/DragonFly-$osver/stable}
: ${PKG_PATH:=$BINPKG_SITES/All}
diff --git a/usr.bin/pkg_search/pkg_search.sh
b/usr.bin/pkg_search/pkg_search.sh
index 31e5df8..dc905a2 100644
--- a/usr.bin/pkg_search/pkg_search.sh
+++ b/usr.bin/pkg_search/pkg_search.sh
@@ -39,7 +39,8 @@ set_binpkg_sites() {
UNAME=`uname -s`
osver=`uname -r | awk -F - '{ print $1; }'`
cpuver=`uname -p | awk -F - '{ print $1; }'`
-[ -f /etc/settings.conf ] && . /etc/settings.conf
+[ -f /etc/settings.conf ] && . /etc/settings.conf # deprecated
+[ -f /usr/pkg/etc/mk.conf ] && . /usr/pkg/etc/mk.conf
set_binpkg_sites

NO_INDEX=0

History

#1 Updated by thomas.nikolajsen about 3 years ago

/usr/pkg/etc/mk.conf isn't a good file location,
as other pkgsrc install directory (LOCALBASE) can be used,
also 'etc' directory for pkgsrc can be set separately (PKG_SYSCONFBASE),
see link below.

If pkgsrc directory is used location must be determined;
I'm not sure how this is done;
see also mail archive thread on this very same topic:
http://leaf.dragonflybsd.org/mailarchive/kernel/2008-01/msg00014.html

You could also just stick to using file location in /etc ;-)

-thomas
-
http://www.pkgsrc.net/docs/pkgsrc/files.html

#2 Updated by justin about 3 years ago

On Tue, February 8, 2011 6:06 am, Thomas Nikolajsen \(via DragonFly issue
tracker\) wrote:
>
> Thomas Nikolajsen <> added the comment:
>
> /usr/pkg/etc/mk.conf isn't a good file location,
> as other pkgsrc install directory (LOCALBASE) can be used,
> also 'etc' directory for pkgsrc can be set separately (PKG_SYSCONFBASE),
> see link below.
>
> If pkgsrc directory is used location must be determined;
> I'm not sure how this is done;
> see also mail archive thread on this very same topic:
> http://leaf.dragonflybsd.org/mailarchive/kernel/2008-01/msg00014.html
>
> You could also just stick to using file location in /etc ;-)

Then instead of using /usr/pkg/etc/mk.conf, we use $PKG_SYSCONFDIR/mk.conf
in there, with $PKG_SYSCONFDIR being set to /usr/pkg/etc by default.

If a person is using a different location for their pkgsrc install,
they're probably setting those different variables already just to be able
to reach the files.

The scenario where this would affect a person with a pkgsrc install in a
different location is this: they'd have to :
- install to a different location than /usr/pkg
- not set anything to accomodate this; LOCALBASE, path, etc
- not have set BINPKG_SITES in their environment
- be using pkg_radd or pkg_search
- ignored documentation in the man page that says "$PKG_SYSCONFDIR,
defaulting to /usr/pkg"
- want to use a different download location than the default
- have entered location in /different/location/for/etc/mk.conf

Pkgsrc installs are supposed (generally) to stay within the installed
$prefix. We're duplicating a basic pkgsrc variable outside of the pkgsrc
$prefix. These changes correct for that - I don't want to ever have to
say to somebody, "Oh, you changed the wrong BINPKG_SITES setting."

#3 Updated by justin about 3 years ago

On Tue, February 8, 2011 11:32 pm, Justin C. Sherrill wrote:

> Then instead of using /usr/pkg/etc/mk.conf, we use $PKG_SYSCONFDIR/mk.conf
> in there, with $PKG_SYSCONFDIR being set to /usr/pkg/etc by default.
>
> If a person is using a different location for their pkgsrc install,
> they're probably setting those different variables already just to be able
> to reach the files.

After thinking about it, even if all these things came to pass and mk.conf
wasn't found, BINPKG_SITES would still be set by

: ${BINPKG_BASE:=http://mirror-master.dragonflybsd.org/packages}

So this problem situation wouldn't arise, but BINPKG_SITES would still be
set in one location within pkgsrc files.

Also available in: Atom PDF