forked from ansible-middleware/wildfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bump-wildfly-version.txt
29 lines (23 loc) · 1.06 KB
/
bump-wildfly-version.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
For safety reason, it's not possible to add a script to the repository. Copy the script below and renamed it to .sh to run in order to bump the version of Wildfly use the script below:
#!/bin/bash
readonly INSTALL_DEFAULTS_FILE=${INSTALL_DEFAULTS_FILE:-'roles/wildfly_install/defaults/main.yml'}
readonly NEW_VERSION=${1}
usage() {
echo ''
echo "ex: $(basename ${0}) 29.0. 31.0.1.Final."
}
current_wfly_version() {
local current_version=$(grep -e 'wildfly_version: ' "${INSTALL_DEFAULTS_FILE}" | sed -e "s;wildfly_version: ;;" -e "s;';;g" -e 's;.Final;;')
echo "${current_version//[$'\t\r\n ']}"
}
readonly CURRENT_VERSION=${2:-$(current_wfly_version)}
echo "[${CURRENT_VERSION}]"
if [ -z "${NEW_VERSION}" ]; then
echo 'Please provide the new version, including .Final'
usage
exit 2
fi
for file_to_edit in $(grep -e "${CURRENT_VERSION}" -r roles/ molecule/ | cut -f1 -d: | sort -u)
do
sed -e "s;${CURRENT_VERSION}[0-9\.]*.Final;${NEW_VERSION};g" -i "${file_to_edit}"
done