# pkg_add -v -r goes to wrong directory



## siegfried01 (Apr 11, 2011)

When I type
`pkg_add -v -r perl`

I see


```
Error: Unable to get [url]ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.0-release/Latest/perl.tbz:[/url] File unavailable (e.g., 
file not found no access)
```

OK, see that there indeed is no such directory. I see a lot of other directories like package-8.2-release. Did I miss something in the man page? Apparently I need to tell *pkg_add* to use a directory like package-8.2-release. How do I do that?

Thanks,
siegfried


----------



## SirDice (Apr 11, 2011)

Set PACKAGESITE to the correct repository. See pkg_add(1).


----------



## siegfried01 (Apr 11, 2011)

Thanks! The link says


```
The environment variable PACKAGESITE specifies an alternate location for
     pkg_add to fetch from.  This variable subverts the automatic directory
     logic that pkg_add uses when the -r option is invoked.  Thus it should be
     a complete URL to the remote package file(s).
```

So I think that means it should point to the exact tgz file and not the directory? That is strange. It would be far more useful if I could set it to the release-8.1 directory. 

It sounds much more convenient to just specify the entire package name on the command line since I have to type the entire beast anyway. So what can I assume about compatibility? Since I am running v8.0 what would be the next most compatible directory? 8.1 would be my guess.

Thanks
siegfried


----------



## jb_fvwm2 (Apr 11, 2011)

```
ncftp ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/lang ; ls -lac pe*
```
  If you install ncftp(3) first, then use those commands and the "get" for the desired perl package, you can maybe pkg_add it locally.  (the "ls" command after connection at the ftp prompt)


----------



## Beastie (Apr 11, 2011)

siegfried01 said:
			
		

> So I think that means it should point to the exact tgz file and not the directory? That is strange. It would be far more useful if I could set it to the release-8.1 directory.
> 
> It sounds much more convenient to just specify the entire package name on the command line since I have to type the entire beast anyway.


It points to the directory. All available repositories are available here (for i386). For example, if you want let's say *8.2-RELEASE* packages, you point PACKAGESITE to this repository subdirectory.
The *8-STABLE* repository has the latest packages (just a few weeks or days behind ports).

If you're using a C-based shell, you can set the environment variable in /.cshrc, e.g.:

```
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.2-release/Latest/
```

You download packages and their dependencies like this:
`# pkg_add -r package_name`
package_name is the exact name without the path, version or *.tbz* extension. If you want to use versions, for any reason, change PACKAGESITE to point to the All directory instead of Latest.


----------



## SirDice (Apr 11, 2011)

siegfried01 said:
			
		

> So I think that means it should point to the exact tgz file and not the directory? That is strange. It would be far more useful if I could set it to the release-8.1 directory.


If you want the latest packages point it to a mirror and use the "*/Latest/" directory, for example:

```
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/
```

The Latest directory doesn't have specific version numbers so you can do
`# pkg_add -r portmaster`
instead of having to specify an exact version when using the All directory
`# pkg_add -r portmaster-3.6.1`

The "*/i386/*" refers to the architecture and "*/packages-8-stable/*" to the package tree.

Note that these packages are being build on an 8-stable system but should run fine on a -release. I do advise to update your 8.0, it's not supported anymore. Besides that the newer versions run better anyway :e

Oh, yeah, and what beasty says. I'm a bit slow today, must be the weather :h


----------

