-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sh
85 lines (69 loc) · 1.92 KB
/
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
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
#!/bin/sh
# Script to build HotSauce 7.x-1.x
# Make sure the correct number of args was passed from the command line
if [ $# -eq 0 ]; then
echo "Usage $0 target_build_dir"
exit 1
fi
shift $((OPTIND-1))
MAKEFILE='build-hotsauce.make'
TARGET=$1
# Make sure we have a target directory
if [ -z "$TARGET" ]; then
echo "Usage $0 target_build_diri"
exit 2
fi
CALLPATH=`dirname "$0"`
ABS_CALLPATH=`cd "$CALLPATH"; pwd -P`
BASE_PATH=`cd ..; pwd`
echo "\nThis command can be used to build the distribution.\n"
echo " [1] Build distribution at $TARGET (in release mode)"
echo " [2] Build distribution at $TARGET (in development mode)\n"
echo "Selection: \c"
read SELECTION
if [ $SELECTION = "1" ]; then
echo "Building HotSauce! distribution..."
DRUSH_OPTS='--no-cache'
elif [ $SELECTION = "2" ]; then
echo "Building HotSauce! distrbution..."
DRUSH_OPTS='--working-copy --no-gitinfofile --no-cache'
else
echo "Invalid selection."
exit 0
fi
# Temp move settings
if [ -f "$TARGET/sites/default/settings.php" ]; then
echo "\nBacking up settings.php..."
mv "$TARGET/sites/default/settings.php" settings.php
fi
# Verify the make file
set -e
echo 'Verifying make...'
drush verify-makefile
# Remove current drupal dir
echo 'Wiping Drupal directory...'
rm -rf "$TARGET"
# Do the build
echo 'Running drush make...'
drush make $DRUSH_OPTS "$ABS_CALLPATH/$MAKEFILE" "$TARGET"
set +e
# Build Symlinks
echo 'Setting up symlinks...'
DRUPAL=`cd "$TARGET"; pwd -P`
ln -s /opt/files/hotsauce "$DRUPAL/sites/default/files"
# Update existing distribution.
if [ -f "$BASE_PATH/settings.php" ]; then
# Restore settings
echo 'Restoring settings...'
ln -s "$BASE_PATH/settings.php" "$DRUPAL/sites/default/settings.php"
# Clear caches and Run updates
cd "$DRUPAL"
echo 'Clearing caches...'
drush cc all;
echo 'Running updates...'
drush updb -y;
echo 'Reverting all features...'
drush fra -y;
drush cc all;
echo 'Build complete.'
fi