Improve bootstrap robustness and add safety checks
- Fix /tmp/yay conflict with rm -rf before clone - Use script directory instead of current directory - Add pipefail to error handling - Add command existence checks for mise/zoxide in .zshrc - Add HTTPS clone option in README
This commit is contained in:
@@ -5,8 +5,9 @@
|
|||||||
## 快速开始
|
## 快速开始
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. 克隆仓库
|
# 1. 克隆仓库(SSH 或 HTTPS)
|
||||||
git clone git@git-ssh.furtherverse.com:imbytecat/archlinux-wsl-init.git
|
git clone git@git-ssh.furtherverse.com:imbytecat/archlinux-wsl-init.git
|
||||||
|
# 或: git clone https://git-ssh.furtherverse.com/imbytecat/archlinux-wsl-init.git
|
||||||
cd archlinux-wsl-init
|
cd archlinux-wsl-init
|
||||||
|
|
||||||
# 2. 运行 bootstrap(安装 yay 和 dcli)
|
# 2. 运行 bootstrap(安装 yay 和 dcli)
|
||||||
|
|||||||
@@ -5,10 +5,14 @@ plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
|
|||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
# mise
|
# mise
|
||||||
eval "$(mise activate zsh)"
|
if command -v mise &> /dev/null; then
|
||||||
|
eval "$(mise activate zsh)"
|
||||||
|
fi
|
||||||
|
|
||||||
# zoxide
|
# zoxide
|
||||||
eval "$(zoxide init zsh)"
|
if command -v zoxide &> /dev/null; then
|
||||||
|
eval "$(zoxide init zsh)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Aliases
|
# Aliases
|
||||||
alias ls='ls --color=auto'
|
alias ls='ls --color=auto'
|
||||||
|
|||||||
+7
-6
@@ -1,14 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
echo "==> 安装 yay..."
|
echo "==> 安装 yay..."
|
||||||
if ! command -v yay &> /dev/null; then
|
if ! command -v yay &> /dev/null; then
|
||||||
sudo pacman -S --needed --noconfirm base-devel git
|
sudo pacman -S --needed --noconfirm base-devel git
|
||||||
cd /tmp
|
rm -rf /tmp/yay
|
||||||
git clone https://aur.archlinux.org/yay.git
|
git clone https://aur.archlinux.org/yay.git /tmp/yay
|
||||||
cd yay
|
cd /tmp/yay
|
||||||
makepkg -si --noconfirm
|
makepkg -si --noconfirm
|
||||||
cd ~
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==> 安装 dcli..."
|
echo "==> 安装 dcli..."
|
||||||
@@ -16,7 +17,7 @@ yay -S --needed --noconfirm dcli-arch-git
|
|||||||
|
|
||||||
echo "==> 复制配置..."
|
echo "==> 复制配置..."
|
||||||
mkdir -p ~/.config/arch-config
|
mkdir -p ~/.config/arch-config
|
||||||
cp -r ./arch-config/* ~/.config/arch-config/
|
cp -r "$SCRIPT_DIR/arch-config"/* ~/.config/arch-config/
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "✓ Bootstrap 完成!"
|
echo "✓ Bootstrap 完成!"
|
||||||
|
|||||||
Reference in New Issue
Block a user