12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- set -e
- if [ "$#" -eq 2 ]; then
- file_in=$1
- file_out=$2
- inplace=0
- elif [ "$#" -eq 1 ]; then
- file_in=$1
- file_out=`mktemp`
- inplace=1
- else
- cat 1>&2 << EOF
- Usage: $0 <file_in> <file_out>
- The script reads an opkg config file specified by <file_in> and performs
- sanity checks. It may automatically fix some errors, especially those where the
- config syntax or option names have changed during an opkg upgrade. The fixed
- file will be written to <file_out> if this argument is given, otherwise
- <file_in> will be fixed in place. Warning and error messages will be printed to
- stderr.
- EOF
- exit 1
- fi
- awk_lists_dir='$1 == "lists_dir" { print "option lists_dir " $3 ; \
- print "Fixed: " $0 " -> option lists_dir " $3 > "/dev/stderr" ; \
- next }'
- awk_script="$awk_lists_dir 1"
- awk "$awk_script" < $file_in > $file_out
- if [ "$inplace" -eq 1 ]; then
- mv $file_out $file_in
- fi
|