Hack to sysctl kern.osreldate, for ports cluster

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


On Sat, Jan 08, 2005 at 12:20:48PM -0800, Kris Kennaway wrote:
> I think I'd prefer to use a shell script wrapper around the real
> sysctl than to maintain local patches in every source tree I carry
> around.

It's easier to hack the sysctl binary itself, but I understand
your concern.

How about something like this:


#!/bin/sh

SYSCTL=/sbin/sysctl

for ARG in $@
do
   if [ "$ARG" = "kern.osreldate" ]
   then
     KERN_OSRELDATE=1
   elif [ "$ARG" = "-n" ]
   then
     NUMERIC=1
   fi
done


if [ ! -z "$KERN_OSRELDATE" ]
then
  if [ -z "$NUMERIC" ]
  then
    printf "kern.osreldate: "
  fi
  awk '/^#define __FreeBSD_version/ {print $3}' /usr/include/sys/param.h
  exit 0
fi

$SYSCTL $@
return $?
 


-- 
Craig Rodrigues        
rodrigc at crodrigues.org


More information about the freebsd-ports mailing list