Centralized dotfiles.conf, revamped stuff.

This commit is contained in:
Aaron D. Lee
2025-12-14 15:51:49 -05:00
parent fece4e7d3e
commit 5a82f9046b
8 changed files with 505 additions and 506 deletions

View File

@@ -6,7 +6,29 @@
set -e
DOTFILES_DIR="$HOME/.dotfiles"
# ============================================================================
# Load Configuration
# ============================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DOTFILES_CONF="${SCRIPT_DIR}/../dotfiles.conf"
[[ -f "$DOTFILES_CONF" ]] || DOTFILES_CONF="$HOME/.dotfiles/dotfiles.conf"
if [[ -f "$DOTFILES_CONF" ]]; then
source "$DOTFILES_CONF"
else
# Fallback defaults
DOTFILES_DIR="$HOME/.dotfiles"
DOTFILES_BRANCH="main"
DOTFILES_GITHUB_USER="adlee-was-taken"
DOTFILES_REPO_NAME="dotfiles"
DOTFILES_RAW_URL="https://raw.githubusercontent.com/${DOTFILES_GITHUB_USER}/${DOTFILES_REPO_NAME}/${DOTFILES_BRANCH}"
fi
# ============================================================================
# Colors
# ============================================================================
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
@@ -24,22 +46,25 @@ print_error() {
echo -e "${RED}${NC} $1"
}
# ============================================================================
# Main
# ============================================================================
if [ ! -d "$DOTFILES_DIR" ]; then
print_error "Dotfiles directory not found: $DOTFILES_DIR"
echo "Run the installation script first:"
echo " curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/dotfiles/main/install.sh | bash"
echo " curl -fsSL ${DOTFILES_RAW_URL}/install.sh | bash"
exit 1
fi
cd "$DOTFILES_DIR"
echo "Updating dotfiles from repository..."
git pull origin main
git pull origin "$DOTFILES_BRANCH"
if [ $? -eq 0 ]; then
print_success "Dotfiles updated successfully"
# Check if install script exists and run it
if [ -f "$DOTFILES_DIR/install.sh" ]; then
echo
read -p "Run install script to update links? [Y/n]: " response