diff options
| author | Zhineng Li <[email protected]> | 2025-12-26 22:40:53 +0800 |
|---|---|---|
| committer | Zhineng Li <[email protected]> | 2025-12-26 22:40:53 +0800 |
| commit | 9ef40d414c354cbeb9c5f65b38bd39666888a67f (patch) | |
| tree | f9cd4a9072221b7eddb7f285d7a1cc23cab9d4d9 | |
| parent | 326cddca713324ae3b267c30c6044543e22a373d (diff) | |
setup script
| -rwxr-xr-x | setup.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..0c7a6c8 --- /dev/null +++ b/setup.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -e + +# Ensure the Command Line Tools for Xcode is installed +if ! xcode-select -p >/dev/null 2>&1; then + xcode-select --install +fi + +# Install package manager for macOS +if ! command -v brew >/dev/null 2>&1; then + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +fi + +basedir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +dotfiles="$HOME/.dotfiles" + +# Ensure the XDG user-specific configurations directory exists +mkdir -p "$HOME/.config" + +# Shortcut to dotfiles directory on home directory +if [ ! -e "$dotfiles" ]; then + ln -s "$basedir" "$dotfiles" +fi + +# Publish zsh configurations +if [ ! -e "$HOME/.zshrc" ]; then + ln -s "$dotfiles/.zshrc" "$HOME/.zshrc" +fi + +# Publish git configurations +if [ ! -e "$HOME/.config/git" ]; then + ln -s "$dotfiles/git" "$HOME/.config/git" +fi + +# Publish newsboat configurations +if [ ! -e "$HOME/.newsboat" ]; then + ln -s "$dotfiles/.newsboat" "$HOME/.newsboat" +fi |
