forked from AllskyTeam/allsky
-
Notifications
You must be signed in to change notification settings - Fork 9
/
install_RPiHQ.sh
executable file
·86 lines (72 loc) · 2.49 KB
/
install_RPiHQ.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
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
echo -en '\n'
echo -e "${RED}**********************************************"
echo "*** Welcome to the Allsky Camera installer ***"
echo -e "**********************************************${NC}"
echo -en '\n'
echo -en "${GREEN}* Dependencies installation\n${NC}"
apt-get update && apt-get install libopencv-dev libusb-dev ffmpeg gawk lftp jq imagemagick -y
echo -en '\n'
echo -en "${GREEN}* Compile allsky software\n${NC}"
make all
echo -en '\n'
echo -en "${GREEN}* Sunwait installation"
cp sunwait /usr/local/bin
echo -en '\n'
echo -en "${GREEN}* Using the camera without root access\n${NC}"
install asi.rules /etc/udev/rules.d
udevadm control -R
echo -en '\n'
echo -en "${GREEN}* Autostart script\n${NC}"
sed -i '/allsky_RPiHQ.sh/d' /etc/xdg/lxsession/LXDE-pi/autostart
cp autostart/allsky_RPiHQ.service /lib/systemd/system/
chown root:root /lib/systemd/system/allsky_RPiHQ.service
chmod 0644 /lib/systemd/system/allsky_RPiHQ.service
echo -en '\n'
echo -en "${GREEN}* Configure log rotation\n${NC}"
cp autostart/allsky /etc/logrotate.d/
chown root:root /etc/logrotate.d/allsky
chmod 0644 /etc/logrotate.d/allsky
cp autostart/allsky.conf /etc/rsyslog.d/
chown root:root /etc/rsyslog.d/allsky.conf
chmod 0644 /etc/rsyslog.d/allsky.conf
echo -en '\n'
echo -en "${GREEN}* Copy camera settings files\n${NC}"
if [ ! -f 'settings.json' ] ; then
cp settings_RPiHQ.json.repo settings.json
fi
if [ ! -f 'config.sh' ] ; then
cp config_RPiHQ.sh.repo config.sh
fi
if [ ! -f 'scripts/ftp-settings.sh' ] ; then
cp scripts/ftp-settings.sh.repo scripts/ftp-settings.sh
fi
echo -en '\n'
echo -en "${GREEN}* Change ownership of all files in allsky directory to pi:pi\n${NC}"
chown -R pi:pi /home/pi/allsky
echo -en '\n'
echo -en "${GREEN}* Start all sky service\n${NC}"
systemctl daemon-reload
systemctl enable allsky_RPiHQ.service
echo -en '\n'
echo -en "${GREEN}* Making sure all scripts in scripts directory are executable\n${NC}"
sudo chmod 755 /home/pi/allsky/scripts/*.sh
echo -en '\n'
echo -en "${GREEN}* Create image directory if it does not exist yet\n${NC}"
if [ ! -d '/home/pi/allsky/images' ] ; then
mkdir /home/pi/allsky/images
chown pi:pi /home/pi/allsky/images
fi
echo -en '\n'
./startallsky.sh
echo -en '\n'
echo -en "The Allsky Software is now installed. You should reboot the Raspberry Pi to finish the installation\n"
echo -en '\n'
read -p "Do you want to reboot now? [y/n] " ans_yn
case "$ans_yn" in
[Yy]|[Yy][Ee][Ss]) reboot now;;
*) exit 3;;
esac