-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontrol-panel
executable file
·53 lines (43 loc) · 1.44 KB
/
control-panel
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
#!/bin/bash
if [ ! $# -eq 0 ]; then
case "$1" in
--docker | -d)
echo -e "\n### BUILDING DOCKER ENV ###\n"
docker build -t control-panel .
echo -e "\n### REMOVING DANGLING IMAGES ###\n"
docker rmi --force $(docker images -f "dangling=true" -q)
echo -e "\n### REMOVING EXITED CONTAINERS S##\n"
docker rm $(docker ps -a -f status=exited -f status=created -q)
echo -e "\n### RUNNING IMAGE ###\n"
docker run -it control-panel
;;
*)
echo -e "\n[ERR]: Flag not recognized\n";;
esac
else
installdir="/home/$USER/bin/hackerspace-scripts-2"
FILE="/home/$USER/.profile"
localdir="$(pwd)"
string="export PATH=\$PATH:$localdir/"
cd $installdir
echo -e "\n### UPDATING ###\n"
git pull
if grep -q "$string" $FILE; then
echo "Already installed"
else
echo -e "\n### INSTALLING COMMAND ###\n"
echo -e "export PATH=\$PATH:$localdir/" >> $FILE
echo "Next time you can log out then back in to use 'control-panel' anywhere from the command line.\n"
fi
if ! test -f "$installdir/env/bin/activate"; then
echo -e "\n### INSTALLING PYTHON ENVIRONMENT ###\n"
python3 -m venv $installdir/env
fi
source $installdir/env/bin/activate
echo -e "\n### UPDATING PYTHON ENVIRONMENT ###\n"
pip install -r requirements.txt
echo -e "\n### CHECKING INSTALLED PACAKGES ###\n"
python $installdir/bootstrap.py
echo -e "\n### RUNNING CONTROL PANEL ###\n"
python $installdir/controlpanel.py
fi