-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
87 lines (74 loc) · 1.74 KB
/
install.sh
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
#!/usr/bin/env bash
# Team:布利啾啾迪布利多,NKU
# coding by 徐云凯 1713667
# 一键部署脚本
if ! [ -x "$(command -v php)" ]; then
echo 'Error: php is not installed.' >&2
exit 1
fi
if ! [ -x "$(command -v mysql)" ]; then
echo 'Error: mysql is not installed.' >&2
exit 1
fi
if ! [ -x "$(command -v python3)" ]; then
echo 'Error: python3 is not installed.' >&2
exit 1
fi
if ! [ -x "$(command -v pip3)" ]; then
echo 'Error: pip3 is not installed.' >&2
exit 1
fi
user=root
read -p "Please input your MySQL user name:" name
if [ ! -n "$name" ] ;then
echo "Using the default user:root!"
else
user=$name
echo "Using the user $name"
fi
password=""
stty -echo
read -p "Please enter your MySQL password:" psd
stty echo
if [ ! -n "$psd" ] ;then
echo "Using the empty password."
else
password=$psd
fi
echo PHP INIT
php init
echo PROJECT CONFIGING
(
cat << EOF
<?php
return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=covid19',
'username' => '${user}',
'password' => '${password}',
'charset' => 'utf8mb4',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
],
],
];
EOF
) > ./common/config/main-local.php
echo Initiating database: covid19
php yii migrate
pip3 install pymysql
chmod +x /spider/spider.sh
# crontab -e
# service cron restart
if ! [ -x "$(command -v composer)" ]; then
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
fi
echo COMPOSER UPDATE
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
composer install -vvv
composer update -vvv