-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmnsl-pool.sh
More file actions
82 lines (76 loc) · 2.77 KB
/
Copy pathmnsl-pool.sh
File metadata and controls
82 lines (76 loc) · 2.77 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
#!/bin/bash
VENVDIR="$HOME/.local/share/mnsl-pool/venv"
clear
if [ $# = 0 ]; then
B="master"
else
B=$1
fi
echo "github branch to use : $B"
echo
echo creating commands
echo =================
if [ ! -f ~/.bash_aliases ]; then
touch ~/.bash_aliases
fi
if [ "$(type -t mnsl_venv)" != 'alias' ]; then
echo "alias mnsl_venv=\". ~/.local/share/mnsl-pool/venv/bin/activate\"" >> ~/.bash_aliases
fi
if [ "$(type -t mnsl_restart)" != 'alias' ]; then
echo "alias mnsl_restart=\"sudo systemctl restart mnsl-srv.service ; sudo systemctl restart mnsl-bg.service\"" >> ~/.bash_aliases
fi
if [ "$(type -t log_mnsl_srv)" != 'alias' ]; then
echo "alias log_mnsl_srv=\"journalctl -u mnsl-srv.service -ef\"" >> ~/.bash_aliases
fi
if [ "$(type -t log_mnsl_bg)" != 'alias' ]; then
echo "alias log_mnsl_bg=\"journalctl -u mnsl-bg.service -ef\"" >> ~/.bash_aliases
fi
if [ "$(type -t mnsl_install)" != 'function' ]; then
echo "function mnsl_install() { mnsl_venv && python -m pip install --upgrade git+https://github.com/Moustikitos/python-mainsail.git@\$1 ; deactivate ; }" >> ~/.bash_aliases
fi
if [ "$(type -t mnsl_deploy)" != 'function' ]; then
echo "function mnsl_deploy() { mnsl_venv && python -c \"from mnsl_pool import biom;biom.deploy()\" \$@ ; deactivate ; }" >> ~/.bash_aliases
fi
if [ "$(type -t add_pool)" != 'function' ]; then
echo "function add_pool() { mnsl_venv && python -c \"from mnsl_pool import biom;biom.add_pool()\" \$@ ; deactivate ; }" >> ~/.bash_aliases
fi
if [ "$(type -t set_pool)" != 'function' ]; then
echo "function set_pool() { mnsl_venv && python -c \"from mnsl_pool import biom;print(biom.set_pool())\" \$@ ; deactivate ; }" >> ~/.bash_aliases
fi
if [ "$(type -t dump_prk)" != 'function' ]; then
echo "function dump_prk() { mnsl_venv && python -c \"from mnsl_pool import biom;biom.dump_prk()\" ; deactivate ; }" >> ~/.bash_aliases
fi
echo "done"
echo
echo installing system dependencies
echo ==============================
sudo apt-get update -y
sudo apt-get -q install python3 python3-dev python3-setuptools python3-pip
sudo apt-get -q install libgmp3-dev
sudo apt-get -q install virtualenv
sudo apt-get -q install nginx
echo "done"
echo
echo creating virtual environment
echo ============================
if [ -d $VENVDIR ]; then
read -p "remove previous virtual environement ? [y/N]> " r
case $r in
y) rm -rf $VENVDIR;;
Y) rm -rf $VENVDIR;;
*) echo -e "previous virtual environement keeped";;
esac
fi
if [ ! -d $VENVDIR ]; then
mkdir $VENVDIR -p
virtualenv -p "$(which python3)" $VENVDIR
fi
echo "done"
echo
echo installing python dependencies
echo ==============================
. ~/.local/share/mnsl-pool/venv/bin/activate
python -m pip install "git+https://github.com/Moustikitos/python-mainsail.git@$B"
deactivate
echo "done"
. ~/.bashrc