change(with 6be7003) 联动改变安装脚本

1. 为init.sh添加执行权限
2. 统一函数功能  修改其他需要改变权限的脚本或目录
pull/134/head
ibuler 2016-02-23 18:29:23 +08:00
parent 363bce82d8
commit dee1d31fc0
1 changed files with 11 additions and 9 deletions

View File

@ -41,9 +41,6 @@ class Setup(object):
version = urllib.urlopen('http://jumpserver.org/version/?id=%s' % mac) version = urllib.urlopen('http://jumpserver.org/version/?id=%s' % mac)
except: except:
pass pass
os.chdir(jms_dir)
os.chmod('logs', 0777)
os.chmod('keys', 0777)
def _input_admin(self): def _input_admin(self):
while True: while True:
@ -81,16 +78,21 @@ class Setup(object):
os.system('id %s &> /dev/null || useradd %s' % (self.admin_user, self.admin_user)) os.system('id %s &> /dev/null || useradd %s' % (self.admin_user, self.admin_user))
@staticmethod @staticmethod
def _cp_zzsh(): def _chmod_file():
os.chdir(os.path.join(jms_dir, 'install')) os.chdir(jms_dir)
shutil.copy('zzjumpserver.sh', '/etc/profile.d/') os.chmod('init.sh', 0755)
bash("sed -i 's#/opt/jumpserver#%s#g' /etc/profile.d/zzjumpserver.sh" % jms_dir) os.chmod('connect.py', 0755)
os.chmod('manage.py', 0755)
os.chmod('run_websocket.py', 0755)
os.chmod('service.sh', 0755)
os.chmod('logs', 0777)
os.chmod('keys', 0777)
@staticmethod @staticmethod
def _run_service(): def _run_service():
os.system('sh %s start' % os.path.join(jms_dir, 'service.sh')) os.system('sh %s start' % os.path.join(jms_dir, 'service.sh'))
print print
color_print('安装成功请访问web, 祝你使用愉快。\n请访问 https://github.com/ibuler/jumpserver 查看文档', 'green') color_print('安装成功请访问web, 祝你使用愉快。\n请访问 https://github.com/jumpserver/jumpserver 查看文档', 'green')
def start(self): def start(self):
print "开始安装Jumpserver, 要求环境为 CentOS 6.5 x86_64" print "开始安装Jumpserver, 要求环境为 CentOS 6.5 x86_64"
@ -98,7 +100,7 @@ class Setup(object):
self._sync_db() self._sync_db()
self._input_admin() self._input_admin()
self._create_admin() self._create_admin()
self._cp_zzsh() self._chmod_file()
self._run_service() self._run_service()