2018-09-21 23:18:08 +08:00
|
|
|
#!/bin/bash
|
|
|
|
#This file is part of FlightGear
|
|
|
|
#
|
|
|
|
#FlightGear is free software: you can redistribute it and/or modify
|
|
|
|
#it under the terms of the GNU General Public License as published by
|
|
|
|
#the Free Software Foundation, either version 2 of the License, or
|
|
|
|
#(at your option) any later version.
|
|
|
|
#
|
|
|
|
#FlightGear is distributed in the hope that it will be useful,
|
|
|
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
#GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
#You should have received a copy of the GNU General Public License
|
|
|
|
#along with FlightGear If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
if [ -z "$1" -o -z "$2" ]; then
|
|
|
|
echo "usage: major.minor.micro path"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
IFS='.' read -r -a VERSION_A <<< "$1"
|
|
|
|
shift
|
|
|
|
if [ ${#VERSION_A[@]} != 3 ]; then
|
|
|
|
echo "Need version as 'number.number.number'"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
MAJOR_VERSION=${VERSION_A[0]}
|
|
|
|
MINOR_VERSION=${VERSION_A[1]}
|
|
|
|
MICRO_VERSION=${VERSION_A[2]}
|
|
|
|
|
|
|
|
|
|
|
|
setVersionTo() {
|
|
|
|
local V="$1"
|
2020-10-26 17:29:23 +08:00
|
|
|
echo "setting version to $V in $2"
|
|
|
|
echo "$V" > $2
|
|
|
|
git add $2
|
2018-09-21 23:18:08 +08:00
|
|
|
echo "new version: $V" | git commit --file=-
|
|
|
|
git tag "version/$V"
|
|
|
|
}
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
echo "Processing $1"
|
|
|
|
pushd $1 > /dev/null
|
2020-10-26 17:29:23 +08:00
|
|
|
|
|
|
|
case $1 in
|
|
|
|
flightgear)
|
|
|
|
versionFileName="flightgear-version"
|
|
|
|
;;
|
|
|
|
simgear)
|
|
|
|
versionFileName="simgear-version"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
versionFileName="version"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2018-09-21 23:18:08 +08:00
|
|
|
git config user.name "Automatic Release Builder"
|
|
|
|
git config user.email "build@flightgear.org"
|
2020-10-26 17:29:23 +08:00
|
|
|
setVersionTo "${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}" $versionFileName
|
2018-09-21 23:18:08 +08:00
|
|
|
popd > /dev/null
|
|
|
|
shift
|
|
|
|
done
|