-
Notifications
You must be signed in to change notification settings - Fork 0
/
init
executable file
·71 lines (56 loc) · 1.59 KB
/
init
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
#!/usr/bin/env bash
export os=$(uname)
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
echo "Docker Compose for Linux" >> system.log
cp docker-compose-linux.yml docker-compose.yml
echo "Changing project name on files" >> system.log
sed -i '' -e "s/<project_name>/$project_name/g" docker-compose.yml
clear
#docker-compose pull
echo "Folder permission" >> system.log
chmod -R 777 src
echo "Start the containers" >> system.log
bash start