-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·59 lines (53 loc) · 1.24 KB
/
install.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
echo '[*] riak-browser v0.1 installer'
echo '[*] uses curl for uploading files'
#hostname
echo -n '[cfg] riak hostname (localhost):'
read riakhostname
if [ -z "$riakhostname" ]; then
riakhostname='localhost'
fi
#port
echo -n '[cfg] riak port (8098):'
read riakport
if [ -z "$riakport" ]; then
riakport='8098'
fi
#location
echo -n '[cfg] riak location (riak):'
read riaklocation
if [ -z "$riaklocation" ]; then
riaklocation='riak'
fi
#bucket
echo -n '[cfg] riak-browser bucket (riak-browser):'
read riaktargetbucket
if [ -z "$riaktargetbucket" ]; then
riaktargetbucket='client'
fi
#index
index='index.html'
url="http://$riakhostname:$riakport/$riaklocation/$riaktargetbucket/"
echo "[*] installing files to $url"
files=`ls -1 .`
for file in ${files[@]}
do
echo "Uploading $file..."
case $file in
*.html )
content_type="Content-Type: text/html"
;;
*.js )
content_type="Content-Type: text/javascript"
;;
*.css )
content_type="Content-Type: text/css"
;;
*.png )
content_type="Content-Type: image/png"
;;
esac
curl --silent -X PUT -H "${content_type}" --data-binary @$file "$url$file";
done
echo "[*] riak-browser installed, point your browser at:"
echo "[*] $url$index"