diff options
author | crees <crees@FreeBSD.org> | 2012-06-04 23:03:26 +0800 |
---|---|---|
committer | crees <crees@FreeBSD.org> | 2012-06-04 23:03:26 +0800 |
commit | 751f02e64b1f97bf52b38d3a48612f878f087527 (patch) | |
tree | 762f0c0537ede2332d68b7e6b62e4a6263053332 /Tools | |
parent | 17bb36264f1bc2061a329eb5303d3284300ff604 (diff) | |
download | freebsd-ports-gnome-751f02e64b1f97bf52b38d3a48612f878f087527.tar.gz freebsd-ports-gnome-751f02e64b1f97bf52b38d3a48612f878f087527.tar.zst freebsd-ports-gnome-751f02e64b1f97bf52b38d3a48612f878f087527.zip |
Add script to convert old-style OPTIONS database files to new format.
If you are having trouble with saved OPTIONS not being recognised, just run
this as root and you will have no further trouble!
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/options2ng.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Tools/scripts/options2ng.sh b/Tools/scripts/options2ng.sh new file mode 100755 index 000000000000..f3c7809f7c2c --- /dev/null +++ b/Tools/scripts/options2ng.sh @@ -0,0 +1,30 @@ +#!/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. + +PORT_DBDIR=$(make -C /usr/ports/shells/bash -V PORT_DBDIR) + +tar cfz $(mktemp /tmp/optionsbackup.tar.gz.XXX) $PORT_DBDIR + +for optionsfile in $PORT_DBDIR/*/options +do if grep -q ^WITH $optionsfile ; then + options_read= + echo "Converting $optionsfile" + tmpfile=$(mktemp /tmp/optionsconvert.XXXXXXX) || exit 1 + grep '^[#_]' $optionsfile > $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 |