NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to ensure pkgsrc groff is preferred over groff in base



On May 30, 2015, at 9:56 AM, Gerard Lally wrote:

What is the correct way to ensure pkgsrc binaries and libraries are
used instead of their equivalents in base? For example, after installing
pkgsrc groff I now have groff, grn, grodvi, grog and more in both
/usr/bin and /usr/pkg/bin. Do I create multiple aliases, or just change
$PATH so that /usr/pkg/bin is before /usr/bin? For user, and/or root?
Would changing $PATH create other problems elsewhere?


I was going to say login.conf and man.conf, but I found changing the path in login.conf didn't seem to change the path I was seeing on login, don't
know why.  But, if you do change path system wide, you change manpath in
to man.conf, to get the corresponding man page.

Comment out the existing _default in /etc/man.conf
and add a new one...

# default
#_default	/usr/{share,X11R7,X11R6,pkg,local}/man/
_default	/usr/pkg/man/ /usr/{share,X11R7,X11R6,local}/man/

Then add a new section 'system' after the other sections

# Other sections that represent complete man subdirectories.
X11R7		/usr/X11R7/man/
X11R6		/usr/X11R6/man/
packages	/usr/pkg/man/
local		/usr/local/man/
system          /usr/share/man/

You can specify section with man -s, like man -s system, man -s packages. You'll need to use man -s system, to get to what is shadowed by packages. OR, if you don't edit man.conf, you can use man -s packages groff, to find
the man page for the package groff, instead of the system groff.
Below is script that will list what's shadowed in your path. I've noticed it won't work if there are duplicates in PATH. Change to comment the first which, and uncomment the second, and it will only list what's shadowed, but
as is, you could strip execute from offending binaries ( chmod a-x ).

---shadowed----
#!/bin/ksh -p
SAVE_IFS="$IFS"
IFS="${IFS}:"
for X in $PATH ;
do
  cd $X || continue
  ls -1 >> /tmp/list.$$
done
IFS="$SAVE_IFS"
sort < /tmp/list.$$ >/tmp/sorted.$$  && rm /tmp/list.$$
for X in $(uniq  -d /tmp/sorted.$$ && rm /tmp/sorted.$$);
do
  which -a $X;print ""
  #which -a $X|sed 1d
done




Home | Main Index | Thread Index | Old Index