-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstaller.sh
More file actions
executable file
·51 lines (48 loc) · 1.19 KB
/
installer.sh
File metadata and controls
executable file
·51 lines (48 loc) · 1.19 KB
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
#!/usr/bin/env bash
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
SCRIPT_DIR="$(cd -- "$(dirname "$0")" && pwd)"
name="vc-clock"
install_c()
{
echo -e "${YELLOW} $name Installing...${NC}"
if [ ! -f "$SCRIPT_DIR/bin/c/$name" ]; then
make c || { echo "${RED}Build failed${NC}"; exit 1; }
fi
sudo install -m 755 "$SCRIPT_DIR/bin/c/$name" "/usr/bin/"
echo -e "${GREEN} $name Installed!${NC}"
}
install_crystal()
{
echo -e "${YELLOW} $name Installing...${NC}"
if [ ! -f "$SCRIPT_DIR/bin/$name" ]; then
make crystal || { echo "${RED}Build failed${NC}"; exit 1; }
fi
sudo install -m 755 "$SCRIPT_DIR/bin/$name" "/usr/bin/"
echo -e "${GREEN} $name Installed!${NC}"
}
uninstall() {
sudo rm -f "/usr/bin/$name" &> /dev/null
echo -e "${RED} $name Deleted!${NC}"
}
main()
{
if [ "$1" == "install" ]; then
if [ "$2" == "crystal" ]; then
install_crystal
elif [ "$2" == "c" ]; then
install_c
else
echo -e "${RED}Usage:${NC} $0 install {c|crystal}"
exit 1
fi
elif [ "$1" == "uninstall" ]; then
uninstall
else
echo -e "${RED} Options $0 { install | uninstall }${NC}"
exit 1
fi
}
main "$@"