-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathinstall.sh
executable file
·108 lines (94 loc) · 2.61 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
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
#!/bin/bash
# ASCII Roulette v1.0.0
#
# presented by:
#
# ||` '||`
# || '' ||
# .|''|| || '''|. || '|| ||` '||''|, .|'', .|''|, '||),,(|,
# || || || .|''|| || || || || || || || || || || ||
# `|..||. .||. `|..||. .||. `|..'|. ||..|' .. `|..' `|..|' .|| ||.
# ||
# (we're hiring!) .||
#
#
# ASCII Roulette is a command-line based video chat client that connects
# you with a random person. It was written as a demonstration of the
# Pion WebRTC library.
#
# [[ This project is completely open source! ]]
# Github: https://github.com/dialup-inc/ascii
# Website: https://dialup.com/ascii
# Email: webmaster@dialup.com
function fail_unsupported() {
platform="${1:-"your platform"}"
echo "ASCII Roulette isn't supported on $platform yet :-( Try Mac or Linux instead."
echo ""
echo "Contributions are welcome! https://github.com/dialup-inc/ascii"
exit 1
}
function detect_platform() {
case $(uname | tr '[:upper:]' '[:lower:]') in
linux*)
case $(uname -m) in
x86_64)
echo "linux64"
;;
*)
fail_unsupported "32-bit Linux"
;;
esac
;;
darwin*)
case $(uname -m) in
x86_64)
echo "darwin64"
;;
*)
fail_unsupported "32-bit Macs"
;;
esac
;;
msys*)
fail_unsupported "Windows"
;;
*)
fail_unsupported
;;
esac
}
function getMD5() {
file="$1"
if ! [ -f "$file" ]; then
return
fi
if [ -x "$(command -v md5sum)" ]; then
md5sum | cut -d ' ' -f 1
elif [ -x "$(command -v md5)" ]; then
md5 -r $file | cut -d ' ' -f 1
fi
}
function checkEtag() {
url="$1"
etag="$2"
code="$(curl -s --head -o /dev/null -w "%{http_code}" -H "If-None-Match: $etag" "$url")"
if [ "$code" != "304" ]; then
echo "changed"
fi
}
function main() {
platform="$(detect_platform)"
binaryURL="https://storage.googleapis.com/asciiroulette/ascii_roulette.$platform"
md5="$(getMD5 /tmp/ascii_roulette)"
if [ -n "$(checkEtag $binaryURL $md5)" ]; then
printf "Downloading ASCII Roulette\033[5m...\033[0m\n"
curl -fs "$binaryURL" > /tmp/ascii_roulette
fi
chmod +x /tmp/ascii_roulette
clear
/tmp/ascii_roulette
if [ $? -eq 0 ]; then
reset
fi
}
echo <<EOF