-
Notifications
You must be signed in to change notification settings - Fork 4
/
sh.php
100 lines (76 loc) · 1.49 KB
/
sh.php
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
<?php
/**
* 脚本版本(SQL)
*/
$mSQL = <<<EOL
_ _ _ ____ ___ _
| | | (_) _ __ ___ / ___| / _ \| |
| |_| | | | '_ ` _ \\___ \| | | | |
| _ | | | | | | | |___) | |_| | |___
|_| |_|_| |_| |_| |_|____/ \__\_\_____|
@Author : Luck Li Di
@Email : lucklidi@126.com
@version: v1.0.0
EOL;
$start = <<<EOL
_ _ _ _ _
| | | (_) _ __ ___ __ _ ___| |_ ___ _ __ | |
| |_| | | | '_ ` _ \ / _` / __| __/ _ \ '__| | |
| _ | | | | | | | | (_| \__ \ || __/ | |_|
|_| |_|_| |_| |_| |_|\__,_|___/\__\___|_| (_)
EOL;
/**
* 初始化
*/
echo $mSQL;
/**
* 执行授权
*/
$pwd = `pwd`;
$pwd = trim($pwd);
$soarPath = $pwd . '/luck/soar';
`chmod a+x {$soarPath}`;
/**
* 全局软链
*/
`ln -sf {$soarPath} /usr/bin/soar`;
/**
* 设置配置文件
*/
$configPath = $pwd . '/luck/soar.yaml';
`cp {$configPath} /etc/soar.yaml`;
/**
* 安装成功
* alias mysql
* @Author: Luck Li Di
* @Email : lucklidi@126.com
*/
$msqlPath = $pwd . '/luck/msql.php';
`echo "alias msql='php {$msqlPath}'" >> /root/.bashrc`;
/**
* 启动
*/
usleep(500);
echo $start . PHP_EOL;
/**
* 全局生效
*/
`source ~/.bashrc`;
sleep(1);
/**
* 执行帮助
*/
$help = `msql -h 2>&1`;
$help = trim($help);
if (substr($help,-5) == 'found') {
$notice = <<<eol
------------------------------
|Please Run 'source ~/.bashrc'
|And Run 'msql -h'
---------------------
Then, you can
use it!
eol;
exit($notice);
}
echo $help;