1
0
Fork 0
mirror of https://gitlab.com/Shinobi-Systems/ShinobiCE.git synced 2025-03-09 15:40:15 +00:00
- Rebased sql, test, web, defintions, languages, INSTALL, and libs folders.
This commit is contained in:
Moe 2019-03-07 14:43:37 -08:00
parent 24de55e45a
commit d0b12e92e7
362 changed files with 21716 additions and 7018 deletions

View file

@ -27,7 +27,7 @@ if [ ! -e "./super.json" ]; then
fi
echo "Shinobi - Run yum update"
sudo yum update -y
sudo yum install make -y
sudo yum install make zip -y
echo "============="
echo "Shinobi - Do you want to Install FFMPEG?"
echo "(y)es or (N)o"
@ -143,21 +143,14 @@ if [ "$mysqlDefaultData" = "y" ] || [ "$mysqlDefaultData" = "Y" ]; then
echo "====================================="
echo "====================================="
fi
if [ ! "$sqliteormariadb" = "M" ] && [ ! "$sqliteormariadb" = "m" ]; then
echo "====================================="
echo "||===== Install Completed =====||"
echo "====================================="
echo "|| Login with the Superuser and create a new user!!"
echo "||==================================="
echo "|| Open http://$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'):8080/super in your web browser."
echo "||==================================="
echo "|| Default Superuser : admin@shinobi.video"
echo "|| Default Password : admin"
echo "====================================="
echo "====================================="
else
echo "+=================================+"
echo "||===== Install Completed =====||"
echo "|| Access the main Shinobi panel at http://$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'):8080 in your web browser."
echo "+=================================+"
fi
echo "====================================="
echo "||===== Install Completed =====||"
echo "====================================="
echo "|| Login with the Superuser and create a new user!!"
echo "||==================================="
echo "|| Open http://$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'):8080/super in your web browser."
echo "||==================================="
echo "|| Default Superuser : admin@shinobi.video"
echo "|| Default Password : admin"
echo "====================================="
echo "====================================="

View file

@ -0,0 +1,41 @@
# Install prerequisites
DIR=`dirname $0`
INSTALLERS_DIR="$DIR"
echo "-----------------------------------"
if ! [ -x "$(command -v opencv_version)" ]; then
echo "Installing OpenCV"
dos2unix $INSTALLERS_DIR/opencv-cuda.sh
sh $INSTALLERS_DIR/opencv-cuda.sh
else
echo "OpenCV found... : $(opencv_version)"
fi
# this includes all the ones missing from OpenALPR's guide.
sudo apt install libtesseract-dev git cmake build-essential libleptonica-dev -y
sudo apt install liblog4cplus-dev libcurl3-dev -y
sudo apt install libleptonica-dev -y
sudo apt install libcurl4-openssl-dev -y
sudo apt install liblog4cplus-dev -y
sudo apt install beanstalkd -y
sudo apt install openjdk-8-jdk -y
# Clone the latest code from GitHub
git clone https://github.com/openalpr/openalpr.git
# Setup the build directory
cd openalpr/src
mkdir build
cd build
# setup the compile environment
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc ..
# compile the library
make
# Install the binaries/libraries to your local system (prefix is /usr)
sudo make install
# Test the library
wget http://plates.openalpr.com/h786poj.jpg -O lp.jpg
alpr lp.jpg
rm lp.jpg

View file

