-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.user.sh
More file actions
executable file
·90 lines (69 loc) · 2.32 KB
/
setup.user.sh
File metadata and controls
executable file
·90 lines (69 loc) · 2.32 KB
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
#! /bin/sh
# Copyright [2018-2024] EMBL-European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Install an empty "WTSI Web VM" style user area
# and dependency libraries
# Takes environmental overrides
: ${WEBDIR:=/www}
: ${FOR_USER:=$USER}
: ${WEBVM:=intcvs1:/repos/git/anacode/webvm.git}
: ${WDEPS:=intcvs1:/repos/git/anacode/webvm-deps.git}
: ${HTTPD:=intcvs1:/repos/git/anacode/httpd.git}
: ${INSTALL_TO:=$WEBDIR/$FOR_USER/www-dev}
: ${STATEDIR:="$WEBDIR/tmp/$FOR_USER"}
# XXX:DUP from APACHECTL
APACHE2=/usr/sbin/apache2
if [ -e "$INSTALL_TO/.git" ]; then
echo "Abort: $INSTALL_TO/.git exists" >&2
exit 2
fi
if [ -d "$INSTALL_TO" ] && [ -w "$INSTALL_TO" ]; then
echo "$INSTALL_TO is ready to write"
else
echo "
Abort: cannot write into directory $INSTALL_TO
Please provide it (by running ./setup.root.sh) or
supply an alternative such as
INSTALL_TO=~/_httpd STATEDIR=/var/tmp/$USER.apache2/portnumber $0
" >&2
exit 3
fi
# We use STATEDIR for logs, pids and any other tmpfiles to ease
# webteam clone of a server - they exclude it and make a blank on on
# the target.
#
# Some files stored here insist on being on local disk.
mkdir -p -v "$STATEDIR/logs" || {
echo "Abort: canot mkdir $STATEDIR{,/logs}
You must make them on local storage
and configure via APACHECTL.sh
" >&2
exit 4
}
set -e
printf "\n** Apache config & bootstrap: %s\n nb. requires empty %s\n" \
"$WEBVM" "$INSTALL_TO"
git clone "$WEBVM" "$INSTALL_TO"
printf "\n** Large Perl libs: %s\n" "$WDEPS"
git clone "$WDEPS" "$INSTALL_TO/apps/webvm-deps"
if [ -x "$APACHE2" ]; then
echo "Found httpd at $APACHE2"
else
printf "\n** Fetch httpd (%s was not found)\n" "$APACHE2"
git clone "$HTTPD" "$INSTALL_TO/httpd"
echo "
You may need to branch the configuration to support this httpd
" >&2
fi
echo "Complete."