forked from duhon/magento-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_project
executable file
·58 lines (45 loc) · 1.6 KB
/
init_project
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
#!/usr/bin/env bash
set -ex
source ./.env
export $(cut -s -d= -f1 ./.env)
DOCKER_PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# for Mutagen installation: Update Magento path in mutagen.yml
sed -ie "s|alpha: .*|alpha: \"$MAGENTO_PATH\"|" $DOCKER_PROJECT_DIR/mutagen.yml
# Add domain to hosts
#sudo -- sh -c "echo '127.0.0.1 $MAGENTO_DOMAIN' >> /etc/hosts"
if [[ "" != "$GIT_CLONE_DEPTH" ]]; then
GIT_CLONE_DEPTH="--depth=${GIT_CLONE_DEPTH}"
fi
if [[ "yes" == "$RECLONE" ]]; then
cd $MAGENTO_PATH
for edition in $INSTALLED_REPOS; do
cd $MAGENTO_PATH
org=$(echo "GIT_ORG_${edition}" | sed "s|-|_|g")
repo=$(echo "GIT_REPO_${edition}" | sed "s|-|_|g")
branch=$(echo "GIT_BRANCH_${edition}" | sed "s|-|_|g")
github_repo="git@github.com:${!org}/${!repo}.git"
path=$edition
if [[ -d ./${edition} ]] || [[ -d "./magento2ce/${edition}" ]]; then
# repo exists, reset working tree and set correct branch
# continue
cd $MAGENTO_PATH/$edition
git clean -dfx -e '.idea' -e 'vendor' -e 'magento2*'
git reset --hard
git remote add ${!org} ${github_repo} || echo "."
if [ $? -eq 0 ]; then
git fetch ${!org}
fi
git checkout -B ${!branch} ${!org}/${!branch}
git pull
continue
fi
chmod g+s .
git clone ${GIT_CLONE_DEPTH} ${github_repo} ${path} -b ${!branch}
done
else
cd $MAGENTO_PATH/magento2ce
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1 && git checkout -- .
fi
# workaround to work with magento/magento2 && magento/partners-magento2ee repos
cd $MAGENTO_PATH
echo 'project initialized'