mirror of
https://gitlab.com/Shinobi-Systems/ShinobiCE.git
synced 2025-03-09 15:40:15 +00:00
Blue Turtle - The Refactoring+
- Update install scripts
This commit is contained in:
parent
b7d08eb500
commit
c7e70c03e8
6 changed files with 269 additions and 85 deletions
|
@ -33,7 +33,7 @@ echo "Shinobi - Do you want to Install FFMPEG?"
|
|||
echo "(y)es or (N)o"
|
||||
read ffmpeginstall
|
||||
if [ "$ffmpeginstall" = "y" ] || [ "$ffmpeginstall" = "Y" ]; then
|
||||
echo "Shinobi - Do you want to Install FFMPEG with `apt` or download a static version provided with `npm`?"
|
||||
echo "Shinobi - Do you want to Install FFMPEG with yum or download a static version provided with npm?"
|
||||
echo "(a)pt or (N)pm"
|
||||
echo "Press [ENTER] for default (npm)"
|
||||
read ffmpegstaticinstall
|
||||
|
@ -45,7 +45,7 @@ if [ "$ffmpeginstall" = "y" ] || [ "$ffmpeginstall" = "Y" ]; then
|
|||
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
|
||||
sudo yum install ffmpeg ffmpeg-devel -y
|
||||
else
|
||||
sudo npm install ffmpeg-static@2.2.1
|
||||
sudo npm install ffbinaries
|
||||
fi
|
||||
fi
|
||||
echo "Shinobi - Do you want to Install Node.js?"
|
||||
|
@ -99,49 +99,21 @@ else
|
|||
read sqlpass
|
||||
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" ] || [ "$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
|
||||
fi
|
||||
echo "============="
|
||||
echo "Shinobi - Install NPM Libraries"
|
||||
sudo npm i npm -g
|
||||
sudo npm install --unsafe-perm
|
||||
sudo npm audit fix --unsafe-perm
|
||||
sudo npm audit fix --force
|
||||
echo "============="
|
||||
echo "Shinobi - Install PM2"
|
||||
sudo npm install pm2 -g
|
||||
echo "Shinobi - Finished"
|
||||
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
|
||||
|
@ -188,4 +160,4 @@ else
|
|||
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
|
||||
fi
|
||||
|
|
|
@ -43,7 +43,7 @@ echo "============="
|
|||
echo "Shinobi - Install NPM Libraries"
|
||||
npm i npm -g
|
||||
npm install --unsafe-perm
|
||||
npm audit fix --unsafe-perm
|
||||
sudo npm audit fix --force
|
||||
echo "============="
|
||||
echo "Shinobi - Install PM2"
|
||||
npm install pm2 -g
|
||||
|
|
|
@ -8,6 +8,7 @@ echo "1. Ubuntu"
|
|||
echo "2. CentOS"
|
||||
echo "3. MacOS"
|
||||
echo "4. FreeBSD"
|
||||
echo "5. OpenSUSE"
|
||||
echo "========"
|
||||
read oschoicee
|
||||
case $oschoicee in
|
||||
|
@ -27,6 +28,11 @@ INSTALL/macos.sh
|
|||
chmod +x INSTALL/freebsd.sh
|
||||
INSTALL/freebsd.sh
|
||||
;;
|
||||
"5")
|
||||
chmod +x INSTALL/opensuse.sh
|
||||
INSTALL/opensuse.sh
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Choice not found."
|
||||
;;
|
||||
|
|
164
INSTALL/opensuse.sh
Normal file
164
INSTALL/opensuse.sh
Normal file
|
@ -0,0 +1,164 @@
|
|||
#!/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 "============="
|
||||
if [ ! -e "./conf.json" ]; then
|
||||
cp conf.sample.json conf.json
|
||||
fi
|
||||
if [ ! -e "./super.json" ]; then
|
||||
echo "Default Superuser : admin@shinobi.video"
|
||||
echo "Default Password : admin"
|
||||
sudo cp super.sample.json super.json
|
||||
echo "Shinobi - Do you want to enable superuser access?"
|
||||
echo "This may be useful if passwords are forgotten or"
|
||||
echo "if you would like to limit accessibility of an"
|
||||
echo "account for business scenarios."
|
||||
echo "(y)es or (N)o"
|
||||
read createSuperJson
|
||||
if [ "$createSuperJson" = "y" ] || [ "$createSuperJson" = "Y" ]; then
|
||||
echo "Default Superuser : admin@shinobi.video"
|
||||
echo "Default Password : admin"
|
||||
echo "* You can edit these settings in \"super.json\" located in the Shinobi directory."
|
||||
sudo cp super.sample.json super.json
|
||||
fi
|
||||
fi
|
||||
echo "Shinobi - Run zypper refresh"
|
||||
sudo zypper refresh
|
||||
sudo zypper install -y make
|
||||
echo "============="
|
||||
echo "Shinobi - Do you want to Install Node.js?"
|
||||
echo "(y)es or (N)o"
|
||||
NODEJSINSTALL=0
|
||||
read nodejsinstall
|
||||
if [ "$nodejsinstall" = "y" ] || [ "$nodejsinstall" = "Y" ]; then
|
||||
sudo zypper install -y nodejs8
|
||||
NODEJSINSTALL=1
|
||||
fi
|
||||
echo "============="
|
||||
echo "Shinobi - Do you want to Install FFMPEG?"
|
||||
echo "(y)es or (N)o"
|
||||
read ffmpeginstall
|
||||
if [ "$ffmpeginstall" = "y" ] || [ "$ffmpeginstall" = "Y" ]; then
|
||||
# Without nodejs8 package we can't use npm command
|
||||
if [ "$NODEJSINSTALL" -eq "1" ]; then
|
||||
echo "Shinobi - Do you want to Install FFMPEG with 'zypper --version' or download a static version provided with npm 'npm --version'?"
|
||||
echo "(z)ypper or (N)pm"
|
||||
echo "Press [ENTER] for default (npm)"
|
||||
read ffmpegstaticinstall
|
||||
if [ "$ffmpegstaticinstall" = "z" ] || [ "$ffmpegstaticinstall" = "Z" ]; then
|
||||
# Install ffmpeg and ffmpeg-devel
|
||||
sudo zypper install -y ffmpeg ffmpeg-devel
|
||||
else
|
||||
sudo npm install ffbinaries
|
||||
fi
|
||||
else
|
||||
sudo zypper install -y ffmpeg ffmpeg-devel
|
||||
fi
|
||||
fi
|
||||
echo "============="
|
||||
echo "Shinobi - Do you want to use MariaDB or SQLite3?"
|
||||
echo "SQLite3 is better for small installs"
|
||||
echo "MariaDB (MySQL) is better for large installs"
|
||||
echo "(S)QLite3 or (M)ariaDB?"
|
||||
echo "Press [ENTER] for default (MariaDB)"
|
||||
read sqliteormariadb
|
||||
if [ "$sqliteormariadb" = "S" ] || [ "$sqliteormariadb" = "s" ]; then
|
||||
sudo npm install jsonfile
|
||||
sudo zypper install -y sqlite3 sqlite3-devel
|
||||
sudo npm install sqlite3
|
||||
node ./tools/modifyConfiguration.js databaseType=sqlite3
|
||||
if [ ! -e "./shinobi.sqlite" ]; then
|
||||
echo "Creating shinobi.sqlite for SQLite3..."
|
||||
sudo cp sql/shinobi.sample.sqlite shinobi.sqlite
|
||||
else
|
||||
echo "shinobi.sqlite already exists. Continuing..."
|
||||
fi
|
||||
else
|
||||
echo "============="
|
||||
echo "Shinobi - Do you want to Install MariaDB?"
|
||||
echo "(y)es or (N)o"
|
||||
read mysqlagree
|
||||
if [ "$mysqlagree" = "y" ] || [ "$mysqlagree" = "Y" ]; then
|
||||
sudo zypper install -y mariadb
|
||||
#Start mysql and enable on boot
|
||||
sudo systemctl start mariadb
|
||||
sudo systemctl enable mariadb
|
||||
#Run mysql install
|
||||
sudo mysql_secure_installation
|
||||
fi
|
||||
echo "============="
|
||||
echo "Shinobi - Database Installation"
|
||||
echo "(y)es or (N)o"
|
||||
read mysqlagreeData
|
||||
if [ "$mysqlagreeData" = "y" ] || [ "$mysqlagreeData" = "Y" ]; then
|
||||
echo "What is your SQL Username?"
|
||||
read sqluser
|
||||
echo "What is your SQL Password?"
|
||||
read sqlpass
|
||||
sudo mysql -u $sqluser -p$sqlpass -e "source sql/user.sql" || true
|
||||
sudo mysql -u $sqluser -p$sqlpass -e "source sql/framework.sql" || true
|
||||
fi
|
||||
fi
|
||||
echo "============="
|
||||
echo "Shinobi - Install NPM Libraries"
|
||||
npm i npm -g
|
||||
npm install --unsafe-perm
|
||||
sudo npm audit fix --force
|
||||
echo "============="
|
||||
echo "Shinobi - Install PM2"
|
||||
sudo npm install pm2 -g
|
||||
echo "Shinobi - Finished"
|
||||
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
|
||||
if [ "$startShinobi" = "y" ] || [ "$startShinobi" = "Y" ]; then
|
||||
sudo pm2 start camera.js
|
||||
sudo pm2 start cron.js
|
||||
sudo pm2 startup
|
||||
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
|
|
@ -1,10 +1,71 @@
|
|||
#!/bin/bash
|
||||
installationDirectory="/home/Shinobi"
|
||||
if [ -e "$installationDirectory/INSTALL/installed.txt" ]; then
|
||||
echo "Starting Shinobi"
|
||||
pm2 start $installationDirectory/camera.js
|
||||
pm2 start $installationDirectory/cron.js
|
||||
if [ ! "$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"
|
||||
echo "========================================================="
|
||||
echo "Your available options for COMMAND are as follows"
|
||||
echo "========================================================="
|
||||
echo "| start or s :"
|
||||
echo "|--> Start camera.js and cron.js under PM2 (Process Manager)"
|
||||
echo "-"
|
||||
echo "| restart or r :"
|
||||
echo "|--> Restart all processes running under the PM2 daemon."
|
||||
echo "-"
|
||||
echo "| stop, exit, or e :"
|
||||
echo "|--> Stop all processes running under the PM2 daemon."
|
||||
echo "-"
|
||||
echo "| logs :"
|
||||
echo "|--> Get PM2 log stream with last 100 lines."
|
||||
echo "-"
|
||||
echo "| clear, flush, or f :"
|
||||
echo "|--> Clear all PM2 logs."
|
||||
echo "-"
|
||||
echo "| kill :"
|
||||
echo "|--> Stop the entire PM2 daemon."
|
||||
fi
|
||||
if [[ $@ == *'clear'* ]] || [[ $@ == *'flush'* ]]; then
|
||||
pm2 flush
|
||||
fi
|
||||
if [[ $@ == *'restart'* ]]; then
|
||||
proccessAlive=$(pm2 list | grep camera)
|
||||
if [ "$proccessAlive" ]; then
|
||||
pm2 restart all
|
||||
else
|
||||
echo "Shinobi process is not running."
|
||||
fi
|
||||
else
|
||||
if [[ $@ == *'start'* ]] || [[ $@ == *'now'* ]]; then
|
||||
proccessAlive=$(pm2 list | grep camera | grep online)
|
||||
if [ "$proccessAlive" ]]; then
|
||||
echo "Shinobi process is already running."
|
||||
else
|
||||
if [ -e "$installationDirectory/INSTALL/installed.txt" ]; then
|
||||
echo "Starting Shinobi"
|
||||
pm2 start $installationDirectory/camera.js
|
||||
pm2 start $installationDirectory/cron.js
|
||||
fi
|
||||
if [ ! -e "$installationDirectory/INSTALL/installed.txt" ]; then
|
||||
chmod +x $installationDirectory/INSTALL/now.sh&&INSTALL/now.sh
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [[ $@ == *'stop'* ]] || [[ $@ == *'exit'* ]]; then
|
||||
proccessAlive=$(pm2 list | grep camera)
|
||||
if [ "$proccessAlive" ]; then
|
||||
pm2 kill
|
||||
else
|
||||
echo "Shinobi process is not running."
|
||||
fi
|
||||
fi
|
||||
if [[ $@ == *'kill'* ]]; then
|
||||
pm2 kill
|
||||
fi
|
||||
if [[ $@ == *'logs'* ]]; then
|
||||
pm2 logs --lines 100
|
||||
fi
|
||||
if [ ! -e "$installationDirectory/INSTALL/installed.txt" ]; then
|
||||
chmod +x $installationDirectory/INSTALL/now.sh&&INSTALL/now.sh
|
||||
fi
|
|
@ -5,10 +5,26 @@ 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 "============="
|
||||
#Detect Ubuntu Version
|
||||
echo "============="
|
||||
echo " Detecting Ubuntu Version"
|
||||
echo "============="
|
||||
getubuntuversion=$(lsb_release -r | awk '{print $2}' | cut -d . -f1)
|
||||
echo "============="
|
||||
echo " Ubuntu Version: $getubuntuversion"
|
||||
echo "============="
|
||||
if [ "$getubuntuversion" = "18" ] || [ "$getubuntuversion" > "18" ]; then
|
||||
apt install sudo wget -y
|
||||
sudo apt install -y software-properties-common
|
||||
sudo add-apt-repository universe -y
|
||||
fi
|
||||
#create conf.json
|
||||
if [ ! -e "./conf.json" ]; then
|
||||
sudo cp conf.sample.json conf.json
|
||||
fi
|
||||
#create super.json
|
||||
if [ ! -e "./super.json" ]; then
|
||||
echo "============="
|
||||
echo "Shinobi - Do you want to enable superuser access?"
|
||||
echo "This may be useful if passwords are forgotten or"
|
||||
echo "if you would like to limit accessibility of an"
|
||||
|
@ -22,6 +38,7 @@ if [ ! -e "./super.json" ]; then
|
|||
sudo cp super.sample.json super.json
|
||||
fi
|
||||
fi
|
||||
echo "============="
|
||||
echo "Shinobi - Do you want to Install Node.js?"
|
||||
echo "(y)es or (N)o"
|
||||
read nodejsinstall
|
||||
|
@ -37,20 +54,12 @@ echo "Shinobi - Do you want to Install FFMPEG?"
|
|||
echo "(y)es or (N)o"
|
||||
read ffmpeginstall
|
||||
if [ "$ffmpeginstall" = "y" ] || [ "$ffmpeginstall" = "Y" ]; then
|
||||
echo "Shinobi - Do you want to Install FFMPEG with `apt` or download a static version provided with `npm`?"
|
||||
echo "Shinobi - Do you want to Install FFMPEG with apt or download a static version provided with npm?"
|
||||
echo "(a)pt or (N)pm"
|
||||
echo "Press [ENTER] for default (npm)"
|
||||
read ffmpegstaticinstall
|
||||
if [ "$ffmpegstaticinstall" = "a" ] || [ "$ffmpegstaticinstall" = "A" ]; then
|
||||
#Detect Ubuntu Version
|
||||
echo "============="
|
||||
echo " Detecting Ubuntu Version"
|
||||
echo "============="
|
||||
declare -i getubuntuversion=$(lsb_release -r | awk '{print $2}' | cut -d . -f1)
|
||||
echo "============="
|
||||
echo " Ubuntu Version: $getubuntuversion"
|
||||
echo "============="
|
||||
if [[ "$getubuntuversion" == "16" || "$getubuntuversion" < "16" ]]; then
|
||||
if [ "$getubuntuversion" = "16" ] || [ "$getubuntuversion" < "16" ]; then
|
||||
echo "============="
|
||||
echo "Shinobi - Get FFMPEG 3.x from ppa:jonathonf/ffmpeg-3"
|
||||
sudo add-apt-repository ppa:jonathonf/ffmpeg-3 -y
|
||||
|
@ -63,7 +72,7 @@ if [ "$ffmpeginstall" = "y" ] || [ "$ffmpeginstall" = "Y" ]; then
|
|||
echo "============="
|
||||
fi
|
||||
else
|
||||
sudo npm install ffmpeg-static@2.2.1
|
||||
sudo npm install ffbinaries
|
||||
fi
|
||||
fi
|
||||
echo "============="
|
||||
|
@ -113,49 +122,21 @@ else
|
|||
fi
|
||||
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" ] || [ "$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
|
||||
fi
|
||||
echo "============="
|
||||
echo "Shinobi - Install NPM Libraries"
|
||||
sudo npm i npm -g
|
||||
sudo npm install --unsafe-perm
|
||||
sudo npm audit fix --unsafe-perm
|
||||
sudo npm audit fix --force
|
||||
echo "============="
|
||||
echo "Shinobi - Install PM2"
|
||||
sudo npm install pm2 -g
|
||||
echo "Shinobi - Finished"
|
||||
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
|
||||
|
@ -202,4 +183,4 @@ else
|
|||
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
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue