-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathinstallfromzip.sh
executable file
·60 lines (52 loc) · 1.61 KB
/
installfromzip.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
#!/bin/bash
# Enrico Simonetti
# enricosimonetti.com
if [ -z $1 ]
then
echo Provide the zip file path containing the Sugar installer
else
# check if the stack is running
RUNNING=`docker ps | grep sugar-cron | wc -l`
if [ $RUNNING -gt 0 ]
then
# enter the repo's root directory
REPO="$( dirname ${BASH_SOURCE[0]} )/../"
cd $REPO
# running
# if it is our repo
if [ -f '.gitignore' ] && [ -d 'data' ]
then
# locate the zip
if [ ! -f $1 ]
then
echo $1 does not exist, please provide the zip file path containing the Sugar installer
exit 1
fi
# remove current sugar dir
if [ -d './data/app/sugar' ]
then
sudo rm -rf ./data/app/sugar
fi
# unzip the zip
if [ -d './data/app/tmp' ]
then
sudo rm -rf ./data/app/tmp
fi
mkdir ./data/app/tmp
echo Unzipping $1, please wait...
unzip -q $1 -d ./data/app/tmp
SUGAR_TMP_DIR=`ls -d ./data/app/tmp/*`
mv $SUGAR_TMP_DIR ./data/app/sugar
rm -rf ./data/app/tmp
echo Done
# refresh system
./utilities/build/refreshsystem.sh
# execute silent installation
./utilities/build/silentinstall.sh
else
echo The command needs to be executed from within the clone of the repository
fi
else
echo The stack needs to be running to complete Sugar\'s installation
fi
fi