From 041a5094810ffe046c0022f608e29c5e3e15320b Mon Sep 17 00:00:00 2001 From: whoami Date: Sat, 15 Feb 2025 21:14:34 +0000 Subject: [PATCH] =?UTF-8?q?=C2=A0fix(bootstrap):=20Fix=20macOS=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bootstrap/components/zsh.sh | 11 ++++++++--- bootstrap/macOS/main.zsh | 17 +++++++++++++---- bootstrap/macOS/symlinks.zsh | 22 +++++++++++----------- bootstrap/setup.sh | 2 ++ 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/bootstrap/components/zsh.sh b/bootstrap/components/zsh.sh index 793ab7c..a7e2511 100644 --- a/bootstrap/components/zsh.sh +++ b/bootstrap/components/zsh.sh @@ -1,14 +1,19 @@ echo "[INFO] ZDOTDIR = $ZDOTDIR" echo "[INFO] DOTFILES = $DOTFILES" -echo "[ACTION] Press any key to proceed" -read -n 1 -s -r +# echo "[ACTION] Press any key to proceed" +# read -n 1 -s -r echo "[INFO] Setting up system-wide zsh configuration" -echo "[ACTION] Elevation required!" +echo "[ACTION] Elevation required" test -f "/etc/zsh/zshenv" && sudo cp "$DOTFILES/tools/zsh/zshenv" "/etc/zsh/zshenv" test -f "/etc/zshenv" && sudo cp "$DOTFILES/tools/zsh/zshenv" "/etc/zshenv" + +if [ $(uname) = "Darwin" ]; then + sudo cp "$DOTFILES/tools/zsh/zshenv" "/etc/zshenv" +fi + echo "[INFO] Installing zsh plugins" test -d $ZDOTDIR/plugins/zsh-autosuggestions || git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git $ZDOTDIR/plugins/zsh-autosuggestions test -d $ZDOTDIR/plugins/zsh-syntax-highlighting || git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZDOTDIR/plugins/zsh-syntax-highlighting diff --git a/bootstrap/macOS/main.zsh b/bootstrap/macOS/main.zsh index 33590cb..3d842f5 100644 --- a/bootstrap/macOS/main.zsh +++ b/bootstrap/macOS/main.zsh @@ -14,7 +14,8 @@ echo "[ACTION] Request Human Takeover" xcode-select --install # Press any key to continue (if Xcode Command Line Tools are installed) -read -n 1 -s -r -p "Press any key to continue when xcode CLI tools are installed" +echo "[ACTION] Press any key to continue when xcode CLI tools are installed" +read -n 1 # System Preferences # Installation Sources @@ -29,7 +30,9 @@ echo "[INFO] Installing Homebrew" echo "[ACTION] Request Human Input" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -read -n 1 -s -r -p "Press any key to continue when xcode CLI tools are installed" + +echo "[ACTION] Press any key to continue when xcode CLI tools are installed" +read -n 1 echo "[INFO] Cloning Dotfiles" @@ -45,6 +48,10 @@ echo "[INFO] Installing Homebrew Packages" eval "$(/opt/homebrew/bin/brew shellenv)" brew bundle --file=$DOTFILES/bootstrap/macOS/Brewfile +# Setting up emacs +ln -s /usr/local/opt/emacs-mac/Emacs.app /Applications/Emacs.app + + # Setting Default Apps source $DOTFILES/bootstrap/macOS/duti.zsh @@ -62,10 +69,12 @@ source $DOTFILES/tools/zsh/zshrc echo "[INFO] Installing Rime" -git clone --depth 1 https://github.com/js0ny/Rime.git ~/Library/Rime +git clone --depth 1 https://github.com/js0ny/rime_wanxiang_pro.git ~/Library/Rime cd ~/Library/Rime -just set_remote +just init +# just install_rime +## Rime is installed via Brewfile just clone_plum echo "[INFO] Installing Doom Emacs" diff --git a/bootstrap/macOS/symlinks.zsh b/bootstrap/macOS/symlinks.zsh index 416d174..af80827 100644 --- a/bootstrap/macOS/symlinks.zsh +++ b/bootstrap/macOS/symlinks.zsh @@ -16,15 +16,15 @@ echo "[INFO] Setting up symbolic links" 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 + 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 diff --git a/bootstrap/setup.sh b/bootstrap/setup.sh index 0bbc212..e215743 100644 --- a/bootstrap/setup.sh +++ b/bootstrap/setup.sh @@ -15,8 +15,10 @@ export DOTFILES case "$(uname)" in Linux) : + ;; Darwin) curl https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/bootstrap/macOS/main.zsh -o ~/.local/.tmp/main.zsh zsh ~/.local/.tmp/main.zsh rm -rf ~/.local/.tmp/main.zsh + ;; esac