forked from nasa-gibs/worldview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwv-setup
executable file
·123 lines (108 loc) · 3.39 KB
/
wv-setup
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
#
# NASA Worldview
#
# This code was originally developed at NASA/Goddard Space Flight Center for
# the Earth Science Data and Information System (ESDIS) project.
#
# Copyright (C) 2013 - 2014 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
set -e
BASE_DIR=$(dirname "$0")
PROG=$(basename "$0")
usage() {
cat << EOF
Usage: $PROG [options]
Options:
-d Install apache configuration files and restart the web server
-h Prints this usage
-w Worldview EOSIS options
EOF
}
while getopts dhw flag; do
case "$flag" in
d)
DEVELOP=1
shift
;;
h)
usage
exit 0
;;
w)
WORLDVIEW=1
shift;
;;
?)
usage
exit 1
;;
esac
done
shift $(( OPTIND - 1 ));
cd "$BASE_DIR"
if [ ! -e /usr/local/bin/grunt ] ; then
echo "$PROG: ***** Installing a global version of grunt."
echo "You may be prompted for the root password to execute this command:"
echo " sudo npm install --global grunt-cli"
sudo npm install --global grunt-cli
echo "$PROG: ***** Clearing npm cache"
sudo rm -rf "${HOME}"/.npm/*
fi
if [ ! -d "$BASE_DIR/node_modules" ] ; then
echo "***** Installing node.js dependencies"
npm install
fi
if [ ! -e "/usr/local/bin/virtualenv" ] ; then
echo "$PROG: ***** Installing a global version of virtualenv"
echo "You may be prompted for the root password to execute this command:"
echo " sudo easy_install virtualenv==1.10.1"
sudo easy_install virtualenv==1.10.1
fi
if [ ! -d "$BASE_DIR/python" ] ; then
echo "$PROG: ***** Installing python dependencies"
"$BASE_DIR"/wv-python
fi
if [ ! -d "$BASE_DIR/options" ] ; then
echo "$PROG: ***** Fetching options"
if [ "$WORLDVIEW" ] ; then
git clone https://github.com/nasa-gibs/worldview-options-eosdis options
else
git clone https://github.com/nasa-gibs/worldview-options-template options
mkdir -p "$BASE_DIR/build"
git clone https://github.com/nasa-gibs/worldview-options-eosdis \
"$BASE_DIR/build/options-eosdis"
cp "$BASE_DIR/build/options-eosdis/config.json" "$BASE_DIR/options"
cp -r "$BASE_DIR/build/options-eosdis/config" "$BASE_DIR/options"
cp -r "$BASE_DIR/build/options-eosdis/colormaps" "$BASE_DIR/options"
fi
fi
if [ ! -d "$BASE_DIR/dist" ] ; then
echo "$PROG: ***** First time build"
grunt build
fi
if [ "$DEVELOP" ] ; then
echo "$PROG: ***** Creating apache configuration"
rm -f dist/*.httpd.conf
grunt apache-config
# OS X
if [ -d /etc/apache2/other ] ; then
echo "$PROG: ***** Installing configuration and restarting server"
echo "You may be prompted for the root password to execute these"
echo "commands:"
echo " sudo cp dist/*.httpd.conf /etc/apache2/other"
echo " sudo apachectl restart"
sudo cp dist/*.httpd.conf /etc/apache2/other
sudo apachectl restart
else
echo "This only works on OS X at the moment"
exit 1
fi
echo -e "\nApplication is now available at:\n"
grep Alias dist/*.httpd.conf | cut -f 2 -d" " | sed s_.*_http://localhost\&_g
echo
echo "Please check to make sure apache can access this directory"
echo
fi