Merge branch 'dev' into 'dev'

Updated to better work with update Ninja installer

See merge request Shinobi-Systems/Shinobi!105
merge-requests/107/head
Moe 2019-08-25 18:39:04 +00:00
commit cc3c016470
2 changed files with 69 additions and 48 deletions

View File

@ -27,18 +27,24 @@ yum install nano $vm dos2unix net-tools curl wget git make zip -y
echo "Updating system"
sudo yum update -y
#Clone git repo and change directory
sudo git clone https://gitlab.com/Shinobi-Systems/Shinobi.git Shinobi
cd Shinobi
#Skip if running from the Ninja installer
if [ "$1" != 1 ]; then
#Clone git repo and change directory
sudo git clone https://gitlab.com/Shinobi-Systems/Shinobi.git Shinobi
cd Shinobi
echo "========================================================="
echo "Do you want to use the Master or Development branch of Shinobi?"
echo "[M]aster or [D]ev"
read gitbranch
if [ "$gitbranch" = "d" ] || [ "$gitbranch" = "D" ]; then
#Change to dev branch
sudo git checkout dev
sudo git pull
echo "========================================================="
echo "Do you want to use the Master or Development branch of Shinobi?"
read -p "[M]aster or [D]ev " gitbranch
#Changes input to uppercase
gitbranch=${gitbranch^}
if [ "$gitbranch" = "D" ]; then
#Change to dev branch
sudo git checkout dev
sudo git pull
fi
fi
if ! [ -x "$(command -v node)" ]; then
@ -55,10 +61,12 @@ if ! [ -x "$(command -v npm)" ]; then
fi
echo "========================================================="
echo "Do you want to install FFMPEG?"
echo "[Y]es or [N]o"
read ffmpeginstall
if [ "$ffmpeginstall" = "y" ] || [ "$ffmpeginstall" = "Y" ]; then
read -p "Do you want to install FFMPEG? Y/N " ffmpeginstall
#Changes input to uppercase
ffmpeginstall=${ffmpeginstall^}
if [ "$ffmpeginstall" = "Y" ]; then
#Install EPEL Repo
sudo yum install epel-release -y
#Enable Nux Dextop repo for FFMPEG
@ -73,9 +81,12 @@ echo "MariaDB (MySQL) is better for medium to large installations"
echo "while SQLite is better for small installations"
echo
echo "Press [ENTER] for default [MariaDB]"
echo "[M]ariaDB, [S]QLite3 or [N]othing"
read sqliteormariadb
if [ "$sqliteormariadb" = "S" ] || [ "$sqliteormariadb" = "s" ]; then
read -p "[M]ariaDB, [S]QLite3 or [N]othing " sqliteormariadb
#Changes input to uppercase
sqliteormariadb=${sqliteormariadb^}
if [ "$sqliteormariadb" = "S" ]; then
echo "========================================================="
echo "Installing SQLite3..."
sudo npm install jsonfile
@ -88,7 +99,7 @@ if [ "$sqliteormariadb" = "S" ] || [ "$sqliteormariadb" = "s" ]; then
else
echo "shinobi.sqlite already exists. Continuing..."
fi
elif [ "$sqliteormariadb" = "m" ] || [ "$sqliteormariadb" = "M" ] || [ "$sqliteormariadb" = "" ]; then
elif [ "$sqliteormariadb" = "M" ] || [ "$sqliteormariadb" = "" ]; then
echo "========================================================="
echo "Installing MariaDB repository..."
#Add the MariaDB repository to yum
@ -102,10 +113,12 @@ elif [ "$sqliteormariadb" = "m" ] || [ "$sqliteormariadb" = "M" ] || [ "$sqliteo
sudo mysql_secure_installation
echo "========================================================="
echo "Install default database?"
echo "[Y]es or [N]o"
read mysqlDefaultData
if [ "$mysqlDefaultData" = "y" ] || [ "$mysqlDefaultData" = "Y" ]; then
read -p "Install default database? Y/N " mysqlDefaultData
#Changes input to uppercase
mysqlDefaultData=${mysqlDefaultData^}
if [ "$mysqlDefaultData" = "Y" ]; then
echo "Please enter your MariaDB Username"
read sqluser
echo "Please enter your MariaDB Password"
@ -114,7 +127,7 @@ elif [ "$sqliteormariadb" = "m" ] || [ "$sqliteormariadb" = "M" ] || [ "$sqliteo
sudo mysql -u $sqluser -p$sqlpass -e "source sql/framework.sql" || true
fi
elif [ "$sqliteormariadb" = "n" ] || [ "$sqliteormariadb" = "N" ]; then
elif [ "$sqliteormariadb" = "N" ]; then
echo "========================================================="
echo "Skipping database server installation..."
fi
@ -136,13 +149,15 @@ dos2unix INSTALL/shinobi
ln -s INSTALL/shinobi /usr/bin/shinobi
echo "========================================================="
echo "Automatically create firewall rules?"
echo "[Y]es or [N]o"
read createfirewallrules
if [ "$createfirewallrules" = "y" ] || [ "$createfirewallrules" = "Y" ]; then
sudo firewall-cmd --permanent --add-port=8080/tcp -q
sudo firewall-cmd --reload -q
fi
read -p "Automatically create firewall rules? Y/N " createfirewallrules
#Changes input to uppercase
createfirewallrules=${createfirewallrules^}
if [ "$createfirewallrules" = "Y" ]; then
sudo firewall-cmd --permanent --add-port=8080/tcp -q
sudo firewall-cmd --reload -q
fi
#Create default configuration file
if [ ! -e "./conf.json" ]; then
@ -153,29 +168,35 @@ if [ ! -e "./super.json" ]; then
echo "========================================================="
echo "Enable superuser access?"
echo "This may be useful for account and password managment"
echo "in commercial deployments"
echo "[Y]es or [N]o"
read createSuperJson
if [ "$createSuperJson" = "y" ] || [ "$createSuperJson" = "Y" ]; then
read -p "in commercial deployments. Y/N " createSuperJson
#Changes input to uppercase
createSuperJson=${createSuperJson^}
if [ "$createSuperJson" = "Y" ]; then
sudo cp super.sample.json super.json
fi
fi
echo "========================================================="
echo "Start Shinobi on boot?"
echo "[Y]es or [N]o"
read startupShinobi
if [ "$startupShinobi" = "y" ] || [ "$startupShinobi" = "Y" ] || [ "$startupShinobi" = "yes" ] || [ "$startupShinobi" = "Yes" ]; then
read -p "Start Shinobi on boot? Y/N " startupShinobi
#Changes input to uppercase
startupShinobi=${startupShinobi^}
if [ "$startupShinobi" = "Y" ]; then
sudo pm2 startup
sudo pm2 save
sudo pm2 list
fi
echo "========================================================="
echo "Start Shinobi now?"
echo "[Y]es or [N]o"
read startShinobi
if [ "$startShinobi" = "y" ] || [ "$startShinobi" = "Y" ] || [ "$startShinobi" = "yes" ] || [ "$startShinobi" = "Yes" ]; then
read -p "Start Shinobi now? Y/N " startShinobi
#Changes input to uppercase
startShinobi=${startShinobi^}
if [ "$startShinobi" = "Y" ]; then
sudo pm2 start camera.js
sudo pm2 start cron.js
fi
@ -186,12 +207,12 @@ echo "||=============== Installation Complete ===============||"
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 "|| Open http://$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'):8080/super in your browser. ||"
echo "========================================================="
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\" ||"
echo "|| You can edit these settings in \"super.json\" ||"
echo "|| located in the Shinobi directory. ||"
echo "========================================================="
fi
fi

View File

@ -35,10 +35,10 @@ sh INSTALL/opensuse.sh
;;
"6")
chmod +x "INSTALL/CentOS - Quick Install.sh"
sh "INSTALL/CentOS - Quick Install.sh"
sh "INSTALL/CentOS - Quick Install.sh" 1
;;
*)
echo "Choice not found."
;;
esac
esac