-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.bash
executable file
·65 lines (56 loc) · 1.67 KB
/
bootstrap.bash
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
#!/usr/bin/env bash
# curl -sSfL https://raw.githubusercontent.com/MurtadhaInit/dotfiles/refs/heads/main/bootstrap.bash | bash
# This script will:
# 1. Install Git, Homebrew (on MacOS), and nu
# 2. Clone the dotfiles repo
# 3. Initiate the setup process
# check if a command exists
function exists() {
command -v "$1" >/dev/null 2>&1
# This is equivalent to:
# command -v $1 1>/dev/null 2>/dev/null
}
OS_TYPE=$(uname)
case "$OS_TYPE" in
("Darwin")
# Install Homebrew without user interaction
# This will also install Xcode Command Line Tools if not present TODO: confirm so
if ! exists brew; then
echo "Installing Homebrew..."
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
brew analytics off
fi
if ! exists git; then
echo "Installing Git..."
brew install git
fi
if [ ! -d "$HOME/.dotfiles" ]; then
git clone --recursive https://github.com/MurtadhaInit/dotfiles.git "$HOME/.dotfiles"
else
echo "Dotfiles directory present ✅"
fi
if ! exists nu; then
echo "Installing Nushell..."
brew install nushell
fi
;;
("Linux")
# Linux-specific actions
;;
("CYGWIN"* | "MINGW"* | "MSYS"*)
# Windows-specific actions
;;
(*)
echo "Unknown OS: $OS_TYPE"
exit 1
;;
esac
if [ "$#" -eq 0 ]; then
# No arguments provided
"$HOME"/.dotfiles/system-setup/start.nu --skip
# "$HOME"/.dotfiles/system-setup/start.nu --skip-tasks ["8-all-apps"]
else
# Pass all arguments to the nushell script
"$HOME"/.dotfiles/system-setup/start.nu "$@"
fi