-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathinstall
More file actions
executable file
·122 lines (88 loc) · 3.04 KB
/
install
File metadata and controls
executable file
·122 lines (88 loc) · 3.04 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
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
#!/usr/bin/env bash
# This script installs fcatalog_server. The installation requires root
# privileges.
# Note that you have to run get_deps first.
# Stop on any error:
set -e
# Name of the new user to be added for use with the fcatalog server:
USER_NAME="ufcatalog"
# Virtualenv environment name:
ENV_NAME="${USER_NAME}_env"
# Python3 interpreter:
PYTHON=$(which python3)
# Make and make install catalog1.
cd catalog1
echo "Building libcatalog1:"
make
echo "Installing libcatalog1"
make install
# Refresh the linker cache:
sudo ldconfig
echo "Testing libcatalog1:"
./bin/test_catalog1
cd ..
##########################################
# Add a new system user:
##########################################
# See here:
# http://askubuntu.com/questions/29359/how-to-add-user-without-home
# Remove the user $USER_NAME together with his home directory:
set +e
userdel -rf $USER_NAME
set -e
useradd -s /bin/false -m -d /home/$USER_NAME $USER_NAME
# Create a directory for fcatalog databases:
mkdir -p /var/lib/fcatalog
# Make $USER_NAME the owner of the directory:
sudo chown -R $USER_NAME:$USER_NAME /var/lib/fcatalog
###########################################
# Create a virtualenv at /home/${USER_NAME}
###########################################
# Keep the current path (Main tree):
BASE_DIR=$PWD
cd dep/
# Get the name of the virtualenv tgz:
VENV_TGZ=""
for f in virtualenv*.tar.gz; do VENV_TGZ=$f; done
# Get the filename without the extension. This gives the expected name of the
# resulting directory:
VENV_DIR="${VENV_TGZ%*.tar.gz}"
cp $VENV_TGZ /home/${USER_NAME}/$VENV_TGZ
cd /home/${USER_NAME}
# Open VENV_TGZ:
tar xzf $VENV_TGZ
# Create an initial virtual env at the home of $USER_NAME
sudo -u ${USER_NAME} $PYTHON $VENV_DIR/virtualenv.py -p $PYTHON $ENV_NAME
# Go back to dep/
cd $BASE_DIR/dep
# Remove the virtualenv dir and tgz. They are not needed anymore:
rm -rf /home/${USER_NAME}/$VENV_DIR
rm -rf /home/${USER_NAME}/$VENV_TGZ
cd /home/${USER_NAME}
# Make a bin directory:
sudo -u ${USER_NAME} mkdir -p bin/
# Make a log directory:
sudo -u ${USER_NAME} mkdir -p log/
#######################################################
# Install all python dependencies inside the virtualenv
#######################################################
# Copy dependencies:
cp -R $BASE_DIR/dep /home/${USER_NAME}/dep
sudo chown -R $USER_NAME:$USER_NAME /home/${USER_NAME}/dep
echo "Installing python dependencies:"
# Installs all python dependencies:
sudo -H -u ${USER_NAME} $ENV_NAME/bin/pip install \
--no-index \
--find-links /home/${USER_NAME}/dep/packages \
fcatalog
# Dependencies and requirements.txt are no longer needed:
rm -rf /home/${USER_NAME}/dep
# install fcatalog python package.
echo "Copy server binary to /home/${USER_NAME}/bin/fcatalog_server"
cp -f ${BASE_DIR}/fcatalog_server /home/${USER_NAME}/bin/fcatalog_server
sudo chown -R $USER_NAME:$USER_NAME /home/${USER_NAME}/bin/fcatalog_server
# Copy assets/fcatalog.conf to /etc/init
cp -f ${BASE_DIR}/assets/fcatalog.conf /etc/init/fcatalog.conf
# Reload upstart configuration:
initctl reload-configuration
set +e