pkg_add Environment on FreeBSD

8,526

The difference between PACKAGEROOT and PACKAGESITE is that PACKAGEROOT retains the original directory logic and PACKAGESITE does not. These are correct:

PACKAGEROOT=ftp://ftp.freebsd.org

PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.0-release/Latest/

In answer to your questions:

  1. It means pkg_add it couldn't find the file. You're seeing it only with PACKAGESITE because setting that variable overrides the search process, which would usually yield "Couldn't find package foo."

  2. It does. When you have PACKAGESITE specified, all "pkg_add -r foo" does is try to open up $PACKAGESITE/foo.tbz. Do you see the problem? Go to your PACKAGESITE value and look for enlightenment.tbz.

    You didn't find it. The closest you found was enlightenment-0.16.999.042_3,2.tbz. So pkg_add -r "enlightenment-0.16.999.042_3,2" would work. Change your PACKAGESITE to ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.0-release/Latest/ and it'll work.

    This is the whole reason the Latest/ subdirectory exists.

Share:
8,526

Related videos on Youtube

gvkv
Author by

gvkv

Updated on September 17, 2022

Comments

  • gvkv
    gvkv almost 2 years

    Suppose you want to add a package foo but when you invoke pkg_add via:

    pkg_add -r foo
    

    you get an error:

    Error: Unable to get ftp://.../foo.tbz: File unavailable ...
    

    It's not a problem since according to pkg_add's man page, all you have to do is to set the PACKAGEROOT environment variable to the root directory of foo:

    PACKAGEROOT=ftp://root/to/package
    

    Not so fast! It is a problem--it doesn't work! If you don't export PACKAGEROOT, then pkg_add uses its default location and exporting PACKAGEROOT give you the error:

    pkg_add: can't stat package file 'foo'
    

    The same holds when setting the PACKAGESITE variable.

    Now, I have actually solved this problem:

    pkg_add -r ftp://my/package/root/foo.tbz
    

    works fine. Nevertheless, I have two questions:

    1. What exactly does can't stat package file 'foo' mean?
    2. Why doesn't this work as advertised?

    For the interested, I experienced this problem when trying to install Enlightenment. The ports version is old and I didn't want to compile anyway since that takes a while. I set PACKAGEROOT and PACKAGESITE independently via different terminal sessions:

    export PACKAGEROOT=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.0-release/x11-wm
    

    and

    export PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.0-release/x11-wm/
    

    but neither worked.

  • gvkv
    gvkv over 14 years
    I most certainly does not work as advertised. Nowhere in the man page does it mention in any way whatsoever that you have to add 'Latest' on to the end of the URLs and the handbook's example doesn't bring attention to that at all. Moreover, the URLs i gave in my example actually contain the packages that I'm looking for. It may work, but the documentation needs to be 'there' in the case of the man pages and requiring 'Latest' on the end of the URL needs to be highlighted in the case of the handbook.
  • rodjek
    rodjek over 14 years
    OK. Rage a bit less and think about it logically. Why would you set PACKAGESITE to a full path to the package and then specify the package name again in the command? Seems a bit too redundant to be the correct way to use the command. Unfortunately, it's not possible to highlight all the important parts of the handbook, as it's all important (some bits to you, some bits to others). Put simply - Grow up, read the documentation carefully and stop whining.
  • gvkv
    gvkv over 14 years
    The PACKAGESITE I gave originally is a typo--it's now fixed as I used a URL to a directory in practice. Regardless, nothing you have said refutes any points in my comment--there is no reason to use the URL you gave in either the man page or the handbook. I have no rage, just a desire for clarity. I consider this closed.
  • rodjek
    rodjek over 14 years
    Except that I pulled that export line straight from the handbook... But you're right, there's definitely nothing in the handbook about it.
  • voretaq7
    voretaq7 over 11 years
    Note that bash should probably not be your root shell (or at least not root's login shell) -- Bash is installed in /usr/local with lots of dependencies by default. If you need to get into the system as root one day and the dependencies are broken (or /usr/local didn't mount) you still want root to have a working shell - one of the standard ones under /bin. You can of course launch bash yourself after you've logged in :-)