forked from beejhuff/docker-magento2-3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-sync
executable file
·86 lines (70 loc) · 2.15 KB
/
init-sync
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
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash
export os=$(uname)
rm ./start ./stop
cp .docker-files/stop ./
cp .docker-files/start ./
if [ -f system.log ]; then
rm system.log
fi
if [ -z $1 ]; then
echo "What is your project name?"
read project_name
export project_name=$project_name
else
export project_name=$1
fi
if ! grep -F "dev.local" /etc/hosts
then
if [ ! $os == "Linux" ]; then
sudo -- sh -c -e "echo '10.254.254.254 dev.local' >> /etc/hosts";
else
sudo -- sh -c -e "echo '127.0.0.1 dev.local' >> /etc/hosts";
fi
fi
if [ "$2" == "clone" ]; then
git clone https://github.com/Imagination-Media/docker-magento2 $project_name && cd $project_name;
echo "Git clone done" >> system.log
fi
if [ -d "~/.composer" ]; then
echo "Creating .compose" >> system.log
mkdir ~/.composer
fi
if [ -d "~/.npm" ]; then
echo "Creating .npm" >> system.log
mkdir ~/.npm
fi
if [ -d "~/.nvm" ]; then
echo "Creating .nvm" >> system.log
mkdir ~/.nvm
fi
git config --global core.autocrlf false
git config --global core.eol LF
git config --global core.fileMode false
git config --global diff.renamelimit 5000
echo "Setting folder permissions" >> system.log
sudo chmod -R u+x ./*
sudo chmod -R u+x ~/.composer
sudo chmod -R u+x ~/.npm
sudo chmod -R u+x ~/.nvm
echo "Check OS" >> system.log
if [ "$(uname)" == "Darwin" ]; then
echo "Docker Compose for MacOS" >> system.log
cp docker-compose-macos.yml docker-compose.yml
cp docker-sync-macos.yml docker-sync.yml
elif [ "$(uname)" == "cygwin" ] || [ "$(uname)" == "msys" ] || [ "$(uname)" == "win32" ]; then
echo "Docker Compose for Windows" >> system.log
cp docker-compose-macos.yml docker-compose.yml
cp docker-sync-macos.yml docker-sync.yml
else
echo "Docker Compose for Linux" >> system.log
cp docker-compose-linux.yml docker-compose.yml
fi
echo "Changing project name on files" >> system.log
sed -i '' -e "s/<project_name>/$project_name/g" docker-compose.yml
sed -i '' -e "s/<project_name>/$project_name/g" docker-sync.yml
clear
#docker-compose pull
echo "Folder permission" >> system.log
chmod -R 777 src
echo "Start the containers" >> system.log
bash start