-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
94 lines (77 loc) · 2.7 KB
/
install
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
87
88
89
90
91
92
93
94
#!/bin/bash
set -e
source /etc/environment
source $CONVEYOR_CORE/src/lib/conveyor-libs.sh
CONVEYOR_DATA="$HOME/data"
MINIFY_GITHUB_REF="mrclay/minify"
MINIFY_REV="2.1.7"
MINIFY_SHA256="1a1567vpbjb8q71pxsr4kpnw1qvi9p7i61pky8mp4m27z4hh6h4r"
MINIFY_APP_HOME="${CONVEYOR_DATA}/apps/DogFoodSoftware/minify"
GITHUB_REF="DogFoodSoftware/conveyor-minify"
CONVEYOR_MINIFY_REV="master"
PROJECT_HOME="${PLAYGROUND}/${GITHUB_REF}"
function usage() {
echo "Installs minify for a Conveyor environment. May also work"
echo "with standard Ubuntu environments with Nginx installed when"
echo "run as 'root'."
echo
echo "install [-p <dir>] [-m <git rev>]"
echo
echo "Options:"
echo
echo "--minify-rev|-m <git rev>"
echo " Overrides default minify version to checkout."
}
TMP=`getopt --name=$0 -a --longoptions=minify-rev -o m -- $@`
eval set -- $TMP
until [ $1 == -- ]; do
case "$1" in
-m|--minify-rev)
MINIFY_REV="$2"
shift;;
esac
shift
done
shift
# In case this is NOT a conveyor enviorment, we need to create some
# dirs for this stuff to live in.
for i in "$PLAYGROUND" \
"$CONVEYOR_DATA/apps"; do
if [ ! -d "$i" ]; then
mkdir -p "$i"
fi
done
# Now grab the actual minify app
cd "$CONVEYOR_DATA/apps/"
if [ ! -d DogFoodSoftware ]; then
mkdir DogFoodSoftware
fi
cd DogFoodSoftware
git clone --branch $MINIFY_REV --depth 1 https://github.com/${MINIFY_GITHUB_REF}.git minify
cd "$PLAYGROUND"
# We checkout via HTTPS in case the 'ssh-agent' isn't available when
# the script is run; such as when the script is run with an alternate
# user using 'sudo'.
git clone -b $CONVEYOR_MINIFY_REV --depth 1 https://github.com/${GITHUB_REF}.git $GITHUB_REF
# But then swtich to SSH for easy updates for those with authorized keys.
cd "$GITHUB_REF"
git remote set-url origin [email protected]:${GITHUB_REF}.git
for i in `ls ${PROJECT_HOME}/conf/service-*.nginx.conf`; do
if [ -L /etc/nginx/services/`basename $i` ]; then
rm /etc/nginx/services/`basename $i`
elif [ -f /etc/nginx/services/`basename $i` ]; then
echo "Found probable manual update of '/etc/nginx/services/`basename $i`'; leaving in place." >&2
echo "Consider removing and running:" >&2
echo -e "\tln -s "$i" /etc/nginx/services" >&2
else
ln -s "$i" /etc/nginx/services
fi
done
for i in `ls "${PROJECT_HOME}/src"`; do
chmod u+w "${MINIFY_APP_HOME}/min/$i"
cp "${PROJECT_HOME}/src/$i" "${MINIFY_APP_HOME}/min"
chmod u-w "${MINIFY_APP_HOME}/min/$i"
done
mkdir -p ${MINIFY_APP_HOME}/cache;
con_doc_link $PROJECT_HOME/documentation /DogFoodSoftware.conveyor-minify
ln -s $PLAYGROUND/DogFoodSoftware/conveyor-minify $DOCUMENTATION_HOME/DogFoodSoftware.conveyor-minify/src