pkgsrc-Users archive

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

Perplexed about LOCALBASE vs. SU_CMD



For years (soon to be decades) I've always read that using 'sudo' as
one's SU_CMD could be accomplished by adding:

.if exists(${LOCALBASE}/bin/sudo)
SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
.endif

to one's "/etc/mk.conf".

I have never had this work.  If I use the above snippet, I end up with
the default:

  /usr/bin/su - root -c

Running 'make show-var VARNAME=LOCALBASE' reports the correct
value:

  /usr/pkg

  $ which sudo
  /usr/pkg/bin/sudo

yet the existence test for "${LOCALBASE}/bin/sudo" fails while an
explicit test for "/usr/pkg/bin/sudo" succeeds.  Thus, I've always
had to keep "/usr/pkg/bin/sudo" hard-coded in this construct.

I tried something like:

  TESTLOCALBASE=${LOCALBASE}

ahead of the test to see if there was something about lazy evaluation
of variables, but my "TESTLOCALBASE" showed the correct value as well.
Likewise:

  TESTLOCALBASE=${LOCALBASE}
  .if exists(${TESTLOCALBASE}/bin/sudo)
    SU_CMD=	sudo ${SH} -c
  .endif

fails in the same way.  If I explicitly set:

  TESTLOCALBASE=/usr/pkg

the test succeeds.  In case it matters, I keep pkgsrc-related stuff
inside of a big:

  .ifdef BSD_PKG_MK
  [...]
  .endif

construct in my "/etc/mk.conf" file.  I tried putting the test outside
it (before the block), but it made no difference.

What's going on and why does it appear to work for everyone else, but
not me?

-- 
|/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
|\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
| X  No HTML/proprietary data in email.   BSD just sits there and works!
|/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645



Home | Main Index | Thread Index | Old Index