-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·71 lines (55 loc) · 1.78 KB
/
bootstrap.sh
File metadata and controls
executable file
·71 lines (55 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# =============================================================================
# bootstrap.sh — Main entry point for dotfiles setup
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/imaqsood/dotfiles/main/bootstrap.sh | bash
# OR
# git clone https://github.com/imaqsood/dotfiles.git ~/dev/dotfiles
# cd ~/dev/dotfiles && ./bootstrap.sh
#
# Supports: macOS (Homebrew) and Debian/Ubuntu (apt)
# Safe to run multiple times (idempotent)
# =============================================================================
set -euo pipefail
# Resolve the directory this script lives in (handles symlinks too)
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export DOTFILES_DIR
# Source shared utilities
source "$DOTFILES_DIR/lib/utils.sh"
# -- Preflight checks ---------------------------------------------------------
ensure_not_root
# -- Main flow ----------------------------------------------------------------
main() {
print_banner
local os
os=$(detect_os)
local arch
arch=$(detect_arch)
log_info "Detected OS: $os ($arch)"
if [ "$os" = "unsupported" ]; then
log_error "Unsupported operating system. This script supports macOS and Debian/Ubuntu."
exit 1
fi
# -- Step 1: Platform-specific package installation --
case "$os" in
macos)
source "$DOTFILES_DIR/install/macos.sh"
run_macos_setup
;;
debian)
source "$DOTFILES_DIR/install/debian.sh"
run_debian_setup
;;
esac
# -- Step 2: Cross-platform tools (oh-my-zsh, plugins, tmux, etc.) --
source "$DOTFILES_DIR/install/common.sh"
run_common_setup
# -- Step 3: Create required directories --
create_directories
# -- Step 4: Create symlinks --
setup_symlinks "$DOTFILES_DIR"
# -- Step 5: Summary --
print_summary "$os"
}
main "$@"