tech-pkg archive

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

Re: How do I discover the default PKG_DBDIR ?

    Date:        Sun, 30 Aug 2009 21:39:58 +0200
    From:        Joerg Sonnenberger <>
    Message-ID:  <>

  | Yes, it is. It can easily be overriden by various means, which just
  | increases the question of why it is desirable to know it.

I guess I could (and for my purposes it might actually work) demand that
the user always override the default, in which case I would know what it
is (I can read the env var just as easily as pkg_* can of course).

The question this raises for me is that given that the user can set
the thing to anything they like, and that actually gets used, why would
you even hesitate to make the default value (used when the user doesn't
explicitly set one) known?

  | Being able to
  | backup the pkgdb in its entirely is reasonable and doesn't require
  | knowledge of the pkgdb internals, which is my concern. 

For my purposes, I assure you, I don't care about the internals, I
just want to find where the thing can be found in the filesys, you
can go ahead and do whatever you like to what's stored in there, and
it won't have any effect on me at all.

I did a little more looking, and it appears as if my alternate method
        man pkg_admin | sed ...

isn't going to work, as it appears as if the man page is going to say
"/var/db/pkg" regardless of what the actual default value is - eg: I see
in bootstrap/README.AIX that the default is instructed to be set to
/usr/pkg/pkgdb - but it looks to me as if (even on AIX, though I have
no AIX system to test my hypothesis) the man page will still say
/var/db/pkg is the default.   That I suggest is a bug.

Given that, unless either you agree to add some method to inform people
of the (actual) default (where the database really lives) and if I don't
decide that demanding that the PKG_DBDIR env var always be set (I hate
env vars that are mandatory), then my next method, which does seem to
work (given one big assumption) is ...

        strings /path/to/pkg_admin | grep '/pgk$'

but I'm less confident that strings(1) exists everywhere than I am
that man does.   This method also assumes that the last component of
the database directory name is "pkg" (which now I read what I typed above,
I see it isn't on AIX, so I guess I'd need a different grep pattern, and
more heuristics).   But the string is there compiled into the binary, and
one way or the other, I'll extract it...

An option (command, or whatever) to pkg_admin (or any of the other
commands) would be a lot easier though!


Home | Main Index | Thread Index | Old Index