-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminicoin
More file actions
executable file
·62 lines (56 loc) · 1.26 KB
/
Copy pathminicoin
File metadata and controls
executable file
·62 lines (56 loc) · 1.26 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
source=$(readlink $0)
if [[ $source == "" ]]; then
if [[ $WINDIR != "" ]]; then
source=$(realpath $0)
else
echo "This script expects to be run via a symlink!"
exit 1
fi
fi
minicoin_dir=$(dirname $source)
project_dir="$PWD"
[[ -z $MINICOIN_USER_DIR ]] && export MINICOIN_USER_DIR="$HOME/minicoin"
[[ -z $MINICOIN_PROJECT_DIR ]] && export MINICOIN_PROJECT_DIR="$PWD"
cd $minicoin_dir
function update_minicoin()
{
git fetch --all --tags 2> /dev/null > /dev/null
if [ $? == 0 ]; then
if [ "$1" == "" ]; then
minicoin_version=`git tag --list --sort=-taggerdate | head -n1`
else
minicoin_version=$1
fi
else
>&2 echo "Failed to fetch tags, can't update minicoin!"
fi
if [ ! -z "$minicoin_version" ]; then
echo "Checking out version $minicoin_version"
git stash > /dev/null
output=`git checkout $minicoin_version 2>&1`
error=$?
if [ $error -gt 0 ]; then
>&2 echo "$output"
fi
git checkout master -- ../setup.sh minicoin
fi
return $?
}
function show_help()
{
cat help.txt
}
if [ "$1" == "update" ]; then
shift
update_minicoin "$@"
error=$?
elif [[ "$1" == "help" && "$2" == "" ]]; then
show_help
error=0
else
vagrant "$@"
error=$?
fi
cd "$project_dir"
exit $error