UNPKG

2.75 kBapplication/x-shView Raw
1#!/bin/bash
2echo "Shinobi - Updating Repositories"
3sudo apt update -y
4echo "============="
5echo "Shinobi - Get dependencies"
6sudo apt install libav-tools ffmpeg -y
7echo "============="
8echo "Shinobi - Do you want to Install MariaDB?"
9echo "(y)es or (N)o"
10read mysqlagree
11if [ "$mysqlagree" = "y" ]; then
12 echo "Shinobi - Installing MariaDB"
13 echo "Password for root SQL user, If you are installing SQL now then you may put anything:"
14 read sqlpass
15 echo "mariadb-server mariadb-server/root_password password $sqlpass" | debconf-set-selections
16 echo "mariadb-server mariadb-server/root_password_again password $sqlpass" | debconf-set-selections
17 apt install mariadb-server -y
18 service mysql start
19fi
20echo "============="
21echo "Shinobi - Install Node.js?"
22echo "(y)es or (N)o"
23read installNode
24if [ "$installNode" = "y" ]; then
25 sudo apt install nodejs npm -y
26fi
27echo "============="
28echo "Shinobi - Get latest Node.js?"
29echo "(y)es or (N)o"
30read updateNode
31if [ "$updateNode" = "y" ]; then
32 sudo npm cache clean -f
33 sudo npm install -g n
34 sudo n stable
35fi
36echo "============="
37echo "Shinobi - Link node to Node.js?"
38echo "(y)es or (N)o"
39read linkNode
40if [ "$linkNode" = "y" ]; then
41 ln -s /usr/bin/nodejs /usr/bin/node
42fi
43chmod -R 755 .
44echo "============="
45echo "Shinobi - Database Installation"
46echo "(y)es or (N)o"
47read mysqlagreeData
48if [ "$mysqlagreeData" = "y" ]; then
49 if [ "$mysqlagree" = "y" ]; then
50 sqluser="root"
51 fi
52 if [ ! "$mysqlagree" = "y" ]; then
53 echo "What is your SQL Username?"
54 read sqluser
55 echo "What is your SQL Password?"
56 read sqlpass
57 fi
58 mysql -u $sqluser -p$sqlpass -e "source sql/user.sql" || true
59 mysql -u $sqluser -p$sqlpass -e "source sql/framework.sql" || true
60 echo "Shinobi - Do you want to Install Default Data (default_data.sql)?"
61 echo "(y)es or (N)o"
62 read mysqlDefaultData
63 if [ "$mysqlDefaultData" = "y" ]; then
64 echo "Default Username : ccio@m03.ca"
65 echo "Default Password : password"
66 mysql -u $sqluser -p$sqlpass --database ccio -e "source sql/default_data.sql" || true
67 fi
68fi
69echo "============="
70echo "Shinobi - Install NPM Libraries"
71npm install
72echo "============="
73echo "Shinobi - Install PM2"
74sudo npm install pm2 -g
75if [ ! -e "./conf.json" ]; then
76 cp conf.sample.json conf.json
77fi
78if [ ! -e "./super.json" ]; then
79 echo "Default Superuser : admin@shinobi.video"
80 echo "Default Password : admin"
81 cp super.sample.json super.json
82fi
83echo "Shinobi - Finished"
84touch INSTALL/installed.txt
85echo "Shinobi - Start Shinobi?"
86echo "(y)es or (N)o"
87read startShinobi
88if [ "$startShinobi" = "y" ]; then
89 pm2 start camera.js
90 pm2 start cron.js
91 pm2 list
92fi
\No newline at end of file