Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
e452c6d7
Commit
e452c6d7
authored
Dec 18, 2015
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix install bug
parent
12967bb6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
install.py
install/install.py
+63
-0
No files found.
install/install.py
0 → 100644
View file @
e452c6d7
#!/usr/bin/python
# coding: utf-8
import
subprocess
import
time
import
os
import
sys
def
bash
(
cmd
):
"""
run a bash shell command
执行bash命令
"""
return
subprocess
.
call
(
cmd
,
shell
=
True
)
def
color_print
(
msg
,
color
=
'red'
,
exits
=
False
):
"""
Print colorful string.
颜色打印字符或者退出
"""
color_msg
=
{
'blue'
:
'
\033
[1;36m
%
s
\033
[0m'
,
'green'
:
'
\033
[1;32m
%
s
\033
[0m'
,
'yellow'
:
'
\033
[1;33m
%
s
\033
[0m'
,
'red'
:
'
\033
[1;31m
%
s
\033
[0m'
,
'title'
:
'
\033
[30;42m
%
s
\033
[0m'
,
'info'
:
'
\033
[32m
%
s
\033
[0m'
}
msg
=
color_msg
.
get
(
color
,
'red'
)
%
msg
print
msg
if
exits
:
time
.
sleep
(
2
)
sys
.
exit
()
return
msg
class
PreSetup
(
object
):
@staticmethod
def
_rpm_repo
():
color_print
(
'开始安装epel源'
,
'green'
)
bash
(
'yum -y install epel-release'
)
@staticmethod
def
_depend_rpm
():
color_print
(
'开始安装依赖rpm包'
,
'green'
)
bash
(
'yum -y install git python-pip mysql-devel gcc automake autoconf python-devel vim sshpass'
)
@staticmethod
def
_require_pip
():
color_print
(
'开始安装依赖pip包'
,
'green'
)
bash
(
'pip install -r requirements.txt'
)
def
start
(
self
):
self
.
_rpm_repo
()
self
.
_depend_rpm
()
self
.
_require_pip
()
os
.
system
(
'python next.py'
)
if
__name__
==
'__main__'
:
pre_setup
=
PreSetup
()
pre_setup
.
start
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment