mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-26 09:46:09 +00:00
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!
This commit is contained in:
parent
5eea285bed
commit
d2d57e3729
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=298358
30
Tools/scripts/options2ng.sh
Executable file
30
Tools/scripts/options2ng.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user