2016-10-03 03:21:32 +08:00
|
|
|
#!/bin/bash
|
2019-06-24 22:01:18 +08:00
|
|
|
|
|
|
|
# Copyright © 2016-2017 Zetok Zalbavar <zetok@openmailbox.org>
|
|
|
|
# Copyright © 2019 by The qTox Project Contributors
|
2016-10-03 03:21:32 +08:00
|
|
|
#
|
2019-06-24 22:01:18 +08:00
|
|
|
# This file is part of qTox, a Qt-based graphical interface for Tox.
|
|
|
|
# qTox is libre 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 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
2016-10-03 03:21:32 +08:00
|
|
|
#
|
2019-06-24 22:01:18 +08:00
|
|
|
# qTox 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.
|
2016-10-03 03:21:32 +08:00
|
|
|
#
|
2019-06-24 22:01:18 +08:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with qTox. If not, see <http://www.gnu.org/licenses/>
|
2016-10-03 03:21:32 +08:00
|
|
|
|
2017-02-11 13:52:06 +08:00
|
|
|
|
|
|
|
# script to change qTox version in `.nsi` files to supplied one
|
2016-12-07 23:51:26 +08:00
|
|
|
#
|
2016-10-03 03:21:32 +08:00
|
|
|
# requires:
|
|
|
|
# * files `qtox.nsi` and `qtox64.nsi` in working dir
|
|
|
|
# * GNU sed
|
|
|
|
|
|
|
|
# usage:
|
|
|
|
#
|
2017-02-11 13:52:06 +08:00
|
|
|
# ./$script $version
|
|
|
|
#
|
|
|
|
# $version has to be composed of at least one number/dot
|
2016-10-03 03:21:32 +08:00
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
|
2017-02-11 13:52:06 +08:00
|
|
|
# change version in .nsi files in the right line
|
|
|
|
change_version() {
|
2016-10-03 03:21:32 +08:00
|
|
|
for nsi in *.nsi
|
|
|
|
do
|
2017-02-11 13:52:06 +08:00
|
|
|
sed -i -r "/DisplayVersion/ s/\"[0-9\\.]+\"$/\"$@\"/" "$nsi"
|
2016-10-03 03:21:32 +08:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2017-02-11 13:52:06 +08:00
|
|
|
# exit if supplied arg is not a version
|
|
|
|
is_version() {
|
|
|
|
if [[ ! $@ =~ [0-9\\.]+ ]]
|
|
|
|
then
|
|
|
|
echo "Not a version: $@"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
|
|
|
is_version "$@"
|
|
|
|
|
|
|
|
change_version "$@"
|
|
|
|
}
|
|
|
|
main "$@"
|