Skip to content

Commit

Permalink
Hero of Time
Browse files Browse the repository at this point in the history
  • Loading branch information
moeiscool committed Feb 12, 2018
1 parent cb936a8 commit 14aae61
Show file tree
Hide file tree
Showing 61 changed files with 21,886 additions and 1,440 deletions.
1 change: 1 addition & 0 deletions INSTALL/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
installed.txt
18 changes: 17 additions & 1 deletion INSTALL/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
`ubuntu.sh` wass originally `INSTALL.sh`.
#### Fast Install (The Ninja Way)

1. Become `root` to use the installer and run Shinobi. Use one of the following to do so.

- Ubuntu 17.04, 17.10
- `sudo su`
- CentOS 7
- `su`
- MacOS 10.7(+)
- `su`
2. Download and run the installer.

```
bash <(curl -s https://raw.githubusercontent.com/ShinobiCCTV/Shinobi-Installer/master/shinobi-install.sh)
```

More info can be found here. https://shinobi.video/docs/start
5 changes: 5 additions & 0 deletions INSTALL/autoinstall-ubuntu-latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apt install git -y
git clone https://github.com/ShinobiCCTV/Shinobi.git -b dev Shinobi-dev
cd Shinobi-dev
chmod +x INSTALL/ubuntu-easyinstall.sh && INSTALL/ubuntu-easyinstall.sh
bash INSTALL/ubuntu-easyinstall.sh
5 changes: 5 additions & 0 deletions INSTALL/autoinstall-ubuntu-stable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apt install git -y
git clone https://github.com/ShinobiCCTV/Shinobi.git Shinobi
cd Shinobi
chmod +x INSTALL/ubuntu-easyinstall.sh && INSTALL/ubuntu-easyinstall.sh
bash INSTALL/ubuntu-easyinstall.sh
73 changes: 73 additions & 0 deletions INSTALL/freebsd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/tcsh
echo "========================================================="
echo "==== Shinobi : The Open Source CCTV and NVR Solution ===="
echo "========================================================="
echo "This script should run as root inside your jail from the root"
echo "of the cloned git repository."
echo "To answer yes type the letter (y) in lowercase and press ENTER."
echo "Default is no (N). Skip any components you already have or don't need."
echo "============="
echo "Shinobi - Do you want to Install Node.js?"
echo "(y)es or (N)o"
set nodejsinstall = $<
if ( $nodejsinstall == "y" ) then
pkg install -y node8 npm-node8
endif
echo "============="
echo "Shinobi - Do you want to Install FFMPEG?"
echo "(y)es or (N)o"
set ffmpeginstall = $<
if ( $ffmpeginstall == "y" ) then
pkg install -y ffmpeg libav x264 x265
endif
echo "============="
echo "Shinobi - Database Installation"
echo "WARNING - This requires an existing and running mariadb service."
echo "(y)es or (N)o"
set mysqlagreeData = $<
if ( $mysqlagreeData == "y" ) then
echo "What is your SQL Username?"
set sqluser = $<
echo "What is your SQL Password?"
set sqlpass = $<
echo "What is your SQL Host?"
set sqlhost = $<
echo "Installing mariadb client..."
pkg install -y mariadb102-client
echo "Installing database schema..."
mysql -h $sqlhost -u $sqluser -p$sqlpass -e "source sql/user.sql" || true
mysql -h $sqlhost -u $sqluser -p$sqlpass -e "source sql/framework.sql" || true
echo "Shinobi - Use the /super endpoint to create your super user."
endif
echo "============="
echo "Shinobi - Install NPM Libraries"
npm install
echo "============="
echo "Shinobi - Install PM2"
npm install pm2 -g
if (! -e "./conf.json" ) then
cp conf.sample.json conf.json
endif
if (! -e "./super.json" ) then
echo "Default Superuser : [email protected]"
echo "Default Password : admin"
cp super.sample.json super.json
endif
echo "Shinobi - Start Shinobi?"
echo "(y)es or (N)o"
set startShinobi = $<
if ( $startShinobi == "y" ) then
set PM2BIN="$PWD/node_modules/pm2/bin"
$PM2BIN/pm2 start camera.js
$PM2BIN/pm2 start cron.js
$PM2BIN/pm2 save
$PM2BIN/pm2 list
endif
echo "Shinobi - Start on boot?"
echo "(y)es or (N)o"
set startupShinobi = $<
if ( $startupShinobi == "y" ) then
set PM2BIN="$PWD/node_modules/pm2/bin"
$PM2BIN/pm2 startup rcd
endif
echo "Shinobi - Finished"
148 changes: 141 additions & 7 deletions INSTALL/macos.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,141 @@
brew install git nodejs npm mysql
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
brew install ffmpeg --with-chromaprint --with-fdk-aac --with-fontconfig --with-freetype --with-frei0r --with-game-music-emu --with-libass --with-libbluray --with-libbs2b --with-libcaca --with-libebur128 --with-libgsm --with-libmodplug --with-libsoxr --with-libssh --with-libvidstab --with-libvorbis --with-libvpx --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-rubberband --with-schroedinger --with-sdl2 --with-snappy --with-speex --with-tesseract --with-theora --with-tools --with-two-lame --with-wavpack --with-webp --with-x265 --with-xz --with-zeromq --with-zimg
git clone https://github.com/moeiscool/shinobi Shinobi && cd Shinobi
cat sql/framework.sql | mysql -u root -p
#!/bin/bash
echo "========================================================="
echo "==!! Shinobi : The Open Source CCTV and NVR Solution !!=="
echo "========================================================="
echo "To answer yes type the letter (y) in lowercase and press ENTER."
echo "Default is no (N). Skip any components you already have or don't need."
echo "============="
echo "Shinobi - Do you want to Install Node.js?"
echo "(y)es or (N)o"
read nodejsinstall
if [ "$nodejsinstall" = "y" ]; then
curl -o node-v8.9.3.pkg https://nodejs.org/dist/v8.9.3/node-v8.9.3.pkg
sudo installer -pkg node-v8.9.3.pkg -target /
rm node-v8.9.3.pkg
sudo ln -s /usr/local/bin/node /usr/bin/nodejs
fi
echo "============="
echo "Shinobi - Do you want to Install FFmpeg?"
echo "(y)es or (N)o"
read ffmpeginstall
if [ "$ffmpeginstall" = "y" ]; then
echo "Shinobi - Installing FFmpeg"
curl -o ffmpeg.zip https://cdn.shinobi.video/installers/ffmpeg-3.4.1-macos.zip
sudo unzip ffmpeg.zip
sudo rm ffmpeg.zip
sudo mv ffmpeg-3.4.1-macos/ffmpeg /usr/bin/ffmpeg
sudo mv ffmpeg-3.4.1-macos/ffplay /usr/bin/ffplay
sudo mv ffmpeg-3.4.1-macos/ffprobe /usr/bin/ffprobe
sudo mv ffmpeg-3.4.1-macos/ffserver /usr/bin/ffserver
sudo chmod +x /usr/bin/ffmpeg
sudo chmod +x /usr/bin/ffplay
sudo chmod +x /usr/bin/ffprobe
sudo chmod +x /usr/bin/ffserver
fi
echo "============="
echo "Shinobi - Do you want to Install MySQL? Choose No if you have MySQL or MySQL already."
echo "(y)es or (N)o"
read mysqlagree
if [ "$mysqlagree" = "y" ]; then
echo "Shinobi - Installing MySQL"
bash <(curl -Ls http://git.io/eUx7rg)
fi
echo "============="
echo "Shinobi - Database Installation"
echo "(y)es or (N)o"
read mysqlagreeData
if [ "$mysqlagreeData" = "y" ]; then
if [ "$mysqlagree" = "y" ]; then
sqluser="root"
sqlpass=$(cat ~/Desktop/MYSQL_PASSWORD)
fi
if [ ! "$mysqlagree" = "y" ]; then
echo "Shinobi - Use root for database installation?"
echo "(y)es or (N)o"
read useroot
if [ "$useroot" = "y" ]; then
sqluser="root"
sqlpass=$(cat ~/Desktop/MYSQL_PASSWORD)
else
echo "What is your SQL Username?"
read sqluser
echo "What is your SQL Password?"
read sqlpass
fi
fi
echo "You may now be asked for your Administator (root for Mac OS, not MySQL) password"
sudo mysql -u $sqluser -p$sqlpass -e "source sql/user.sql" || true
sudo mysql -u $sqluser -p$sqlpass -e "source sql/framework.sql" || true
echo "Shinobi - Do you want to create a new user for viewing and managing cameras in Shinobi? You can do this later in the Superuser panel."
echo "(y)es or (N)o"
read mysqlDefaultData
if [ "$mysqlDefaultData" = "y" ]; then
escapeReplaceQuote='\\"'
groupKey=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 7 | head -n 1)
userID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)
userEmail=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)"@"$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)".com"
userPasswordPlain=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)
userPasswordMD5=$(echo -n "$userPasswordPlain" | md5sum | awk '{print $1}')
userDetails='{"days":"10"}'
userDetails=$(echo "$userDetails" | sed -e 's/"/'$escapeReplaceQuote'/g')
echo $userDetailsNew
apiIP='0.0.0.0'
apiKey=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
apiDetails='{"auth_socket":"1","get_monitors":"1","control_monitors":"1","get_logs":"1","watch_stream":"1","watch_snapshot":"1","watch_videos":"1","delete_videos":"1"}'
apiDetails=$(echo "$apiDetails" | sed -e 's/"/'$escapeReplaceQuote'/g')
rm sql/default_user.sql || true
echo "USE ccio;INSERT INTO Users (\`ke\`,\`uid\`,\`auth\`,\`mail\`,\`pass\`,\`details\`) VALUES (\"$groupKey\",\"$userID\",\"$apiKey\",\"$userEmail\",\"$userPasswordMD5\",\"$userDetails\");INSERT INTO API (\`code\`,\`ke\`,\`uid\`,\`ip\`,\`details\`) VALUES (\"$apiKey\",\"$groupKey\",\"$userID\",\"$apiIP\",\"$apiDetails\");" > "sql/default_user.sql"
sudo mysql -u $sqluser -p$sqlpass --database ccio -e "source sql/default_user.sql" > "INSTALL/log.txt"
echo "The following details will be shown again at the end of the installation."
echo "====================================="
echo "======= Login Credentials ======="
echo "|| Username : $userEmail"
echo "|| Password : $userPasswordPlain"
echo "|| API Key : $apiKey"
echo "====================================="
echo "====================================="
echo "** To change these settings login to either to the Superuser panel or login to the dashboard as the user that was just created and open the Settings window. **"
fi
fi
echo "============="
echo "Shinobi - Install NPM Libraries"
sudo npm install
echo "============="
echo "Shinobi - Install PM2"
sudo npm install pm2 -g
if [ ! -e "./conf.json" ]; then
sudo cp conf.sample.json conf.json
fi
if [ ! -e "./super.json" ]; then
echo "Default Superuser : [email protected]"
echo "Default Password : admin"
sudo cp super.sample.json super.json
fi
echo "Shinobi - Finished"
touch INSTALL/installed.txt
sudo chmod -R 755 .
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
echo "Shinobi - Start Shinobi and set to start on boot?"
echo "(y)es or (N)o"
read startShinobi
if [ "$startShinobi" = "y" ]; then
sudo pm2 start camera.js
sudo pm2 start cron.js
sudo pm2 startup
sudo pm2 save
sudo pm2 list
fi
echo "details written to INSTALL/installed.txt"
echo "====================================="
echo "======= Login Credentials ======="
echo "|| Username : $userEmail"
echo "|| Password : $userPasswordPlain"
echo "|| API Key : $apiKey"
echo "====================================="
echo "====================================="
14 changes: 7 additions & 7 deletions INSTALL/now.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ echo "========"
echo "Select your OS"
echo "If your OS is not on the list please refer to the docs."
echo "========"
echo "1. Ubuntu / Debian"
echo "2. CentOS / RHEL / Fedora"
#echo "3. MacOS"
echo "1. Ubuntu"
echo "2. CentOS"
echo "3. MacOS"
echo "========"
read oschoicee
case $oschoicee in
Expand All @@ -18,10 +18,10 @@ sh INSTALL/ubuntu.sh
chmod +x INSTALL/centos.sh
INSTALL/centos.sh
;;
#"3")
#chmod +x INSTALL/macos.sh
#INSTALL/macos.sh
# ;;
"3")
chmod +x INSTALL/macos.sh
INSTALL/macos.sh
;;
*)
echo "Choice not found."
;;
Expand Down
15 changes: 3 additions & 12 deletions INSTALL/start.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
#!/bin/bash
if [ -e "INSTALL/installed.txt" ]; then
echo "Start as Daemon with PM2?"
echo "(y)es or (N)o"
read daemon
case $oschoicee in
"y")
echo "Starting Shinobi"
pm2 start camera.js&&pm2 start cron.js&&pm2 logs
;;
*)
echo "Starting Shinobi not as daemon. Cron will not be started."
node camera.js
;;
esac
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
Expand Down
Loading

0 comments on commit 14aae61

Please sign in to comment.