-
Notifications
You must be signed in to change notification settings - Fork 8
/
install.sh
69 lines (59 loc) · 1.35 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
#!/usr/bin/env bash
DIR="${HOME}/.config/polybar/"
REPO="https://raw.githubusercontent.com/matoruru/polybar-adapta-theme/master/polybar/"
curlFrom () {
curl -O "$1" || echo "Download failed!"
}
download () {
mkdir -p ${DIR}
(
cd ${DIR}
curl --remote-name "${REPO}"config.ini \
--remote-name "${REPO}"checkupdates.sh \
--remote-name "${REPO}"updates.sh \
--remote-name "${REPO}"launch.sh \
)
}
startInstall () {
ping matoru.ru -i 0.2 -c 5 || { echo "No connection..."; exit 1; }
download
echo
echo "Finished!"
echo "Enjoy :)"
}
type curl >/dev/null 2>&1 || {
echo "Please make sure to have \"curl\" command on your machine."
exit 1
}
if [ "$#" != "0" -a "$#" != 1 ]; then
echo "Invalid number of arguments."
exit 1
fi
if [ "$#" == "1" ]; then
if [ "$1" == "--yes" ]; then
startInstall
exit 0;
else
echo "Invalid argument."
exit 1
fi
fi
if [ -d "$DIR" ]; then
echo "${DIR} directory already exists."
while true; do
read -p "Do you want to delete it (yes/no)?" yn
case $yn in
YES | Yes | yes | [Yy])
startInstall
break;;
NO | No | no | [Nn])
echo "Abort...";
exit;;
* )
echo "Please answer yes or no.";;
esac
done
else
echo "Downloading from Github..."
startInstall
fi