-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstaller.sh
47 lines (40 loc) · 1.11 KB
/
installer.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
#!/bin/bash
INSTALLDIR=/opt/ambianic
BRANCH=master
TMPDIR=$(dirname $(mktemp tmp.XXXXXXXXXX -ut))
sudo true
if ! type "git" > /dev/null; then
sudo apt update -q && sudo apt install git -y
fi
echo "Installing Ambianic.ai in $INSTALLDIR"
# directory exists
if [ -d "$INSTALLDIR" ]
then
if [ ! -d "$INSTALLDIR/.git" ]
then
echo "Directory $INSTALLDIR exists but is cannot be recognized as an Ambianic.ai installation."
echo "Move it away or remove it and run again this script to continue the setup."
exit 1
else
echo "Updating ..."
cd $INSTALLDIR
git pull origin $BRANCH
sh $INSTALLDIR/scripts/setup.sh
sh $INSTALLDIR/scripts/updates.sh
echo "Restarting Ambianic.ai"
sudo ambianic restart
sleep 3
ambianic ui
exit 0
fi
fi
# clean install
echo "Installing in $INSTALLDIR"
git clone -b $BRANCH https://github.com/ambianic/ambianic-quickstart.git $TMPDIR/ambianic
sudo mv $TMPDIR/ambianic $INSTALLDIR
sh $INSTALLDIR/scripts/setup.sh
echo "Starting Ambianic.ai"
sudo ambianic start
sleep 3
ambianic ui
exit 0