forked from zivtech/bear
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.probo-profile-build.sh
executable file
·44 lines (37 loc) · 1.31 KB
/
.probo-profile-build.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
#!/bin/bash
# This script is to be used with Probo CI (http://probo.ci/) and the development process of the Bear install profile.
# It is meant to enable building Bear from a git branch
PROFILE_NAME='bear'
MAKE_FILE=''
SRC_DIR='/src'
DESTINATION='/var/www/html'
function checkMakeFile() {
# Matches the following:
# projects[bear]
# projects[] = 'bear'
# projects[] = "bear"
# projects[] = bear
# projects[]=bear
if grep "\[$PROFILE_NAME\]" $1 > /dev/null || grep "['\"]\?$PROFILE_NAME['\"]\?$" $1 > /dev/null; then
echo 'Error: Project should not be listed in make file.' >&2
exit 1
fi
return
}
if [ "$SRC_DIR/$MAKE_FILE" != '' ] && [ -f "$SRC_DIR/$MAKE_FILE" ]; then
checkMakeFile "$SRC_DIR/$MAKE_FILE"
drush make "$SRC_DIR/$MAKE_FILE" $DESTINATION
elif [ -f "$SRC_DIR/drupal-org-core.make" ] && [ -f "$SRC_DIR/drupal-org.make" ]; then
checkMakeFile "$SRC_DIR/drupal-org-core.make"
checkMakeFile "$SRC_DIR/drupal-org.make"
drush make "$SRC_DIR/drupal-org-core.make" $DESTINATION
cd $SRC_DIR
drush make "drupal-org.make" --contrib-destination=. --no-core . -y
cd -
fi
if [ ! -d "$DESTINATION/profiles/$PROFILE_NAME" ]; then
cp -r $SRC_DIR "$DESTINATION/profiles/$PROFILE_NAME"
else
echo 'Error: Unable to copy profile to destination because it already exists.' >&2
exit 1
fi