forked from Vepchansky/project_installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·131 lines (125 loc) · 2.8 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
#!/bin/bash
spisok() {
n=1
if [ -e /opt/projects ]; then
if [[ $(ls /opt/projects) ]]; then
echo -en "\033[36m
--- Список установленных проектов ---
"
for var in $(ls /opt/projects); do
if [[ "$var" != "clear" ]] && [[ "$var" != "cre_prod" ]]; then
echo " ${n}. $var "
n=$(($n + 1))
fi
done
echo -en "
\033[0m
"
else
echo -en "\033[31m
Проекты не установлены.
\033[0m
"
fi
else
echo -en "\033[31m
Проекты не установлены.
\033[0m
"
fi
}
password() {
if [ -e /opt/projects -a -e /opt/projects/$1 ]; then
cd /opt/projects/$1
source bin/activate
cd $1
python manage.py createsuperuser
deactivate
cd $BASE_DIR
systemctl restart emperor.uwsgi.service
systemctl restart nginx.service
else
echo -en "\033[31m
Проекта $1 не существует
\033[0m
"
fi
}
BASE_DIR=$(pwd)
while true; do
cd $BASE_DIR
spisok
echo -en "
\033[33m
=======================================#
Выберите команду: #
#
1. Установить проект #
2. Удалить проект #
3. Поменять домен #
4. Установить пароль суперпользователя #
5. Установить SSL сертификат #
6. Добавть домен к проекту #
7. Удалить домен из проекта #
#
0. Выйти #
=======================================#
\033[0m
"
echo -en "\033[34m"
read -p " Введите номер выбранной команды: "
echo -en "\033[0m"
if [[ "$REPLY" =~ ^[0-7]$ ]]; then
if [[ "$REPLY" =~ 1 ]]; then
./firstscr
continue
fi
if [[ "$REPLY" == 2 ]]; then
spisok
./delete.sh
continue
fi
if [[ "$REPLY" == 3 ]]; then
./replace.sh $BASE_DIR
continue
fi
if [[ "$REPLY" == 4 ]]; then
read -p "Введите название проекта(для выхода 'n'): " proj
if [[ "$proj" != "n" ]]; then
password $proj
else
continue
fi
fi
if [[ "$REPLY" == 5 ]]; then
certbot --nginx
systemctl restart emperor.uwsgi.service
systemctl restart nginx.service
continue
fi
if [[ "$REPLY" == 6 ]]; then
./extend.sh $BASE_DIR
systemctl restart emperor.uwsgi.service
systemctl restart nginx.service
continue
fi
if [[ "$REPLY" == 7 ]]; then
./delete_domen.sh
systemctl restart emperor.uwsgi.service
systemctl restart nginx.service
continue
fi
if [[ "$REPLY" == 0 ]]; then
break
fi
else
echo -en "
\033[31mНеверный ввод.\033[0m
" >&2
continue
fi
done
echo -en "\033[31m
Программа закрыта
\033[0m
"