Convert FreeBSD port custom options in /var/db/ports into a /etc/make.conf compatable file.

A quick little script to convert /var/db/ports into a make.conf file. Useful when bulk building ports with poudriere.

for dir in /var/db/ports/*; do
if [ -e $dir/options ]; then
OPTIONS_SET=$(grep OPTIONS_FILE_SET $dir/options | sed s/OPTIONS_FILE_SET// | sed s/+=//);
OPTIONS_UNSET=$(grep OPTIONS_FILE_UNSET $dir/options | sed s/OPTIONS_FILE_UNSET// | sed s/+=//);
if [ ! -z "$OPTIONS_SET" ]; then
echo $(basename $dir)_SET+=${OPTIONS_SET};
fi
if [ ! -z "$OPTIONS_UNSET" ]; then
echo $(basename $dir)_UNSET+=${OPTIONS_UNSET};
fi
fi
done > make.conf

If you want to omit some common options

OPTIONS_SET=$(grep OPTIONS_FILE_SET $dir/options | sed s/OPTIONS_FILE_SET// | sed s/+=// | sed s/DOCS// | sed s/EXAMPLES// | sed s/NLS// | sed s/X11// | sed s/GTK2// | sed s/FONTCONFIG// | sed s/QT4//);
OPTIONS_UNSET=$(grep OPTIONS_FILE_UNSET $dir/options | sed s/OPTIONS_FILE_UNSET// | sed s/+=// | sed s/DOCS// | sed s/EXAMPLES// | sed s/NLS// | sed s/X11// | sed s/GTK2// | sed s/FONTCONFIG// | sed s/QT4//);
Pacy
Powered by Pacy