1
0

feat: implement modular numbered script system

- Add scripts/ directory with numbered execution pattern
- Create 00-check-dependencies.sh for requirement validation
- Create 10-backup-files.sh for conflict handling
- Create 20-setup-stow.sh for symlink creation
- Create 90-post-install.sh for cleanup tasks
- Add scripts/utils.sh with colored logging functions
- Update install.sh to auto-discover and execute numbered scripts
- Remove hardcoded logic in favor of flexible script discovery

Benefits:
- Clean separation of concerns (each script has one job)
- Numbered execution order (SSH/systemd convention)
- Colored output for better UX
- Easy to extend with additional scripts
- Same entry point for all branches
This commit is contained in:
2025-08-04 19:50:21 -05:00
parent 7fd2fd7317
commit 03150e539d
6 changed files with 227 additions and 31 deletions

36
scripts/utils.sh Normal file
View File

@@ -0,0 +1,36 @@
#!/bin/bash
# scripts/utils.sh - Shared utilities and functions
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Logging functions
log_info() {
echo -e "${BLUE} $1${NC}"
}
log_success() {
echo -e "${GREEN}$1${NC}"
}
log_warning() {
echo -e "${YELLOW}⚠️ $1${NC}"
}
log_error() {
echo -e "${RED}$1${NC}"
}
# Check if command exists
command_exists() {
command -v "$1" &> /dev/null
}
# Check if we're in an interactive shell
is_interactive() {
[[ $- == *i* ]]
}