-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathinstall_dependencies.sh
executable file
·47 lines (43 loc) · 1.48 KB
/
install_dependencies.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
#!/bin/bash
# Fail script if any command fails.
set -e
# Check that script is run as root with sudo.
if [ `id -u` -ne 0 ]; then
echo "Must be run as root with sudo! Try:"
echo "sudo ./install_dependencies"
exit 1
fi
# Check if running wheezy.
if [ `cat /etc/apt/sources.list | grep -c 'jessie'` -eq 0 ] && [ `cat /etc/apt/sources.list | grep -c 'wheezy'` -gt 0 ]; then
# Warn that OS will be upgraded to testing packages.
echo "WARNING: Your operating system will now be upgraded to Raspbian testing/'jessie'"
echo "To be safe, please make sure critical data is backed up before starting."
echo "This process will take about an hour to run."
echo
echo "Type OK and press enter to continue (or anything else to quit):"
read confirm
if [ "$confirm" != "ok" ] && [ "$confirm" != "OK" ]; then
echo "Exiting without performing upgrade."
exit 1
fi
# Upgrade from stable to testing.
cp /etc/apt/sources.list /etc/apt/sources.list.bak
sed -i -e 's/ wheezy/ testing/ig' /etc/apt/sources.list
apt-get update
# First download all upgrade packages.
apt-get -y --download-only dist-upgrade
# Next perform upgrade with no prompts.
DEBIAN_FRONTEND=noninteractive \
apt-get \
-o Dpkg::Options::="--force-confnew" \
--force-yes \
-fuy \
dist-upgrade
fi
# Install dependencies.
apt-get -y install python-pip python-opencv python-dev
pip install picamera
pip install rpio
echo "Installation complete!"
echo
echo "Make sure to run sudo raspi-config and enable the camera."