-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·168 lines (152 loc) · 4.94 KB
/
setup.sh
File metadata and controls
executable file
·168 lines (152 loc) · 4.94 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/usr/bin/env bash
set -e
sudo -v
if [ -f "$(dirname "$0")/functions/sh/symlinks.sh" ]; then
source "$(dirname "$0")/functions/sh/symlinks.sh"
else
echo "⚠️ symlinks.sh not found!"
fi
echo "=====setting up your computer... please wait...====="
# === Detect OS and Distribution ===
DISTRO_TYPE=""
case "$OSTYPE" in
linux-gnu*)
if [ -f /etc/os-release ]; then
DISTRO_TYPE=$(grep '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"')
echo "=====setup for Linux: $DISTRO_TYPE====="
fi
;;
darwin*)
DISTRO_TYPE="macos"
echo "=====setup for MacOS====="
;;
*)
echo "Unsupported OS: $OSTYPE"
exit 1
;;
esac
# === Update system & curl ===
echo "=====checking for updates... please wait...====="
case "$DISTRO_TYPE" in
ubuntu|debian)
sudo apt update -y && sudo apt upgrade -y
if ! command -v curl >/dev/null 2>&1; then sudo apt install curl -y; fi
;;
fedora)
sudo dnf update -y
if ! command -v curl >/dev/null 2>&1; then sudo dnf install curl -y; fi
;;
macos)
sudo softwareupdate -i -a
;;
esac
# === Homebrew ===
echo "=====checking for homebrew...====="
if ! command -v brew >/dev/null 2>&1; then
case "$DISTRO_TYPE" in
ubuntu|debian)
sudo apt install build-essential -y
;;
fedora)
sudo dnf group install development-tools
sudo dnf install procps-ng curl file git -y
;;
esac
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" < /dev/null
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
else
echo "===homebrew is installed already==="
fi
echo DONE
# === Install Brew Packages ===
echo "=====installing brew packages...====="
# update brew recipes
brew update
if [ -f "./Brewfile" ]; then
brew bundle --file ./Brewfile
else
echo "⚠️ Brewfile not found, skipping brew bundle."
fi
# === Linux-only apps ===
if [ "$OSTYPE" = "linux-gnu" ]; then
# check for zsh and install if it's not found
echo "=====checking for zsh...====="
if ! command -v zsh >/dev/null 2>&1; then
case "$DISTRO_TYPE" in
ubuntu|debian) sudo apt install zsh -y ;;
fedora) sudo dnf install zsh -y ;;
esac
else
echo "===zsh is installed already==="
fi
echo DONE
echo "=====installing linux apps...====="
# install vim, batcat, fzf nmap ripgrep fd-find and procs
# for ubuntu/debian install bottom and zoxide via homebrew
# fedora install bottom and zoxide via dnf
case "$DISTRO_TYPE" in
ubuntu|debian)
sudo apt install vim bat fzf nmap ripgrep fd-find htop -y
mkdir -p ~/.local/bin
ln -sf /usr/bin/batcat ~/.local/bin/bat
ln -s $(which fdfind) ~/.local/bin/fd
brew install bottom zoxide
;;
fedora)
sudo dnf copr enable atim/bottom -y
sudo dnf install vim bat bottom fzf nmap ripgrep fd-find htop zoxide -y
;;
esac
fi
# === Oh My Zsh ===
echo "=====checking for oh-my-zsh...====="
if [ ! -d "$HOME/.oh-my-zsh" ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
# clone missing oh-my-zsh plugins
FZF_TAB_PATH="$HOME/.oh-my-zsh/custom/plugins/fzf-tab"
ZSH_AUTOSUGGESTIONS_PATH="$HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
ZSH_SYNTAX_HIGHLIGHTING_PATH="$HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
if [ ! -d "$FZF_TAB_PATH" ]; then
git clone https://github.com/Aloxaf/fzf-tab "$FZF_TAB_PATH"
fi
if [ ! -d "$ZSH_AUTOSUGGESTIONS_PATH" ]; then
git clone https://github.com/zsh-users/zsh-autosuggestions "$ZSH_AUTOSUGGESTIONS_PATH"
fi
if [ ! -d "$ZSH_SYNTAX_HIGHLIGHTING_PATH" ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_SYNTAX_HIGHLIGHTING_PATH"
fi
else
echo "===oh-my-zsh is installed already==="
fi
echo DONE
# === Starship ===
echo "=====checking for starship...====="
if ! command -v starship >/dev/null 2>&1; then
sh -c "$(curl -sS https://starship.rs/install.sh)" -y -f
else
echo "===starship is installed already==="
fi
echo DONE
# === Symlinks ===
echo "=====creating symlinks...====="
# remove .zshrc from $HOME (if it exists)
rm -rf "$HOME/.zshrc"
if [ -f "$(dirname "$0")/configs.sh" ]; then
source "$(dirname "$0")/configs.sh"
else
echo "⚠️ configs.sh not found!"
fi
# === Copilot and Claude ===
echo "=====installing Copilot and Claude... ====="
echo "Installing Claude Code..."
curl -fsSL https://claude.ai/install.sh | bash
echo "Done!"
echo "Installing Copilot CLI..."
curl -fsSL https://gh.io/copilot-install | bash
echo "Done!"
# === Finish section ===
echo "=====almost done... need to reboot====="
read -p "Reboot now? [y/N]: " REBOOT_CONFIRM
if [[ "$REBOOT_CONFIRM" =~ ^[Yy]$ ]]; then
sudo reboot
fi