-
Notifications
You must be signed in to change notification settings - Fork 7
/
install.sh
executable file
·56 lines (46 loc) · 1.66 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
#!/bin/bash -e
# install.sh - Install all packages and copy bundled files.
#
# Copyright (C) 2019 Basler AG
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
echo "Hucon-webserver installation started"
# we use our own image - don't touch it
echo "Linking new libraries"
# add the hackerschool to the site packages (only for old code)
if [[ -L /usr/lib/python3.6/site-packages/hackerschool ]]; then
rm /usr/lib/python3.6/site-packages/hackerschool
fi
ln -s "/opt/hucon/python_lib/hucon" "/usr/lib/python3.6/site-packages/hackerschool"
# add the hucon to the site packages
if [[ -L /usr/lib/python3.6/site-packages/hucon ]]; then
rm /usr/lib/python3.6/site-packages/hucon
fi
ln -s "/opt/hucon/python_lib/hucon" "/usr/lib/python3.6/site-packages/hucon"
echo "Removing old server startup"
sed -i '/start_server.sh/d' /etc/rc.local
if [[ -e /etc/init.d/HuconWebserver ]]; then
/etc/init.d/HuconWebserver disable
rm /etc/init.d/HuconWebserver
fi
echo "Deploying new server startup"
cp /opt/hucon/init.d/HuconWebserver /etc/init.d/HuconWebserver
chmod +x /etc/init.d/HuconWebserver
/etc/init.d/HuconWebserver enable
echo "Removing old i2c startup"
if [[ -e /etc/init.d/i2c_led ]] || [[ -e /etc/init.d/I2C_led ]]; then
if [[ -e /etc/init.d/i2c_led ]]; then
/etc/init.d/i2c_led disable
rm /etc/init.d/i2c_led
else
/etc/init.d/I2C_led disable
rm /etc/init.d/I2C_led
fi
fi
echo "Deploying new I2C/Eyes startup"
cp /opt/hucon/init.d/I2C_led /etc/init.d/I2C_led
chmod +x /etc/init.d/I2C_led
/etc/init.d/I2C_led enable
echo "Install finished"