-
Notifications
You must be signed in to change notification settings - Fork 172
/
UPDATE.sh
33 lines (33 loc) · 1.01 KB
/
UPDATE.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
#!/bin/bash
distro=$1
if [ -z ${distro+x} ]; then
distro='master'
fi
rm -rf $distro master_temp
wget https://github.com/ShinobiCCTV/Shinobi/tarball/$distro
mkdir master_temp
tar -xzf $distro -C master_temp --strip-components=1
rm -rf camera.js web UPDATE.sh package.json cron.js languages LICENSE COPYING
pm2 stop camera.js
pm2 stop cron.js
pm2 kill
mv master_temp/UPDATE.sh UPDATE.sh
chmod +x UPDATE.sh
sed -i 's/\r//' UPDATE.sh
mv master_temp/languages languages
mv master_temp/definitions definitions
mv master_temp/web web
mv master_temp/LICENSE LICENSE
mv master_temp/COPYING COPYING
mv master_temp/package.json package.json
mv master_temp/camera.js camera.js
mv master_temp/cron.js cron.js
mv master_temp/plugins/motion/shinobi-motion.js plugins/motion/shinobi-motion.js
mv master_temp/plugins/opencv/shinobi-opencv.js plugins/motion/shinobi-opencv.js
npm install
rm -rf $distro master_temp
pm2 start camera.js
pm2 start cron.js
if [ ! -f plugins/motion/conf.json ]; then
pm2 start plugins/motion/shinobi-motion.js
fi