-
Notifications
You must be signed in to change notification settings - Fork 1
/
starter.sh
76 lines (75 loc) · 2.81 KB
/
starter.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#! /bin/sh
echo "---------------------------------------------"
echo "Installing Shinobi"
echo '*Note : Default install location is "/shinobi"'
installLocation="/shinobi"
cd $installLocation
echo "Opening Install Location : \"$installLocation\""
if [ ! -d "shinobi/camera.js" ]; then
# Check OS
OSTYPE="$(uname -s)"
# Check if Git is needed
if [ ! -x "$(command -v git)" ]; then
# Check if Ubuntu
if [ -x "$(command -v apt)" ]; then
sudo apt update
sudo apt install git -y
fi
# Check if Cent OS
if [ -x "$(command -v yum)" ]; then
sudo yum update
sudo yum install git -y
fi
fi
# Check if wget is needed
if [ ! -x "$(command -v wget)" ]; then
# Check if Ubuntu
if [ -x "$(command -v apt)" ]; then
sudo apt install wget -y
fi
# Check if Cent OS
if [ -x "$(command -v yum)" ]; then
sudo yum install wget -y
fi
fi
echo "*--------------------**---------------------*"
echo "Installing Shinobi"
echo "---------------------------------------------"
productName="Shinobi Community Editon (CE)"
theRepo='CE'
theBranch='master'
# Download from Git repository
gitURL="https://gitlab.com/Shinobi-Systems/Shinobi$theRepo"
sudo find /shinobi -mindepth 1 ! -regex '^/shinobi/videos\(/.*\)?' -delete
sudo rm -rf /shinobi/.git
sudo git init
sudo git remote add origin $gitURL.git
sudo git fetch
sudo git checkout -t origin/master
# Enter Shinobi folder "/shinobi"gi
# cd shinobi
cp /installation/ubuntu.sh /shinobi/INSTALL -f && cp /installation/start.sh /shinobi/INSTALL -f
gitVersionNumber=$(git rev-parse HEAD)
theDateRightNow=$(date)
# write the version.json file for the main app to use
sudo touch version.json
sudo chmod 777 version.json
sudo echo '{"Product" : "'"$productName"'" , "Branch" : "'"$theBranch"'" , "Version" : "'"$gitVersionNumber"'" , "Date" : "'"$theDateRightNow"'" , "Repository" : "'"$gitURL"'"}' > version.json
echo "-------------------------------------"
echo "---------- Shinobi Systems ----------"
echo "Repository : $gitURL"
echo "Product : $productName"
echo "Branch : $theBranch"
echo "Version : $gitVersionNumber"
echo "Date : $theDateRightNow"
echo "-------------------------------------"
echo "-------------------------------------"
else
echo "!-----------------------------------!"
echo "Shinobi already downloaded."
cd shinobi
fi
# start the installer in the main app (or start shinobi if already installed)
echo "*-----------------------------------*"
sudo chmod +x INSTALL/start.sh
sudo INSTALL/start.sh