From d02912b2775d3737f7f9118204f6dc371637b707 Mon Sep 17 00:00:00 2001 From: fishros Date: Sat, 5 Feb 2022 02:41:32 +0800 Subject: [PATCH] =?UTF-8?q?[docs]:=E6=B7=BB=E5=8A=A0README.md=20[code]:?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B7=E4=BE=8B=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 73 ++++++++++++++++++++++++++++++++++++++ fishros | 9 +++++ tools/tool_test_example.py | 3 ++ 3 files changed, 85 insertions(+) create mode 100644 README.md create mode 100644 fishros diff --git a/README.md b/README.md new file mode 100644 index 0000000..d192e47 --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +# 一键安装 + +## 工具列表 + +- +- +- +- + +## 使用方法 +``` +wget https://ghproxy.com/https://raw.githubusercontent.com/fishros/install/master/install -O fishros && . fishros +``` + + +## 贡献指南 + +如果想把自己的常用安装程序变成一键安装程序,可以遵循下面的贡献指南。 + +### 1.fork工程 + +fork工程到你的github,然后克隆工程到本地 + +### 2.新建文件 + +在本地的工程的tools目录下新建py文件 + +- 若是安装工具命名为:tool_install_xxx.py +- 若是配置工具为:tool_config_xxx.py + +### 3.编写程序 + +拷贝模板到你新建的文件: + +``` +# -*- coding: utf-8 -*- +from .base import BaseTool +from .base import PrintUtils,CmdTask,FileUtils,AptUtils,ChooseTask +from .base import osversion +from .base import run_tool_file + +class Tool(BaseTool): + def __init__(self): + self.type = BaseTool.TYPE_INSTALL + self.name = "模板工程" + self.autor = '小鱼' + + def run(self): + #正式的运行 + pass +``` + +接着修改type、name、autor + +在run函数中编写逻辑,可以提供给你的工具有: +1. PrintUtils 打印文字 +2. FileUtils 操作文件 +3. AptUtils 操作Apt +4. ChooseTask 选择选项 +5. CmdTask 运行命令行工具 +6. run_tool_file 运行其他工具(需要在install.py的tools中配置tools) + +信息: +1. osversion 系统相关信息 + + +## 贡献名单 + +- 一键安装ROS [小鱼](https://github.com/fishros) +- 一键安装github-deskto [小鱼](https://github.com/fishros) +- 一键配置rosdep [小鱼](https://github.com/fishros) +- 一键配置ros环境 [小鱼](https://github.com/fishros) +- 一键配置系统源 [小鱼](https://github.com/fishros) \ No newline at end of file diff --git a/fishros b/fishros new file mode 100644 index 0000000..3c45769 --- /dev/null +++ b/fishros @@ -0,0 +1,9 @@ +rm -rf /tmp/fishinstall/ +mkdir -p /tmp/fishinstall/tools +wget http://fishros.com/install/install1s/install.py -O /tmp/fishinstall/install.py 2>>/dev/null +source /etc/profile +if [ $UID -eq 0 ];then + apt-get install sudo +fi +sudo python3 /tmp/fishinstall/install.py +. ~/.bashrc \ No newline at end of file diff --git a/tools/tool_test_example.py b/tools/tool_test_example.py index 7a7f230..cd4d03f 100644 --- a/tools/tool_test_example.py +++ b/tools/tool_test_example.py @@ -1,5 +1,8 @@ # -*- coding: utf-8 -*- from .base import BaseTool +from .base import PrintUtils,CmdTask,FileUtils,AptUtils,ChooseTask +from .base import osversion +from .base import run_tool_file class Tool(BaseTool): def __init__(self):