1#!/bin/bash
2
3if [ "$#" -ne 2 ]; then
4    echo "Usage: $0 \"<version>\" \"<date>\""
5    exit 1
6fi
7
8# Change the current working directory to the parent directory of this script.
9cd $(dirname `realpath $0`)/..
10current_version="6\\.x"
11source_dirs="common ports"
12file_list=$(find $source_dirs -type f -name '*.[ch]' -print)
13
14sed -i "s/$current_version  /$1/g" $file_list
15sed -i "s/$current_version/$1/g" $file_list
16sed -i "s/xx-xx-xxxx/$2/g" $file_list
17sed -i "s/xx\/xx\/xxxx/${2:0:2}\/${2:3:2}\/${2:6:4}/g" readme/*
18
19# Update version in port files
20source_dirs="ports"
21file_list=$(find $source_dirs -type f -name "*.h" -print)
22sed -i "/\"Copyright/,/[0-9]\.[0-9]/s/[0-9]\.[0-9\.]\+/$1/" $file_list