-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·58 lines (51 loc) · 1.35 KB
/
install.sh
File metadata and controls
executable file
·58 lines (51 loc) · 1.35 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
#!/bin/bash
set -e
function print_help {
echo ""
echo "You must choose exactly ony of the following options"
echo ""
echo "-c Copy files to remove server"
echo "-i Install python and dependencies on remote server"
echo ""
echo "$0 -i 10.0.0.1 user123"
echo "$0 -c 10.0.0.1 user123"
echo ""
}
if [[ $# -ne 3 ]]
then
print_help
exit 1
fi
set -eu
SERVER="$2"
USER="$3"
BASE="/mnt/data/tier1_stats/"
if [ "$1" == "-c" ]
then
echo "Copying files to server..."
ssh ${USER}@${SERVER} "mkdir -p ${BASE} && mkdir -p ${BASE}/scripts && mkdir -p ${BASE}/scripts/inc"
scp requirements_py310.txt ${USER}@${SERVER}:${BASE}
scp requirements_py311.txt ${USER}@${SERVER}:${BASE}
scp run.sh ${USER}@${SERVER}:${BASE}
scp scripts/*.py ${USER}@${SERVER}:${BASE}/scripts/
scp scripts/inc/*.py ${USER}@${SERVER}:${BASE}/scripts/inc/
echo "Done"
elif [ "$1" == "-i" ]
then
echo "Installing dependencies on server..."
ssh ${USER}@${SERVER} "
sudo apt-get install --no-install-recommends -y \
python3.11 \
python3.11-dev \
python3.11-venv \
build-essential \
libssl-dev \
libffi-dev
cd ${BASE}/
python3.11 -m venv --without-pip .venv
source .venv/bin/activate
python3.11 -m ensurepip
python3.11 -m pip install -r requirements_py311.txt
"
echo "Done"
fi