#!/bin/sh # # $FreeBSD$ # # This script makes a backup of the ports OPTIONS database and then converts # all of the saved files to the new format. usage() { < $tmpfile for option in $(sed -ne 's/^WITH_\([^=]*\)=true/\1/p' < $optionsfile) do echo "OPTIONS_FILE_SET+=$option" >> $tmpfile options_read="${options_read} $option" done for option in $(sed -ne 's/^WITHOUT_\([^=]*\)=true/\1/p' < $optionsfile) do echo "OPTIONS_FILE_UNSET+=$option" >> $tmpfile options_read="${options_read} $option" done echo "_FILE_COMPLETE_OPTIONS_LIST=$options_read" >> $tmpfile mv $tmpfile $optionsfile chmod 644 $optionsfile fi done ;; -f) filename=$2 if [ ! -f $filename ] then echo $filename does not exist! exit 2 fi tmpfile=$(mktemp /tmp/makeconfconvert.XXXXXXX) || exit 1 IFS=' ' for line in $(cat $filename) do if $(echo $line | grep -Eq '(PKGNG|DEBUG)') then echo $line >> $tmpfile else echo $line | sed -E \ -e 's,^WITH_([^=]*)=[ ]*.?[TtYy][RrEe][UuSs][Ee]?.?,OPTIONS_SET+= \1,' \ -e 's,^WITHOUT_([^=]*)=[ ]*.?[TtYy][RrEe][UuSs][Ee]?.?,OPTIONS_UNSET+= \1,' \ >> $tmpfile fi done diff -yW 80 $filename $tmpfile <