mirror of
https://github.com/SeriousBug/dotfiles
synced 2025-12-07 05:22:34 -06:00
Add --force-deploy and --skip-brew flags to setup script
Adds two new command-line flags to enhance setup script flexibility: - --force-deploy: Passes -f flag to dotter deploy for forced deployment - --skip-brew: Skips all Homebrew package installation steps 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
989fab7a18
commit
a40f25b734
152
setup.sh
152
setup.sh
|
|
@ -1,79 +1,101 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
set -eo pipefail
|
||||||
|
|
||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
RESET_CONFIG=false
|
RESET_CONFIG=false
|
||||||
if [[ "$1" == "--reset" ]]; then
|
FORCE_DEPLOY=false
|
||||||
RESET_CONFIG=true
|
SKIP_BREW=false
|
||||||
echo "Resetting configuration (will re-prompt for all variables)..."
|
|
||||||
fi
|
for arg in "$@"; do
|
||||||
|
case $arg in
|
||||||
|
--reset)
|
||||||
|
RESET_CONFIG=true
|
||||||
|
echo "Resetting configuration (will re-prompt for all variables)..."
|
||||||
|
;;
|
||||||
|
--force-deploy)
|
||||||
|
FORCE_DEPLOY=true
|
||||||
|
echo "Force deployment mode enabled..."
|
||||||
|
;;
|
||||||
|
--skip-brew)
|
||||||
|
SKIP_BREW=true
|
||||||
|
echo "Skipping Homebrew package installation..."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option: $arg"
|
||||||
|
echo "Usage: $0 [--reset] [--force-deploy] [--skip-brew]"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
echo "Setting up dotfiles environment..."
|
echo "Setting up dotfiles environment..."
|
||||||
|
|
||||||
# Detect OS
|
# Detect OS
|
||||||
OS="$(uname -s)"
|
OS="$(uname -s)"
|
||||||
|
|
||||||
# Check if Homebrew is installed
|
if [[ "$SKIP_BREW" == false ]]; then
|
||||||
if ! command -v brew &> /dev/null; then
|
# Check if Homebrew is installed
|
||||||
echo "Homebrew is not installed. Please install it first:"
|
if ! command -v brew &> /dev/null; then
|
||||||
echo "https://brew.sh"
|
echo "Homebrew is not installed. Please install it first:"
|
||||||
exit 1
|
echo "https://brew.sh"
|
||||||
fi
|
exit 1
|
||||||
|
|
||||||
echo "Updating Homebrew..."
|
|
||||||
brew update
|
|
||||||
|
|
||||||
# Install packages (available on both macOS and Linux)
|
|
||||||
PACKAGES=(
|
|
||||||
dotter
|
|
||||||
fish
|
|
||||||
dust
|
|
||||||
eza
|
|
||||||
gh
|
|
||||||
htop
|
|
||||||
go
|
|
||||||
jq
|
|
||||||
lazygit
|
|
||||||
neovim
|
|
||||||
asdf
|
|
||||||
bat
|
|
||||||
pandoc
|
|
||||||
ripgrep
|
|
||||||
zoxide
|
|
||||||
zellij
|
|
||||||
p7zip
|
|
||||||
)
|
|
||||||
|
|
||||||
echo "Installing packages..."
|
|
||||||
for package in "${PACKAGES[@]}"; do
|
|
||||||
if brew list "$package" &>/dev/null; then
|
|
||||||
echo "✓ $package already installed"
|
|
||||||
else
|
|
||||||
echo "Installing $package..."
|
|
||||||
brew install "$package"
|
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
# Install casks on macOS only
|
echo "Updating Homebrew..."
|
||||||
if [[ "$OS" == "Darwin" ]]; then
|
brew update
|
||||||
echo "Installing macOS-specific casks..."
|
|
||||||
|
|
||||||
CASKS=(
|
# Install packages (available on both macOS and Linux)
|
||||||
font-fira-code-nerd-font
|
PACKAGES=(
|
||||||
orbstack
|
dotter
|
||||||
|
fish
|
||||||
|
dust
|
||||||
|
eza
|
||||||
|
gh
|
||||||
|
htop
|
||||||
|
go
|
||||||
|
jq
|
||||||
|
lazygit
|
||||||
|
neovim
|
||||||
|
asdf
|
||||||
|
bat
|
||||||
|
pandoc
|
||||||
|
ripgrep
|
||||||
|
zoxide
|
||||||
|
zellij
|
||||||
|
p7zip
|
||||||
)
|
)
|
||||||
|
|
||||||
for cask in "${CASKS[@]}"; do
|
echo "Installing packages..."
|
||||||
if brew list --cask "$cask" &>/dev/null; then
|
for package in "${PACKAGES[@]}"; do
|
||||||
echo "✓ $cask already installed"
|
if brew list "$package" &>/dev/null; then
|
||||||
|
echo "✓ $package already installed"
|
||||||
else
|
else
|
||||||
echo "Installing $cask..."
|
echo "Installing $package..."
|
||||||
brew install --cask "$cask"
|
brew install "$package"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
|
||||||
echo "Skipping macOS-specific casks (not on macOS)"
|
# Install casks on macOS only
|
||||||
|
if [[ "$OS" == "Darwin" ]]; then
|
||||||
|
echo "Installing macOS-specific casks..."
|
||||||
|
|
||||||
|
CASKS=(
|
||||||
|
font-fira-code-nerd-font
|
||||||
|
orbstack
|
||||||
|
)
|
||||||
|
|
||||||
|
for cask in "${CASKS[@]}"; do
|
||||||
|
if brew list --cask "$cask" &>/dev/null; then
|
||||||
|
echo "✓ $cask already installed"
|
||||||
|
else
|
||||||
|
echo "Installing $cask..."
|
||||||
|
brew install --cask "$cask"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Skipping macOS-specific casks (not on macOS)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set up GitHub CLI authentication
|
# Set up GitHub CLI authentication
|
||||||
|
|
@ -153,10 +175,18 @@ EOF
|
||||||
# Deploy dotfiles
|
# Deploy dotfiles
|
||||||
echo ""
|
echo ""
|
||||||
echo "Deploying dotfiles..."
|
echo "Deploying dotfiles..."
|
||||||
if dotter deploy -v; then
|
if [[ "$FORCE_DEPLOY" == true ]]; then
|
||||||
echo "✓ Dotfiles deployed successfully!"
|
if dotter deploy -f -v; then
|
||||||
|
echo "✓ Dotfiles deployed successfully (forced)!"
|
||||||
|
else
|
||||||
|
echo "⚠ Dotter deployment failed."
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "⚠ Dotter deployment failed. You may need to run 'dotter deploy -f' to force deployment."
|
if dotter deploy -v; then
|
||||||
|
echo "✓ Dotfiles deployed successfully!"
|
||||||
|
else
|
||||||
|
echo "⚠ Dotter deployment failed. You may need to run 'dotter deploy -f' to force deployment."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
@ -164,6 +194,8 @@ echo "✓ Setup complete!"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Configuration saved to: $USER_VARS_FILE"
|
echo "Configuration saved to: $USER_VARS_FILE"
|
||||||
echo "To reconfigure, run: ./setup.sh --reset"
|
echo "To reconfigure, run: ./setup.sh --reset"
|
||||||
|
echo "To force deployment, run: ./setup.sh --force-deploy"
|
||||||
|
echo "To skip Homebrew packages, run: ./setup.sh --skip-brew"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Next steps:"
|
echo "Next steps:"
|
||||||
echo " 1. Consider setting fish as your default shell: chsh -s \$(which fish)"
|
echo " 1. Consider setting fish as your default shell: chsh -s \$(which fish)"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue