Hack to sysctl kern.osreldate, for ports cluster

Craig Rodrigues rodrigc at crodrigues.org
Sat Jan 8 10:50:50 PST 2005


On Sat, Jan 08, 2005 at 03:47:14AM -0600, Conrad J. Sabatier wrote:
> On Sat, 8 Jan 2005 02:13:24 -0500, Craig Rodrigues
> <rodrigc at crodrigues.org> wrote:
> 
> > Hi,
> > 
> > 
> > On http://pointyhat.freebsd.org/errorlogs/ it states
> > that sysctl should not be used to determine the
> > version of FreeBSD, and that uname(1) or the OSVERSION
> > variable should be used instead.
> > 
> > While a valid thing to do, this is another detail
> > for port maintainers to keep track of.
> > 
> > 
> > What do you think of this hack to sysctl,
> > which cats /usr/include/sys/param.h to get the
> > value of kern.osreldate, instead of going to
> > the true kernel sysctl variable?
> 
> Well, while it's certainly a "doable" thing, don't you think it's just a
> little bit dangerous?  What about when the source tree is not in sync
> with the currently running kernel?

The scenario which you are describing is exactly how the
ports are built now.  From,  http://pointyhat.freebsd.org/errorlogs/

   "The ports are built on 6.x-current machines. Some of the 5.x-stable
    and 4.x-stable failures may be because of that. If your port depends
    on the result of uname(3) or sysctl to determine the running version
    of FreeBSD, change it to use uname(1) instead (the builds use a
    dummy uname(1) that reports the target version of FreeBSD), or
    change it to use the value of the OSVERSION variable that can be
    passed in from the port makefile."

This hack to sysctl which I provided is not for general use
and should only be used in Kris's chroot'd environment which
he uses to build the ports.

See: http://pointyhat.freebsd.org/errorlogs/ and look at the
tarballs next to the text "Every port is built in its own chroot environment".

-- 
Craig Rodrigues        
rodrigc at crodrigues.org


More information about the freebsd-ports mailing list