mirror of
https://github.com/SeriousBug/dotfiles
synced 2025-12-07 13:32:30 -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
70
setup.sh
70
setup.sh
|
|
@ -1,31 +1,52 @@
|
||||||
#!/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
|
||||||
|
SKIP_BREW=false
|
||||||
|
|
||||||
|
for arg in "$@"; do
|
||||||
|
case $arg in
|
||||||
|
--reset)
|
||||||
RESET_CONFIG=true
|
RESET_CONFIG=true
|
||||||
echo "Resetting configuration (will re-prompt for all variables)..."
|
echo "Resetting configuration (will re-prompt for all variables)..."
|
||||||
fi
|
;;
|
||||||
|
--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
|
||||||
|
if ! command -v brew &> /dev/null; then
|
||||||
echo "Homebrew is not installed. Please install it first:"
|
echo "Homebrew is not installed. Please install it first:"
|
||||||
echo "https://brew.sh"
|
echo "https://brew.sh"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Updating Homebrew..."
|
echo "Updating Homebrew..."
|
||||||
brew update
|
brew update
|
||||||
|
|
||||||
# Install packages (available on both macOS and Linux)
|
# Install packages (available on both macOS and Linux)
|
||||||
PACKAGES=(
|
PACKAGES=(
|
||||||
dotter
|
dotter
|
||||||
fish
|
fish
|
||||||
dust
|
dust
|
||||||
|
|
@ -43,20 +64,20 @@ PACKAGES=(
|
||||||
zoxide
|
zoxide
|
||||||
zellij
|
zellij
|
||||||
p7zip
|
p7zip
|
||||||
)
|
)
|
||||||
|
|
||||||
echo "Installing packages..."
|
echo "Installing packages..."
|
||||||
for package in "${PACKAGES[@]}"; do
|
for package in "${PACKAGES[@]}"; do
|
||||||
if brew list "$package" &>/dev/null; then
|
if brew list "$package" &>/dev/null; then
|
||||||
echo "✓ $package already installed"
|
echo "✓ $package already installed"
|
||||||
else
|
else
|
||||||
echo "Installing $package..."
|
echo "Installing $package..."
|
||||||
brew install "$package"
|
brew install "$package"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Install casks on macOS only
|
# Install casks on macOS only
|
||||||
if [[ "$OS" == "Darwin" ]]; then
|
if [[ "$OS" == "Darwin" ]]; then
|
||||||
echo "Installing macOS-specific casks..."
|
echo "Installing macOS-specific casks..."
|
||||||
|
|
||||||
CASKS=(
|
CASKS=(
|
||||||
|
|
@ -72,8 +93,9 @@ if [[ "$OS" == "Darwin" ]]; then
|
||||||
brew install --cask "$cask"
|
brew install --cask "$cask"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "Skipping macOS-specific casks (not on macOS)"
|
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
|
||||||
|
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."
|
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