forked from torch/ezinstall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-all
executable file
·91 lines (75 loc) · 2.05 KB
/
install-all
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash
######################################################################
# Complete install:
# Install all dependencies for Torch7, then Torch7 itself.
######################################################################
{
set -e
function TPUT()
{
#check for TTY and tput and redefine our existence based upon the results
if [[ -t 1 && -t 2 ]] && command -v "tput" >& /dev/null \
&& tput setaf 1 >& /dev/null ; then
function TPUT()
{
tput "$@"
}
else
function TPUT() { : ; }
fi
#now call thy self
TPUT "$@"
}
function ERROR()
{
TPUT setaf 1 >&2
while read; do
echo "ERROR: $REPLY"
done <<< "$@" >&2
TPUT sgr0 >&2
}
function WARN()
{
TPUT setaf 3
while read; do
echo "WARN: $REPLY"
done <<< "$@"
TPUT sgr0
}
function INFO()
{
TPUT setaf 2
while read; do
echo "INFO: $REPLY"
done <<< "$@"
TPUT sgr0
}
DEPS_URL="https://raw.githubusercontent.com/${_GITHUB_USER:-torch}/ezinstall/${_GITHUB_BRANCH:-master}/install-deps"
TORCH_URL="https://raw.githubusercontent.com/${_GITHUB_USER:-torch}/ezinstall/${_GITHUB_BRANCH:-master}/install-luajit+torch"
INFO "Preparing to install dependencies..."
# Pull in dependencies
if ! DEPS_SCRIPT="$( curl -s "$DEPS_URL" )" || \
[[ -z "$DEPS_SCRIPT" || "$DEPS_SCRIPT" = "Not Found" ]]; then
ERROR "Failed to curl $DEPS_URL. Exitting."
exit 1
fi
# Install dependencies
if ! echo "$DEPS_SCRIPT" | bash ; then
WARN "At least one of the dependencies failed to install. Continuing anyway."
else
INFO "Dependencies installed successfully."
fi
INFO "Preparing to install torch..."
# Pull in torch
if ! TORCH_SCRIPT="$( curl -s "$TORCH_URL" )" || \
[[ -z "$TORCH_SCRIPT" || "$TORCH_SCRIPT" = "Not Found" ]]; then
ERROR "Failed to curl $TORCH_URL. Exitting."
fi
# Install torch
if ! echo "$TORCH_SCRIPT" | bash ; then
ERROR "Torch install returned an error. Installation may be incomplete."
exit 1
else
INFO "Torch installed successfully."
fi
}