From f55fbf6677a1e1de5e18605255a9d7b42aa5f3ef Mon Sep 17 00:00:00 2001 From: xunmi-pc <寻觅> Date: Tue, 20 Feb 2024 19:24:56 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=AE=89=E8=A3=85.zsh=E8=B0=83=E7=94=A8=E6=9C=AA=E6=8C=89?= =?UTF-8?q?=E7=85=A7=E9=A2=84=E6=9C=9F=E8=BF=9B=E8=A1=8C=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98,=20=E4=BF=AE=E5=A4=8Dvim=E7=BB=84=E5=BB=BA=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E8=B7=AF=E5=BE=84=E5=86=B2=E7=AA=81=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- start.sh | 22 +++++++++++++--------- 公共/包管.zsh | 3 ++- 安装.zsh | 4 ++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/start.sh b/start.sh index dd6468f..f00a9ca 100755 --- a/start.sh +++ b/start.sh @@ -1,7 +1,7 @@ #!/usr/bin/bash # wget -qO- https://gitea.whlug.cn/xunmi/getLinux/raw/start.sh | bash -PACK_LIST=("wget" "git" "zsh") +PACK_LIST=("git" "zsh") # 脚本根地址 ROOT_URL="https://gitea.whlug.cn/xunmi/x/" # 插件和依赖安装的路径 @@ -64,15 +64,15 @@ Update_Package_Resource() { Show 0 "包管理器更新完毕" } -# 安装Zsh -Install_Zsh() { +# 安装依赖 +Install_PKG() { Update_Package_Resource for ((i = 0; i < ${#PACK_LIST[@]}; i++)); do pack=${PACK_LIST[i]} Show 2 "安装必要的依赖项: ${aCOLOUR[4]} $pack $COLOUR_RESET" GreyStart if [ -x "$(command -v oma)" ]; then - sudo oma -y install $pack + sudo oma install -y $pack elif [ -x "$(command -v apt)" ]; then sudo apt -y install $pack elif [ -x "$(command -v yum)" ]; then @@ -121,17 +121,21 @@ Download_X(){ } ################################################################# -# 主函数(main) # +# 主函数(main) # ################################################################# -Install_Zsh +([ -x "$(command -v git)" ] && [ -x "$(command -v zsh)" ]) || Install_PKG # 如果携带 -c 则不下载安装ohmyzsh [[ "$@" == *-c* ]] || Download_Config # 如果携带 -x 则不下载安装言灵 [[ "$@" == *-x* ]] || Download_X sudo chown -R $USER:$USER $x_dir -(( $X_START == 1 )) && zsh $x_dir/安装.zsh -exec zsh # 写入配置文件 mkdir -p $HOME/.config/xunmi -echo "寻觅=$ROOT_INSTALL" > $HOME/.config/xunmi/PATH.sh +echo "寻觅=${ROOT_INSTALL}" > $HOME/.config/xunmi/PATH.sh +if [ -f "安装.zsh" ]; then + zsh 安装.zsh +else + (( $X_START == 1 )) && zsh $x_dir/安装.zsh +fi +exec zsh diff --git a/公共/包管.zsh b/公共/包管.zsh index bed6f63..d50f8a3 100644 --- a/公共/包管.zsh +++ b/公共/包管.zsh @@ -30,8 +30,9 @@ # 调用当前包管理器的安装模块 包管_安装(){ + [ -x "$(command -v $1)" ] && return 0 if [ -x "$(command -v oma)" ]; then - sudo oma -y install $1 + sudo oma install -y $1 elif [ -x "$(command -v apt)" ]; then sudo apt -y install $1 elif [ -x "$(command -v yum)" ]; then diff --git a/安装.zsh b/安装.zsh index 59b8485..be1802b 100755 --- a/安装.zsh +++ b/安装.zsh @@ -97,9 +97,9 @@ readonly 系统_发行版_名称=$(echo "${NAME}") rm -vrf ${vim_配置路径} mkdir -vp ${vim_配置路径}/{opt,start} # 树状目录 - git clone --depth 1 https://gitcode.com/mirrors/scrooloose/nerdtree.git ${vim_配置路径}/start + git clone --depth 1 https://gitcode.com/mirrors/scrooloose/nerdtree.git ${vim_配置路径}/start/树状目录 # 代码检查工具 - git clone --depth 1 https://gitcode.com/mirrors/dense-analysis/ale.git ${vim_配置路径}/start + git clone --depth 1 https://gitcode.com/mirrors/dense-analysis/ale.git ${vim_配置路径}/start/代码检查工具 cp -v 配置/vimrc $HOME/.vimrc 色彩_清除 }