-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdate_automagic.sh
executable file
·43 lines (32 loc) · 1.14 KB
/
update_automagic.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
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
VERSION=$1
function usage {
echo -e "
USAGE EXAMPLES:
./$(basename $0) 0.8.7
./$(basename $0) 0.9.2
"
}
if [ $# -ne 1 ]; then
usage
exit 1
fi
EXISTING_VAGRANT_VERSION=$(vagrant version | head -n1 | awk '{print $3}')
if [ "${EXISTING_VAGRANT_VERSION}" != "${VERSION}" ]; then
echo "-) You are trying to update this script for vagrant ${VERSION} while you have"
echo " vagrant ${EXISTING_VAGRANT_VERSION} installed at $(which vagrant)."
echo " Please update your local vagrant before using this script."
exit 1
fi
echo "+) Acquiring vagrant-${VERSION}"
wget https://github.com/mitchellh/vagrant/archive/v${VERSION}.tar.gz
echo "+) Extracting vagrant-${VERSION}.tar.gz"
tar zxf v${VERSION}.tar.gz
echo "+) Running update_commands.rb"
./update_commands.rb
echo "+) Updating the badge in the README.md"
sed -i "/img.shields.io/c\[\![](https://img.shields.io/badge/Supports%20Vagrant%20Version-${VERSION}-blue.svg)](https://github.com/hashicorp/vagrant/blob/v${VERSION}/CHANGELOG.md)" README.md
echo "+) Cleaning up after ourselves"
rm -f v${VERSION}.tar.gz
rm -rf vagrant-${VERSION}
git status