forked from nimbusproject/nimbus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall
executable file
·143 lines (115 loc) · 4.11 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
#!/bin/bash
FORCE_FRESH_INSTALL="yes"
START_DIR=`pwd`
NIMBUS_SRC_REL="`dirname $0`"
NIMBUS_SRC=`cd $NIMBUS_SRC_REL; pwd`
if [ "X$1" = "X" ]; then
echo ""
echo "Usage: $0 destination_dir"
echo " You must specify the destination directory."
echo ""
exit 1
fi
NIMBUS_REL_BASE_HOME="`dirname $1`"
NIMBUS_BASE_HOME=`cd $NIMBUS_REL_BASE_HOME; pwd`
if [ ! -e $NIMBUS_REL_BASE_HOME ]; then
echo "The parent directory for the installation path $1 must exist"
exit 1
fi
NIMBUS_INST_DIR=`basename $1`
NIMBUS_HOME="$NIMBUS_BASE_HOME/$NIMBUS_INST_DIR"
echo "NIMBUS_HOME $NIMBUS_HOME"
if [ "X$NIMBUS_ALLOW_ROOT_INSTALL" != "Xyes" ] && [ $EUID -eq 0 ]; then
echo ""
echo "It is not recommended to install or run Nimbus as root."
echo "If you insist, set the NIMBUS_ALLOW_ROOT_INSTALL environment variable to \"yes\""
echo ""
exit 1
fi
if [ -d $NIMBUS_HOME ] && [ "$(ls -A $NIMBUS_HOME)" ]; then
if [ $FORCE_FRESH_INSTALL = "yes" ]; then
echo ""
echo "The destination directory '$NIMBUS_HOME' exists and is not empty."
echo "It is not recommended to reinstall Nimbus into an existing install."
echo ""
echo "If you are making changes to the services, you can build and install those directly:"
echo " export GLOBUS_LOCATION=$NIMBUS_HOME/services"
echo " scripts/all-build-and-install.sh"
echo ""
echo "If you know what you are doing and want to reinstall, edit this script:"
echo " $0"
echo "and change FORCE_FRESH_INSTALL to \"no\""
echo ""
exit 1
fi
fi
if [ ! -d $NIMBUS_HOME ]; then
mkdir $NIMBUS_HOME
fi
# If the dir exists but is not writable, this will also trip that situation early/gracefully.
touch $NIMBUS_HOME/install.log
if [ $? -ne 0 ]; then
echo "ERROR: cannot write install log file: $NIMBUS_HOME/install.log"
exit 1
fi
# The install log contains the initial cumulus admin secrets
chmod 600 $NIMBUS_HOME/install.log
if [ $? -ne 0 ]; then
echo "ERROR: cannot chmod install log file: $NIMBUS_HOME/install.log"
exit 1
fi
if [ "X$PYTHON" = "X" ]; then
PYTHON_EXE=`which python`
else
PYTHON_EXE="$PYTHON"
fi
# returns 0 if Python 2.5+
$PYTHON_EXE -c "import sys; sys.exit(sys.version_info < (2,5))"
if [ $? -ne 0 ]; then
echo "ERROR: The central Nimbus node must have Python version 2.5 or later (VMM nodes can have 2.4+)."
exit 1
fi
echo ""
echo "-----------------------------------------------------------------" | tee -a $NIMBUS_HOME/install.log
echo "Making the Python virtual environment" | tee -a $NIMBUS_HOME/install.log
echo "-----------------------------------------------------------------" | tee -a $NIMBUS_HOME/install.log
echo ""
pyve_path=$NIMBUS_HOME/ve
echo "Installing from $NIMBUS_SRC"
cp $NIMBUS_SRC/cumulus/*.egg .
$PYTHON_EXE $NIMBUS_SRC/cumulus/virtualenv.py -p $PYTHON_EXE $pyve_path | tee -a $NIMBUS_HOME/install.log
if [ $PIPESTATUS -ne 0 ]; then
echo "ERROR: python virtualenv installation failed."
exit 1
fi
$NIMBUS_SRC/libexec/create-nimbus-home $NIMBUS_HOME 2>&1 | tee -a $NIMBUS_HOME/install.log
# need PIPESTATUS because tee is not the exit code this needs to check
if [ $PIPESTATUS -ne 0 ]; then
echo ""
exit 1
fi
CUMULUS_ENV="$NIMBUS_HOME/cumulus/env.sh"
if [ ! -f $CUMULUS_ENV ]; then
echo "Expected file to be created: $CUMULUS_ENV"
exit 1
fi
echo ""
echo "-----------------------------------------------------------------"
echo " Configuring installed services"
echo "-----------------------------------------------------------------"
CONFIG_SCRIPT="$NIMBUS_HOME/bin/nimbus-configure"
if [ ! -f $CONFIG_SCRIPT ]; then
echo "Configuration script could not be found: $CONFIG_SCRIPT"
exit 1
fi
$CONFIG_SCRIPT
if [ $? -ne 0 ]; then
echo "Nimbus configuration script failed! You may try running it manually:"
echo " $CONFIG_SCRIPT"
echo "You can also run the script with debugging output:"
echo " $CONFIG_SCRIPT --debug"
exit 1
fi
$NIMBUS_SRC/libexec/install-real.sh "${@}" 2>&1 | tee -a $NIMBUS_HOME/install.log
# need PIPESTATUS because tee is not the exit code of interest
exit $PIPESTATUS