forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a script to increase the version (ethereum#850)
* added script to update the bor version across all the locations * minor update
- Loading branch information
1 parent
f8032db
commit 1e181a9
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
|
||
echo "The version is of form - VersionMajor.VersionMinor.VersionPatch-VersionMeta" | ||
echo "Let's take 0.3.4-beta as an example. Here:" | ||
echo "* VersionMajor is - 0" | ||
echo "* VersionMinor is - 3" | ||
echo "* VersionPatch is - 4" | ||
echo "* VersionMeta is - beta" | ||
echo "" | ||
echo "Now, enter the new version step-by-step below:" | ||
|
||
version="" | ||
|
||
# VersionMajor | ||
read -p "* VersionMajor: " VersionMajor | ||
if [ -z "$VersionMajor" ] | ||
then | ||
echo "VersionMajor cannot be NULL" | ||
exit -1 | ||
fi | ||
version+=$VersionMajor | ||
|
||
# VersionMinor | ||
read -p "* VersionMinor: " VersionMinor | ||
if [ -z "$VersionMinor" ] | ||
then | ||
echo "VersionMinor cannot be NULL" | ||
exit -1 | ||
fi | ||
version+="."$VersionMinor | ||
|
||
# VersionPatch | ||
read -p "* VersionPatch: " VersionPatch | ||
if [ -z "$VersionPatch" ] | ||
then | ||
echo "VersionPatch cannot be NULL" | ||
exit -1 | ||
fi | ||
version+="."$VersionPatch | ||
|
||
# VersionMeta (optional) | ||
read -p "* VersionMeta (optional, press enter if not needed): " VersionMeta | ||
if [[ ! -z "$VersionMeta" ]] | ||
then | ||
version+="-"$VersionMeta | ||
fi | ||
|
||
echo "" | ||
echo "New version is: $version" | ||
|
||
# update version in all the 6 templates | ||
replace="Version: "$version | ||
fileArray=( | ||
"${DIR}/../packaging/templates/package_scripts/control" | ||
"${DIR}/../packaging/templates/package_scripts/control.arm64" | ||
"${DIR}/../packaging/templates/package_scripts/control.profile.amd64" | ||
"${DIR}/../packaging/templates/package_scripts/control.profile.arm64" | ||
"${DIR}/../packaging/templates/package_scripts/control.validator" | ||
"${DIR}/../packaging/templates/package_scripts/control.validator.arm64" | ||
) | ||
for file in ${fileArray[@]}; do | ||
# get the line starting with `Version` in the control file and store it in the $temp variable | ||
temp=$(grep "^Version.*" $file) | ||
sed -i '' "s%$temp%$replace%" $file | ||
done | ||
|
||
# update version in ../params/version.go | ||
versionFile="${DIR}/../params/version.go" | ||
sed -i '' "s% = .*// Major% = $VersionMajor // Major%g" $versionFile | ||
sed -i '' "s% = .*// Minor% = $VersionMinor // Minor%g" $versionFile | ||
sed -i '' "s% = .*// Patch% = $VersionPatch // Patch%g" $versionFile | ||
sed -i '' "s% = .*// Version metadata% = \"$VersionMeta\" // Version metadata%g" $versionFile | ||
gofmt -w $versionFile | ||
|
||
echo "" | ||
echo "Updating Version Done" | ||
|
||
exit 0 |