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:
36
scripts/utils.sh
Normal file
36
scripts/utils.sh
Normal 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* ]]
|
||||
}
|
||||
Reference in New Issue
Block a user