-
Notifications
You must be signed in to change notification settings - Fork 3
/
pi-installer.sh
81 lines (67 loc) · 2.07 KB
/
pi-installer.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
#!/bin/sh
#this is a script to install Streamsheets on Raspberry Pi with raspbian buster
#get user and user home directory
U=$SUDO_USER
H=$(eval echo "~$U")
#color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
WHITE="\[\033[0;37m\]"
NC='\033[0m'
IP=$(hostname -I)
#download docker install script
cd $H
#check if docker is installed
if [ -f /usr/bin/docker ]
then
echo "${GREEN}Docker already exists${NC}"
else
echo "${YELLOW}Installing Docker${NC}"
echo ""
sudo curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
sudo usermod -aG docker pi
if [ -f /usr/bin/docker ]
then
echo "${GREEN}Installed Docker${NC}"
else
echo "${RED}Installation of Docker failed, try again or search for help at https://forum.cedalo.com ${NC}"
exit 1
fi
fi
#run apt-get install pip, if pip is already installed this will do no harm
echo "${YELLOW}Installing/updating python3-pip${NC}"
sudo apt-get install python3-pip
#check if docker-compose is installed
if [ -f /usr/local/bin/docker-compose ]
then
echo "${GREEN}docker-compose is already installed${NC}"
else
echo "${YELLOW}Installing docker-compose${NC}"
echo ""
sudo pip3 install docker-compose
if [ -f /usr/local/bin/docker-compose ]
then
echo "${GREEN}Finished installing docker-compose${NC}"
else
echo "${RED}Installation of docker-compose failed, try again or search for help at http://forum.cedalo.com ${NC}"
exit 2
fi
fi
echo ""
echo "${YELLOW}Downloading and running Cedalo-Platform installer${NC}"
mkdir cedalo_platform
cd cedalo_platform
sudo docker rmi $(docker images -q cedalo/installer:2-rpi) -f
sudo docker run --rm -it -v $H/cedalo_platform:/cedalo cedalo/installer:2-rpi
echo ""
echo ""
echo "${GREEN}Docker and Streamsheet have been installed successfully. After starting Streamsheets, it will be available under http://$(hostname):8081 in your browser (on your local network)${NC}"
while true; do
read -p "Do you want to start Streamsheets now? (Y/n): " choice
case "$choice" in
y|Y ) cd ~/cedalo_platform; sudo sh start.sh;;
n|N ) break;;
* ) echo "${RED}type in y/Y or n/N: ${NC}";;
esac
done