forked from AstroPrint/AstroBox
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·77 lines (61 loc) · 2.43 KB
/
setup.sh
File metadata and controls
executable file
·77 lines (61 loc) · 2.43 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
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
#!/bin/bash
if [ ! -f /etc/apt/sources.list.d/astroprint.ppa.list ]; then
DEBIAN_VERSION=`cat /etc/debian_version | cut -c -1`
case "$DEBIAN_VERSION" in
9)
DEBIAN_NAME="stretch"
;;
*)
DEBIAN_NAME="stable"
;;
esac
echo "Adding AstroPrint's PPA [${DEBIAN_NAME}] for future updates..."
echo "deb [trusted=yes] http://ppa.astroprint.com ${DEBIAN_NAME} main" > /etc/apt/sources.list.d/astroprint.ppa.list
apt-get update
fi
if [ ! -f /etc/apt/sources.list.d/tmp_rpi.ppa.list ]; then
echo "deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi" > /etc/apt/sources.list.d/tmp_rpi.ppa.list
apt-get --allow-unauthenticated update
fi
echo "Installing python packages..."
apt-get --assume-yes --allow-unauthenticated install python2.7 python-pip python-dev python-apt python-dbus python-gobject isc-dhcp-server ruby ruby-sass network-manager haproxy janus=0.2.5-1 gir1.2-gstreamer-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-omx gcodeanaylizer-astroprint astrobox-pip-dependencies
apt-get --assume-yes install /AstroBox/toInstall/gstreamer1.0-omx_1.2.0-1_armhf.deb
rm /AstroBox/toInstall/gstreamer1.0-omx_1.2.0-1_armhf.deb
rm /etc/apt/sources.list.d/tmp_rpi.ppa.list
mkdir /AstroBox/Astro_master
cd /AstroBox/Astro_master
git clone https://github.com/AstroPrint/AstroBox.git
cp /AstroBox/Astro_master/AstroBox/src /AstroBox/. -r
cd /
cp /AstroBox/toInstall/* /. -rf
sync
if ! cmp -s /etc/haproxy/haproxy_astrobox.cfg /etc/haproxy/haproxy.cfg; then
echo "Setting up haproxy..."
mv /etc/haproxy/haproxy_astrobox.cfg /etc/haproxy/haproxy.cfg
service haproxy reload
fi
if ! cmp -s /etc/bind/named.conf.options.astrobox /etc/bind/named.conf.options; then
echo "Setting up local DNS"
mv /etc/bind/named.conf.options.astrobox /etc/bind/named.conf.options
mv /etc/bind/named.conf.local.astrobox /etc/bind/named.conf.local
fi
echo "Enabling powercheck to start on bootup..."
update-rc.d -f powercheck defaults
echo "Enabling astrobox to start on bootup..."
update-rc.d -f astrobox defaults
if [ -f /etc/os-release ]; then
. /etc/os-release
echo $ID
if [ "raspbian" == "$ID" ]; then
echo "Adding Raspicam V4l2 driver"
if grep -Fxq "bcm2835-v4l2" /etc/modules; then
echo "Already there"
else
echo "Adding driver"
echo 'bcm2835-v4l2' >> /etc/modules
fi
fi
fi
systemctl disable bonescript.socket
systemctl disable bonescript-autorun.service
reboot