-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·160 lines (149 loc) · 4.38 KB
/
install
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/bin/bash
red=$(tput setaf 1)
green=$(tput setaf 2)
reset=$(tput sgr0)
h1()
{
echo -e "${red}$1${reset}"
}
echo `tput setaf 1`
echo " _______ __ ________ __ __ __ "
echo " |_ _|.-----.--| |.-----.-----.----. | | | |__| |--.|__| "
echo " _| |_ | | _ || _ | _ | _| | | | | | < | | "
echo " |_______||__|__|_____||_____|_____|__| |________|__|__|__||__| "
echo `tput sgr0`
echo
echo "Welcome to the ${red}Indoor Wiki${reset} install script!"
echo
echo "I'll be cloning Indoor Wiki and some of its dependencies to the current"
echo "directory to install them."
echo
echo "I'm assuming you ${green}already have OCaml and OPAM${reset} installed."
echo
echo "I recommend running this script in a ${green}directory that's not temporary${reset} so that"
echo "you don't confuse OPAM about where the projects you've installed have gone."
echo
echo "Press ${green}ENTER${reset} if you're ready to start."
read _
echo
h1 "car"
which car >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "car is already installed."
else
echo "car not found: installing..."
git clone https://github.com/jonathanyc/car.git
opam pin add --yes car car
if [ $? -ne 0 ]; then exit 1; fi
fi
echo
h1 "sxmlm"
ocamlfind query sxmlm >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "sxmlm is already installed."
else
echo "sxmlm not found: installing..."
hg clone https://[email protected]/jyc/sxmlm
opam pin add --yes sxmlm sxmlm
if [ $? -ne 0 ]; then exit 1; fi
fi
echo
h1 "ocaml-scgi"
if [ -z "$(ocamlfind query "scgi" 2>&1 | grep "not found")" ]; then
echo "ocaml-scgi is already installed."
else
echo "ocaml-scgi not found: installing..."
git clone https://github.com/jonathanyc/ocaml-scgi
cd ocaml-scgi
make world
if [ $? -ne 0 ]; then exit 1; fi
cd ..
fi
echo
h1 "Nginx"
which nginx >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Nginx is already installed."
else
echo "Nginx not found: installing..."
case "$(uname)" in
Darwin)
which brew >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Installing Nginx using Homebrew..."
brew install nginx
if [ $? -ne 0 ]; then exit 1; fi
else
echo "Sorry! I only have instructions for installing Nginx on OS X using Homebrew."
echo "Please install Homebrew or install Nginx by yourself, then launch me again."
exit 1
fi
;;
Linux)
which pacman >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Installing Nginx using Pacman..."
sudo pacman -S --noconfirm nginx
if [ $? -ne 0 ]; then exit 1; fi
else
echo "Sorry! I don't have instructions for installing Nginx on your platform."
echo "Please install Nginx yourself, then launch me again."
exit 1
fi
;;
*)
echo "Sorry! I don't have instructions for installing Nginx on your platform."
echo "Please install Nginx yourself, then launch me again."
exit 1
;;
esac
fi
echo
h1 "ocaml-cmark"
ocamlfind query cmark >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "ocaml-cmark is already installed."
else
echo "ocaml-cmark not found: installing..."
pkg-config libcmark >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "cmark not found: installing..."
case "$(uname)" in
Darwin)
which brew 2>&1 >/dev/null
if [ $? -eq 0 ]; then
echo "Installing cmark using Homebrew..."
brew install cmark
if [ $? -ne 0 ]; then exit 1; fi
else
echo "Sorry! I only have instructions for installing cmark on OS X using Homebrew."
echo "Please install Homebrew or install cmark by yourself, then launch me again."
exit 1
fi
;;
*)
echo "Sorry! I don't have instructions for installing cmark on your platform."
echo "Please install cmark yourself, then launch me again."
echo "See https://github.com/jgm/cmark ."
exit 1
;;
esac
fi
git clone https://github.com/jonathanyc/ocaml-cmark.git
opam pin add --yes cmark ocaml-cmark
if [ $? -ne 0 ]; then exit 1; fi
fi
echo
h1 "Indoor Wiki"
which indoor >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Indoor Wiki seems to already be installed!"
else
echo "Installing..."
git clone https://github.com/jonathanyc/indoor-wiki.git
opam pin add --yes indoor-wiki indoor-wiki
if [ $? -ne 0 ]; then exit 1; fi
fi
echo
h1 "All done!"
# vim: set ts=2 sw=2 :