-
-
Notifications
You must be signed in to change notification settings - Fork 141
/
version.sh
executable file
·33 lines (27 loc) · 1.04 KB
/
version.sh
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
29
30
31
32
33
#!/bin/sh -e
#
# Self-modifying script that updates the version numbers
#
# Requires the `setconf` utility.
#
# The current version goes here, as the default value
VERSION=${1:-'1.17.1'}
if [ -z "$1" ]; then
echo "The current version is $VERSION, pass the new version as the first argument if you wish to change it"
exit 0
fi
echo "Setting the version to $VERSION"
# Set the version in various files
setconf README.md '* Version' $VERSION
setconf main.go versionString "\"Algernon "$VERSION"\""
# Update the date and version in the man page
d=$(LC_ALL=C date +'%d %b %Y')
if [ "$(uname)" = "Darwin" ]; then
sed -i '' "s/\"[0-9]* [A-Z][a-z]* [0-9]*\"/\"$d\"/g" algernon.1
sed -i '' "s/[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*/$VERSION/g" algernon.1
sed -i '' "s/[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*/$VERSION/g" "$0"
else
sed -i "s/\"[0-9]* [A-Z][a-z]* [0-9]*\"/\"$d\"/g" algernon.1
sed -i "s/[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*/$VERSION/g" algernon.1
sed -i "s/[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*/$VERSION/g" "$0"
fi