mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
refractor(macOS): Better setup script for macOS
This commit is contained in:
parent
1804960bfc
commit
cd7b6c70f0
14 changed files with 538 additions and 311 deletions
30
bootstrap/macOS/symlinks.zsh
Normal file
30
bootstrap/macOS/symlinks.zsh
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
set -e # Exit immediately if a command exits with a non-zero status
|
||||
|
||||
# 声明为关联数组
|
||||
typeset -A linkDots
|
||||
|
||||
# 从通用配置文件加载
|
||||
source "$DOTFILES/bootstrap/components/symlinks.sh"
|
||||
|
||||
echo "[INFO] DOTFILES = $DOTFILES"
|
||||
|
||||
echo "[ACTION] Press any key to proceed"
|
||||
read -n 1
|
||||
|
||||
echo "[INFO] Setting up symbolic links"
|
||||
# 使用 zsh 的关联数组语法
|
||||
for src in ${(k)linkDots}; do
|
||||
dest="${linkDots[$src]}"
|
||||
echo "Linking $src to $dest"
|
||||
# if [ -d "$src" ]; then
|
||||
# test -d $dest && mv $dest $dest.bak
|
||||
# mkdir -p $dest
|
||||
# ln -sf $src $dest
|
||||
# elif [ -f "$src" ]; then
|
||||
# dest_parent=$(dirname $dest)
|
||||
# test -d $dest_parent || mkdir -p $dest_parent
|
||||
# ln -sf $src $dest
|
||||
# else
|
||||
# echo "[ERROR] $src does not exist"
|
||||
# fi
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue