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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: