Solved Finding differences between default and custom ports options

Hello,

I'm running a handful of "old" FreeBSD 8.4 servers, all of them were installed years ago, and use many ports. Some ports have custom compilation options ( make config), but I don't know which ones, and more importantly, I'm not sure those custom options are still relevant. I can't afford to reinstall from scratch, and I would like to migrate as many ports as possible to pkg.

Is there a way to list which ports have custom options, and more importantly what these options are?
 
Re: Finding differences between default and custom ports opt

Custom options typically live in /var/db/ports/${port}/options.

find /var/db/ports -name options

The syntax in the files should be pretty self-explanatory.
 
Re: Finding differences between default and custom ports opt

This won't work, because the file is created even if options are left in their default state/value. So it does not allow me to check if I've installed a port with custom options, or if it's just defaults.
 
Re: Finding differences between default and custom ports opt

Quick and dirty:

Move /var/db/ports to /var/db/ports-orig, put an empty /var/db/ports back in place, and run make config on all ports that had options files (always keep the defaults). Then diff -q the two options files for each port. The ones that show up as different have non-default (or now-changed) options.

Of course, if your old options files have the old syntax, you'll have to do manual inspection for each option.
 
Re: Finding differences between default and custom ports opt

Code:
make showconfig > /tmp/newopts
make rmconfig
make showconfig > /tmp/defaultopts
diff -u /tmp/defaultopts /tmp/newopts

Of course, this resets the options, so you have to use make config to reset them. I don't know if there is a way to feed the showconfig output back in automatically.
 
Re: Finding differences between default and custom ports opt

make rmconfig output is not so interesting, but I get you intended to write something like this:

Code:
make showconfig > /tmp/newopts
make rmconfig 
make showconfig > /tmp/defaultopts
diff -u /tmp/defaultopts /tmp/newopts

It looks interesting, and I can backup /var/db/ports/ so a reset is not a major problem. Thanks.
 
Hello,

During an upgrade from FreeBSD 9.3R to FreeBSD 10.1R I've had to rethink all this ports vs pkg problem. I've explored a little bit ports() and pkg-info() and came up with the idea of a shell script that would allow the comparison of OPTIONS without having to reset them. Here it is:

Code:
#!/usr/local/bin/bash

BOLD=`echo -en "\033[1m"`
ENDBOLD=`echo -en "\033[0m"`

BOGUS_PDBDIR=/tmp
WORKINGDIR=/tmp
SUF="_orig"
PORTS=/usr/ports

pkg info -o -a | while read PNAM PORI; do
if [ -d ${PORTS}/${PORI} ]; then
  cd ${PORTS}/${PORI}
  make showconfig > ${WORKINGDIR}/${PNAM}
  PORT_DBDIR=$BOGUS_PDBDIR make showconfig > ${WORKINGDIR}/${PNAM}${SUF}
  if [ $(diff -q ${WORKINGDIR}/${PNAM} ${WORKINGDIR}/${PNAM}${SUF} | wc -l) -gt 0 ]; then
   echo ${BOLD}${PNAM}${ENDBOLD}
   diff -y --suppress-common-lines ${WORKINGDIR}/${PNAM} ${WORKINGDIR}/${PNAM}${SUF}
   echo
  fi
else
  echo ${BOLD}${PNAM}${ENDBOLD}
  echo "   ${PNAM} might have moved, ${BOLD}check UPDATING${ENDBOLD}"
  echo
fi
done

If you want to speed up the script, you can add
Code:
[ -f ${WORKINGDIR}/${PNAM}${SUF} ] ||
at the begining of line 15
Code:
PORT_DBDIR=$BOGUS_PDBDIR make....
so that it will skip the make showconfig with default OPTIONS if the file already exists.

It's obviously not foolproof, but it's enough for me at this point.
Sample output:

Code:
bash-4.3.33
     SYSLOG=on: Syslog logging support                  |         SYSLOG=off: Syslog logging support

curl-7.42.1
     COOKIES=off: Cookies support                  |         COOKIES=on: Cookies support

db41-4.1.25_4
   db41-4.1.25_4 might have moved, check UPDATING

It allows me to make a full pkg upgrade and to review/reinstall ports manually when I need particular options.
It also allows me to pkg lock those ports before upgrading everything else if I think its more appropriate.
 
Back
Top