aboutsummaryrefslogtreecommitdiffstats
path: root/Tools/scripts
diff options
context:
space:
mode:
authorChris Rees <crees@FreeBSD.org>2012-06-04 23:03:26 +0800
committerChris Rees <crees@FreeBSD.org>2012-06-04 23:03:26 +0800
commitd2d57e3729593d4280237b6d8563ea6f06782f5b (patch)
treee3b2d80347aded6c58f0804ab67a635cb77d919b /Tools/scripts
parent5eea285bed51a8e3c7c9da0e81ff275e9d099121 (diff)
downloadfreebsd-ports-gnome-d2d57e3729593d4280237b6d8563ea6f06782f5b.tar.gz
freebsd-ports-gnome-d2d57e3729593d4280237b6d8563ea6f06782f5b.tar.zst
freebsd-ports-gnome-d2d57e3729593d4280237b6d8563ea6f06782f5b.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/scripts')
-rwxr-xr-xTools/scripts/options2ng.sh30
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