-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall
executable file
·153 lines (130 loc) · 4.98 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
### $Id: install,v 1.1 2008-09-09 08:37:52 sfd Exp $
# install [OPTIONS] DEST
# install: A script to create the working version of the Matrix
# customization system.
# DEST: The destination directory of the install
# OPTIONS:
# -r: install remotely on homer.u.washington.edu
# -lkb: prepare the LKB files for TbG (only needs to be done once;
# if you want to refresh the files, delete the delphin directory)
# -iso: get the iso table file from iso that allows iso validation
#
# Examples:
# To install to a local directory:
# ./install path/to/dest/
# To install to a remote directory:
# ./install user@host:/path/to/dest/
# To install remotely on homer:
# ./install -r my_branch
# * Note that this is merely short for:
# ./install [email protected]:~/public_html/my_branch
# To install to www.delph-in.net/matrix:
# ./install -r matrix/customize
# To prepare the LKB files in an install to delph-in.net/matrix
# ./install -r -lkb matrix/customize
remote_py_path="#!\/usr\/local\/python-virt\/matrix\/bin\/python3"
lkb_url="http://lingo.ling.washington.edu/latest/lkb_linux.x86." #32|64.tgz
delphin_dir="${CUSTOMIZATIONROOT}/../delphin"
# check that Customization Root is defined
if [ -z $CUSTOMIZATIONROOT ]
then
echo "Please: export CUSTOMIZATIONROOT=<your gmcs file>"
exit 1
fi
# parse command line
echo "Please enter your patas username:"
read username
while [ "$1" = -r -o "$1" = -lkb -o "$1" = -iso ]
do
if [ "$1" = -r ]
then
dest_prefix="[email protected]:/home2/www-matrix/html/"
enable_captcha=1
#dest_prefix="[email protected]:~/public_html/"
elif [ "$1" = -iso ]
then
get_iso=1
elif [ "$1" = -lkb ]
then
install_lkb=1
if [ ! -d "$delphin_dir" ]
then
if [ -z $LOGONROOT ]
then
echo "Error: LOGONROOT not set. Exiting."
exit 1
fi
mkdir -p $delphin_dir/bin
mkdir -p $delphin_dir/lkb
pushd $delphin_dir/lkb
echo "\n\nDownloading LKB files. This could take a minute.\n\n"
wget -O - "${lkb_url}32.tgz" | tar -xzf -
wget -O - "${lkb_url}64.tgz" | tar -xzf -
popd
cp ${LOGONROOT}/lingo/lkb/etc/lkb $delphin_dir/bin/lkb
fi
fi
shift
done
if [ $# != 1 ]
then
echo "Usage: $0 [-r] <directory name>"
exit 1
fi
dest="${dest_prefix}$1"
# create temporary staging directory
tempdir=/tmp/matrix.$$
# the following will create the tempdir directory and fill it with
# with everything in the directories besides what's excluded.
rsync -a -o --exclude={CVS/,.svn/,delphin/,regression_tests/,tests/,sql_profiles/,gmmt/,lisp/,*.pyc,.*,*~,local_testing,Version.lsp,install,matrix.py,def_check.py,profiles.py,randgram.py,tdltest.py,pydelphin*} ${CUSTOMIZATIONROOT}/../ $tempdir
# create datestamp, matrix-types, and head-types files
date -u > $tempdir/datestamp
matrix_core=${CUSTOMIZATIONROOT}/../matrix-core/
cat $matrix_core/{matrix.tdl,head-types.tdl,labels.tdl} | grep '^[^;].*:=' | sed 's/ *:=.*//g' | sort | uniq > $tempdir/matrix-types
# Redirect directory index to cgi script (rather than index.html)
echo "DirectoryIndex matrix.cgi" >> $tempdir/.htaccess
# Don't allow directory browsing
echo "IndexIgnore */*" >> \
$tempdir/.htaccess
# Don't allow access to the saved choices. (Even with directory
# browsing turned off, somebody could guess the filename.)
mkdir $tempdir/saved-choices
echo "Option -Indexes" >> \
$tempdir/saved-choices/.htaccess
if [ $install_lkb ]
then
rsync -a --exclude=.svn/ $delphin_dir $tempdir --omit-dir-times
fi
if [ $get_iso ]
then
echo "Downloading iso code table file from sil.org."
echo ""
wget http://www.sil.org/iso639-3/iso-639-3_20120206.tab -O "$tempdir/iso.tab"
fi
# Set remote Pythondir
sed -i "1 s/^.*$/$remote_py_path/" $tempdir/matrix.cgi
if [ $enable_captcha ]
then
sed -i 's/^disable_captcha = True/disable_captcha = False/' $tempdir/matrix.cgi
fi
#Finally rsync the tempdir to the destination
#rsync -K maintain destination symlinks
# -v verbose
# -z compress before sending
# -r recursive
# -l copy symlinks as symlinks
# -t timestamps (may cause error messages during copy, but they
# are apparently necessary for web-tests)
rsync -Kvzrlt $tempdir/ $dest --omit-dir-times
# The following command will also delete files at the destination that
# do not exist in tempdir. Not using for now because an incorrect
# destination could delete more than expected. This means that files
# such as sample-choices deleted locally won't be deleted remotely unless
# you do it manually.
#rsync -az --delete $tempdir/ $dest
# fix permissions:
#echo "Fixing permissions (you will be prompted for your password once more)."
#ssh [email protected] 'sudo /home2/www-matrix/fixperm.sh'
# and clean up
rm -rf $tempdir