Skip to content

Commit

Permalink
add: #7 starship と Homebrew を自動でインストールするステップを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
KeitaSHIBUYA committed Feb 22, 2024
1 parent 90101c4 commit f8f9588
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions bin/mac_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/zsh

# starshipがインストールされているかチェック
if ! command -v starship &>/dev/null; then
echo "starship is not installed. Would you like to install it now? (y/n)"
while true; do
read -r answer
case $answer in
[Yy]* )
curl -sS https://starship.rs/install.sh | bash
echo 'eval "$(starship init zsh)"' >> ~/.zshrc
break;;
[Nn]* )
echo "starship installation skipped."
break;;
* )
echo "Please answer 'y' or 'n'.";;
esac
done
else
echo "starship is already installed."
fi

# Homebrewがインストールされているかチェック
if ! command -v brew &>/dev/null; then
echo "Homebrew is not installed. Would you like to install it now? (y/n)"
while true; do
read -r answer
case $answer in
[Yy]* )
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
break;;
[Nn]* )
echo "Homebrew installation skipped."
break;;
* )
echo "Please answer 'y' or 'n'.";;
esac
done
else
echo "Homebrew is already installed."
fi


## シンボリックリンクを作成
# dotfiles/ のパスを DOTFILES_DIR に代入
DOTFILES_DIR=`pwd`

echo "Starting to create symbolic links for dotfiles..."

# "."から始まるファイルをシンボリックリンク
# .DS_Store と .gitignore は除外
for file in $(find $DOTFILES_DIR -name ".*" -type f | grep -v -e "\.DS_Store$" -e "\.gitignore$"); do
ln -snf $file ~/
done

# iceberg.vimをシンボリックリンク
mkdir -p ~/.vim/colors || exit 1
ln -snf $DOTFILES_DIR/.vim/colors/iceberg.vim ~/.vim/colors/ || exit 1

# ~/.condfig/ に starship.toml をシンボリックリンク
mkdir -p ~/.config || exit 1
ln -snf $DOTFILES_DIR/.config/starship.toml ~/.config/ || exit 1

echo "Successfully created symbolic links for dotfiles."

0 comments on commit f8f9588

Please sign in to comment.