-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_server
64 lines (51 loc) · 1.6 KB
/
install_server
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
#!/bin/sh
#
#
# This is a hack to deal with the fact that I do not have root and
# therefore have to set up various environment variables before running
# the CGI.
#
# In a regular system, ssph_server and ssph_client would be installed
# in python site-packages (along with all the other python pre-reqs)
# and template.cgi would be installed without the shell script.
#
# DOCUMENTROOT is the only part you need to edit
DOCUMENTROOT=/var/www/html
# where various third party packages are installed
HERE=`pwd`/packages
# add to LD_LIBRARY_PATH before loading third party packages
LBRYPATH=`pwd`/lib
# which python we are using
PYTHON=`which python`
mkdir -p $DOCUMENTROOT/secure $DOCUMENTROOT/unsecured
# Note that /secure must run .cgi scripts
# /secure is protected by shibboleth authentication
sedme(){
rm -f $2
sed \
-e "s?PYTHON?$PYTHON?" \
-e "s?MODULE?$3?" \
< $1 > $2.py
# This is to hack around LD_LIBRARY_PATH; it doesn't work to
# change LD_LIBRARY_PATH after starting python.
# When the environment passed down from Apache has the right
# dynamic libraries available, you can just write the .py
# file directly into the .cgi
(
echo '#!/bin/sh'
echo "export PYTHONPATH=$HERE"
echo "export LD_LIBRARY_PATH=$LBRYPATH"
echo "exec python $2.py"
) > $2
chmod +x $2
}
r_sedme() {
rm -f $2
PYTHON=`which python`
sed -e "s/MODULE/$3/" \
-e "s?PYTHON?$PYTHON?" < $1 > $2
chmod +x $2
}
r_sedme template.cgi $DOCUMENTROOT/secure/ssph_auth.cgi ssph_auth
r_sedme template.cgi $DOCUMENTROOT/secure/ssph_admin.cgi admin
r_sedme template.cgi $DOCUMENTROOT/unsecured/ssph_confirm.cgi confirm