Tag Archives: portconf

Converting existing OPTIONS to FreeBSD portconf format

If you started using under-documented ports-mgmt/portconf software to manage options of your ports, and looking forward to convert existing /var/db/ports/${PORTNAME}/options files to its format, then check out following script, I hacked:

% cd /var/db/ports;
% for i in *; do \
>        name=$(echo /usr/ports/*/$i |sed -e 's/distfiles\/[^[:space:]]*//g' -e s/\/usr\/ports\///g);\
>        cat $i/options  |gawk '!/#/ && ! /^_/ { print $1" | " }' |xargs echo $name: ;\
> done |sed -e 's/^[[:space:]]*//g' -e 's/|[[:space:]]*$//g' -e '/:[[:space:]]*$/d'

I originally hacked it on GNU/Linux, and I think it needs lang/gawk port because of gsub function, but I’m not sure.