1 Star 0 Fork 0

侠客行/shareTempFile

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
install_plugin.py 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
侠客行 提交于 2023-04-01 08:54 . 11
#coding: utf-8
import sys,os
os.chdir("/www/server/panel/")
sys.path.append("/www/server/panel/class/")
import public
def install_sync(softnames):
softname = softnames.split(',')
for i in range(len(softname)):
download_url = public.get_url() + '/install/plugin/' + softname[i] + '/install.sh'
toFile = '/tmp/%s.sh' % softname[i]
public.downloadFile(download_url,toFile)
set_pyenv(toFile)
public.ExecShell('/bin/bash ' + toFile + ' install &> /tmp/panelShell.pl')
if os.path.exists('/www/server/panel/plugin/' + softname[i]):
public.WriteLog('TYPE_SETUP','PLUGIN_INSTALL_LIB',(softname[i],))
if os.path.exists(toFile): os.remove(toFile)
public.returnMsg(True," √ PLUGIN_INSTALL_SUCCESS: %s" % softname[i])
print(" √ Plugin_Install_Success: %s" % softname[i])
continue
public.returnMsg(False," × 【 %s 】 安装失败!" % softname[i])
def set_pyenv(filename):
if not os.path.exists(filename): return False
env_py = '/www/server/panel/pyenv/bin'
if not os.path.exists(env_py): return False
temp_file = public.readFile(filename)
env_path=['PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin']
rep_path=['PATH={}/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin'.format(env_py+":")]
for i in range(len(env_path)):
temp_file = temp_file.replace(env_path[i],rep_path[i])
public.writeFile(filename,temp_file)
return True
if __name__ == "__main__":
softnames = sys.argv[1]
install_sync(softnames)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tenglong666_admin/shareTempFile.git
[email protected]:tenglong666_admin/shareTempFile.git
tenglong666_admin
shareTempFile
shareTempFile
master

搜索帮助