From 8e1b3e0c6a71423f841d6c704068a33167756338 Mon Sep 17 00:00:00 2001 From: fishros Date: Tue, 8 Feb 2022 04:58:19 -0800 Subject: [PATCH] [feat]:Finished Install Vscode --- README.md | 5 +++-- install.py | 1 + tools/tool_install_vscode.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 tools/tool_install_vscode.py diff --git a/README.md b/README.md index 87e8286..3cd2ad2 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ 已支持工具列表: - 一键安装:ROS(支持ROS和ROS2,树莓派Jetson) [贡献@小鱼](https://github.com/fishros) +- 一键安装:VsCode(支持amd64和arm64) [贡献@小鱼](https://github.com/fishros) - 一键安装:github桌面版(小鱼常用的github客户端) [贡献@小鱼](https://github.com/fishros) - 一键安装:nodejs开发环境(通过nodejs可以预览小鱼官网噢 [贡献@小鱼](https://github.com/fishros) - 一键配置:rosdep(小鱼的rosdepc,又快又好用) [贡献@小鱼](https://github.com/fishros) @@ -13,7 +14,6 @@ 可以参考的待添加工具: -- 一键安装:VsCode - 一键安装:Docker - 一键安装:cartographer @@ -87,4 +87,5 @@ class Tool(BaseTool): - 一键配置rosdep [小鱼](https://github.com/fishros) - 一键配置ros环境 [小鱼](https://github.com/fishros) - 一键配置系统源 [小鱼](https://github.com/fishros) -- 一键安装nodejs [小鱼](https://github.com/fishros) \ No newline at end of file +- 一键安装nodejs [小鱼](https://github.com/fishros) +- 一键安装vscode [小鱼](https://github.com/fishros) \ No newline at end of file diff --git a/install.py b/install.py index 626dec0..2ed3131 100644 --- a/install.py +++ b/install.py @@ -12,6 +12,7 @@ 4: {'tip':'一键配置:ROS环境(快速更新ROS环境设置,自动生成环境选择)', 'type':2, 'tool':url_prefix+'tools/tool_config_rosenv.py' ,'dep':[] }, 5: {'tip':'一键配置:系统源(更换系统源,支持全版本Ubuntu系统)', 'type':2, 'tool':url_prefix+'tools/tool_config_system_source.py' ,'dep':[] }, 6: {'tip':'一键安装:nodejs开发环境(通过nodejs可以预览小鱼官网噢)', 'type':0, 'tool':url_prefix+'tools/tool_install_nodejs.py' ,'dep':[] }, + 7: {'tip':'一键安装:VsCode', 'type':0, 'tool':url_prefix+'tools/tool_install_vscode.py' ,'dep':[] }, 77: {'tip':'测试模式:运行自定义工具测试'}, } diff --git a/tools/tool_install_vscode.py b/tools/tool_install_vscode.py new file mode 100644 index 0000000..dc7ed59 --- /dev/null +++ b/tools/tool_install_vscode.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from .base import BaseTool +from .base import PrintUtils,CmdTask,FileUtils,AptUtils,ChooseTask +from .base import osversion,osarch +from .base import run_tool_file + +class Tool(BaseTool): + def __init__(self): + self.name = "Quick-Install:Vscode" + self.type = BaseTool.TYPE_INSTALL + self.autor = '小鱼' + + def install_vscode(self): + PrintUtils.print_info("开始根据系统架构,为你下载对应版本的vscode~") + # 根据系统架构下载不同版本的安装包 + if osarch=='amd64': + CmdTask('sudo wget http://vscode.cdn.azure.cn/stable/5554b12acf27056905806867f251c859323ff7e9/code_1.64.0-1643863948_amd64.deb -O /tmp/vscode.deb',os_command=True).run() + elif osarch=='arm64': + CmdTask('sudo wget http://vscode.cdn.azure.cn/stable/5554b12acf27056905806867f251c859323ff7e9/code_1.64.0-1643862176_arm64.deb -O /tmp/vscode.deb',os_command=True).run() + else: + return False + PrintUtils.print_info("下载完成,接下来为你安装Vscode~") + CmdTask("sudo dpkg -i /tmp/vscode.deb").run() + CmdTask("rm -rf /tmp/vscode.deb").run() + PrintUtils.print_info("安装完成~") + + def run(self): + self.install_vscode() +