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 色彩_清除 }