@ -1,4 +1,17 @@
# Install prerequisites
DIR=`dirname $0`
INSTALLERS_DIR="$DIR"
echo "-----------------------------------"
if ! [ -x "$(command -v opencv_version)" ]; then
echo "Installing OpenCV"
dos2unix $INSTALLERS_DIR/opencv-cuda.sh
sh $INSTALLERS_DIR/opencv-cuda.sh
else
echo "OpenCV found... : $(opencv_version)"
fi
# get tesseract repo because ubuntu repo is serving a broken version
sudo add-apt-repository ppa:alex-p/tesseract-ocr -y
sudo apt-get update
# this includes all the ones missing from OpenALPR's guide.
sudo apt install libtesseract-dev git cmake build-essential libleptonica-dev -y
sudo apt install liblog4cplus-dev libcurl3-dev -y
@ -28,4 +41,4 @@ sudo make install
# Test the library
wget http://plates.openalpr.com/h786poj.jpg -O lp.jpg
alpr lp.jpg
rm lp.jpg
rm lp.jpg

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# OpenCV CUDA
if [ $(dpkg-query -W -f='${Status}' git 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "Installing Git..."
@ -77,4 +77,4 @@ read opencvuninstall
if [ "$opencvuninstall" = "y" ] || [ "$opencvuninstall" = "Y" ]; then
rm -rf opencv
rm -rf opencv_contrib
fi
fi

View file

@ -115,15 +115,6 @@ sudo chmod -R 755 .
touch INSTALL/installed.txt
dos2unix /home/Shinobi/INSTALL/shinobi
ln -s /home/Shinobi/INSTALL/shinobi /usr/bin/shinobi
if [ "$mysqlDefaultData" = "y" ] || [ "$mysqlDefaultData" = "Y" ]; then
echo "=====================================" > INSTALL/installed.txt
echo "======= Login Credentials =======" >> INSTALL/installed.txt
echo "|| Username : $userEmail" >> INSTALL/installed.txt
echo "|| Password : $userPasswordPlain" >> INSTALL/installed.txt
echo "|| API Key : $apiKey" >> INSTALL/installed.txt
echo "=====================================" >> INSTALL/installed.txt
echo "=====================================" >> INSTALL/installed.txt
fi
echo "Shinobi - Start Shinobi and set to start on boot?"
echo "(y)es or (N)o"
read startShinobi
@ -134,31 +125,14 @@ if [ "$startShinobi" = "y" ] || [ "$startShinobi" = "Y" ]; then
sudo pm2 save
sudo pm2 list
fi
if [ "$mysqlDefaultData" = "y" ] || [ "$mysqlDefaultData" = "Y" ]; then
echo "details written to INSTALL/installed.txt"
echo "====================================="
echo "======= Login Credentials ======="
echo "|| Username : $userEmail"
echo "|| Password : $userPasswordPlain"
echo "|| API Key : $apiKey"
echo "====================================="
echo "====================================="
fi
if [ ! "$sqliteormariadb" = "M" ] && [ ! "$sqliteormariadb" = "m" ]; then
echo "====================================="
echo "||===== Install Completed =====||"
echo "====================================="
echo "|| Login with the Superuser and create a new user!!"
echo "||==================================="
echo "|| Open http://$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1):8080/super in your web browser."
echo "||==================================="
echo "|| Default Superuser : admin@shinobi.video"
echo "|| Default Password : admin"
echo "====================================="
echo "====================================="
else
echo "+=================================+"
echo "||===== Install Completed =====||"
echo "|| Access the main Shinobi panel at http://$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1):8080 in your web browser."
echo "+=================================+"
fi
echo "====================================="
echo "||===== Install Completed =====||"
echo "====================================="
echo "|| Login with the Superuser and create a new user!!"
echo "||==================================="
echo "|| Open http://$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1):8080/super in your web browser."
echo "||==================================="
echo "|| Default Superuser : admin@shinobi.video"
echo "|| Default Password : admin"
echo "====================================="
echo "====================================="

View file

@ -1,30 +1,68 @@
#!/bin/bash
installationDirectory="/home/Shinobi"
if [ ! "$1" ]; then
if [ ! -e "/etc/shinobisystems/path.txt" ]; then
installationDirectory="/home/Shinobi"
else
installationDirectory=$(cat /etc/shinobisystems/cctv.txt)
fi
cd $installationDirectory
currentBuild=$(git show --oneline -s)
gitOrigin=$(git remote show origin)
splitBuildString=($currentBuild)
currentCommitNumber=${splitBuildString[0]}
if [[ $gitOrigin == *'ShinobiCE'* ]]; then
repo="CE"
else
repo="Pro"
fi
if [[ $@ == *'help'* ]] || [ ! "$1" ]; then
echo "========================================================="
echo "==!! Shinobi : The Open Source CCTV and NVR Solution !!=="
echo "========================================================="
echo "You are missing function parameters."
echo "Example : shinobi [command] .."
echo "Example : shinobi flush restart logs"
if [ ! "$1" ]; then
echo "You are missing function parameters."
echo "Example : shinobi [command] .."
echo "Example : shinobi flush restart logs"
else
echo "Hello there! if you need support come on over"
echo "to the Shinobi Community Chat! :)"
echo "https://discordapp.com/invite/mdhmvuH/"
fi
echo "========================================================="
echo "Your available options for COMMAND are as follows"
echo "========================================================="
echo "| start or s :"
echo "| start :"
echo "|--> Start camera.js and cron.js under PM2 (Process Manager)"
echo "-"
echo "| restart or r :"
echo "| restart :"
echo "|--> Restart all processes running under the PM2 daemon."
echo "-"
echo "| stop, exit, or e :"
echo "| stop, exit :"
echo "|--> Stop all processes running under the PM2 daemon."
echo "-"
echo "| version :"
echo "|--> get version of your current build by git."
echo "-"
echo "| logs :"
echo "|--> Get PM2 log stream with last 100 lines."
echo "-"
echo "| clear, flush, or f :"
echo "| update :"
echo "|--> Update via Git."
echo "-"
echo "| getMaster :"
echo "|--> Switch to the Master Branch (For Pro Repo only)."
echo "-"
echo "| getDev :"
echo "|--> Switch to the Development Branch (For Pro Repo only)."
echo "-"
echo "| clear, flush :"
echo "|--> Clear all PM2 logs."
echo "-"
echo "| bootupEnable :"
echo "|--> Start Shinobi on OS reboot."
echo "-"
echo "| bootupDisable :"
echo "|--> Disable starting Shinobi on OS reboot."
echo "-"
echo "| kill :"
echo "|--> Stop the entire PM2 daemon."
fi
@ -34,7 +72,8 @@ fi
if [[ $@ == *'restart'* ]]; then
proccessAlive=$(pm2 list | grep camera)
if [ "$proccessAlive" ]; then
pm2 restart all
pm2 restart $installationDirectory/camera.js
pm2 restart $installationDirectory/cron.js
else
echo "Shinobi process is not running."
fi
@ -58,11 +97,64 @@ fi
if [[ $@ == *'stop'* ]] || [[ $@ == *'exit'* ]]; then
proccessAlive=$(pm2 list | grep camera)
if [ "$proccessAlive" ]; then
pm2 kill
pm2 stop $installationDirectory/camera.js
pm2 stop $installationDirectory/cron.js
else
echo "Shinobi process is not running."
fi
fi
if [[ $@ == *'version'* ]]; then
echo "Build ID : $currentCommitNumber"
if [[ $repo == "Pro" ]]; then
echo "Repository : Shinobi Pro"
else
echo "Repository : Shinobi CE"
fi
echo $currentBuild
fi
if [[ $@ == *'bootupEnable'* ]] || [[ $@ == *'bootupenable'* ]]; then
pm2 startup
pm2 save
fi
if [[ $@ == *'bootupDisable'* ]] || [[ $@ == *'bootupdisable'* ]]; then
pm2 unstartup
pm2 save
fi
if [[ $@ == *'getDev'* ]] || [[ $@ == *'getdev'* ]]; then
if [[ $repo == "Pro" ]]; then
git checkout dev
echo "Shinobi - Restart Shinobi to make the changes take affect."
else
echo "Shinobi - Cannot use \"getDev\" with Shinobi CE"
fi
fi
if [[ $@ == *'getMaster'* ]] || [[ $@ == *'getmaster'* ]]; then
if [[ $repo == "Pro" ]]; then
git checkout master
echo "Shinobi - Restart Shinobi to make the changes take affect."
else
echo "Shinobi - Cannot use \"getMaster\" with Shinobi CE"
fi
fi
if [[ $@ == *'update'* ]]; then
echo "============="
echo "Shinobi - Are you sure you want to update? This will restart Shinobi."
echo "(y)es or (N)o"
read updateshinobi
if [ "$updateshinobi" = "y" ] || [ "$updateshinobi" = "Y" ]; then
echo "Beginning Update Process..."
pm2 stop $installationDirectory/camera.js
pm2 stop $installationDirectory/cron.js
npm install --unsafe-perm
npm audit fix --force
git reset --hard
git pull
pm2 start $installationDirectory/camera.js
pm2 start $installationDirectory/cron.js
else
echo "Cancelled Update Process."
fi
fi
if [[ $@ == *'kill'* ]]; then
pm2 kill
fi

View file

@ -3,6 +3,7 @@ if [ -e "INSTALL/installed.txt" ]; then
echo "Starting Shinobi"
pm2 start camera.js
pm2 start cron.js
pm2 logs
fi
if [ ! -e "INSTALL/installed.txt" ]; then
chmod +x INSTALL/now.sh&&INSTALL/now.sh

View file

@ -0,0 +1,41 @@
var fs = require('fs');
var moment = require('moment');
var exec = require('child_process').exec;
var execSync = require('child_process').execSync;
s = {
isWin: (process.platform === 'win32' || process.platform === 'win64'),
mainDirectory: __dirname.split('/INSTALL')[0]
}
var createTerminalCommands = function(callback){
var next = function(){
if(callback)callback()
}
if(!s.isWin){
var etcPath = '/etc/shinobisystems/'
console.log('Creating "' + etcPath + '"...')
var createPathFile = function(){
var pathTxt = etcPath + 'cctv.txt'
console.log('Creating "' + pathTxt + '"...')
fs.writeFile(pathTxt,s.mainDirectory,function(err){
if(err)console.log(err)
fs.chmod(pathTxt,0o777,function(err){
if(err)console.log(err)
console.log('Linking "' + s.mainDirectory + '/INSTALL/shinobi" to "/usr/bin/shinobi"...')
fs.symlink(s.mainDirectory + '/INSTALL/shinobi', '/usr/bin/shinobi', next)
console.log('You can now use `shinobi` in terminal.')
})
})
}
fs.stat(etcPath,function(err,stat){
if(!err && stat){
createPathFile()
}else{
fs.mkdir(etcPath,createPathFile)
}
})
}else{
//no commands for windows yet
next()
}
}
createTerminalCommands()

View file

@ -30,12 +30,17 @@ if [ ! -e "./super.json" ]; then
echo "* You can edit these settings in \"super.json\" located in the Shinobi directory."
sudo cp super.sample.json super.json
fi
if ! [ -x "$(command -v ifconfig)" ]; then
echo "============="
echo "Shinobi - Installing Net-Tools"
sudo apt install net-tools -y
fi
if ! [ -x "$(command -v node)" ]; then
echo "============="
echo "Shinobi - Installing Node.js"
wget https://deb.nodesource.com/setup_9.x
chmod +x setup_9.x
./setup_9.x
wget https://deb.nodesource.com/setup_8.x
chmod +x setup_8.x
./setup_8.x
sudo apt install nodejs -y
else
echo "Node.js Found..."
@ -44,7 +49,7 @@ fi
if ! [ -x "$(command -v npm)" ]; then
sudo apt install npm -y
fi
sudo apt install make -y
sudo apt install make zip -y
if ! [ -x "$(command -v ffmpeg)" ]; then
if [ "$getubuntuversion" = "16" ] || [ "$getubuntuversion" < "16" ]; then
echo "============="
@ -132,21 +137,14 @@ if [ "$startShinobi" = "y" ] || [ "$startShinobi" = "y" ]; then
sudo pm2 save
sudo pm2 list
fi
if [ ! "$sqliteormariadb" = "M" ] && [ ! "$sqliteormariadb" = "m" ]; then
echo "====================================="
echo "||===== Install Completed =====||"
echo "====================================="
echo "|| Login with the Superuser and create a new user!!"
echo "||==================================="
echo "|| Open http://$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'):8080/super in your web browser."
echo "||==================================="
echo "|| Default Superuser : admin@shinobi.video"
echo "|| Default Password : admin"
echo "====================================="
echo "====================================="
else
echo "+=================================+"
echo "||===== Install Completed =====||"
echo "|| Access the main Shinobi panel at http://$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'):8080 in your web browser."
echo "+=================================+"
fi
echo "====================================="
echo "||===== Install Completed =====||"
echo "====================================="
echo "|| Login with the Superuser and create a new user!!"
echo "||==================================="
echo "|| Open http://$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'):8080/super in your web browser."
echo "||==================================="
echo "|| Default Superuser : admin@shinobi.video"
echo "|| Default Password : admin"
echo "====================================="
echo "====================================="