-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmotionEyeInstall.sh
More file actions
127 lines (99 loc) · 3.28 KB
/
Copy pathmotionEyeInstall.sh
File metadata and controls
127 lines (99 loc) · 3.28 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
read -p "This script will install MotionEye Are you sure? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
if [ "$EUID" -ne 0 ]
then echo "Please run as root!"
exit
fi
echo
echo
echo "---------------------------------------------"
echo "Checking for updates"
echo "---------------------------------------------"
echo
apt update
echo
echo
echo "---------------------------------------------"
echo "Installing updates"
echo "---------------------------------------------"
echo
apt upgrade -y
echo
echo
echo "---------------------------------------------"
echo "Installing ssh, curl, motion, ffmpeg, and v4l-utils"
echo "---------------------------------------------"
echo
apt install ssh curl motion ffmpeg v4l-utils -y
echo
echo
echo "---------------------------------------------"
echo "Installing python 2.7 and pip2"
echo "---------------------------------------------"
echo
apt install python2 -y
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
python2 get-pip.py
echo
echo
echo "---------------------------------------------"
echo "Installing all prerequisites"
echo "---------------------------------------------"
echo
apt install libffi-dev libzbar-dev libzbar0 -y
apt install python2-dev libssl-dev libcurl4-openssl-dev libjpeg-dev -y
apt install python-pil -y
echo
echo
echo "---------------------------------------------"
echo "Installing MotionEye"
echo "---------------------------------------------"
echo
pip2 install motioneye
echo
echo
echo "---------------------------------------------"
echo "Preparing the configuration directory"
echo "---------------------------------------------"
echo
mkdir -p /etc/motioneye
cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf
echo
echo
echo "---------------------------------------------"
echo "Preparing the media directory"
echo "---------------------------------------------"
echo
mkdir -p /var/lib/motioneye
echo
echo
echo "------------------------------------------------------"
echo "Make a MotionEye service to make it run as a service"
echo "------------------------------------------------------"
echo
cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service
systemctl daemon-reload
systemctl enable motioneye
read -p "You must reboot to finish the install. Would you like to reboot now? [y/N] " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
shutdown -r now
fi
echo
echo
echo "---------------------------------------------------------------------"
echo "You chose to reboot later, MotionEye will not work until you reboot."
echo "---------------------------------------------------------------------"
echo
exit
else
echo
echo
echo "---------------------------------------------"
echo "Exiting script"
exit
fi