-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·140 lines (124 loc) · 3.8 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·140 lines (124 loc) · 3.8 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
#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
IS_STEAM_DECK=false
if grep -qi "steamos" /etc/os-release 2>/dev/null; then
IS_STEAM_DECK=true
fi
install_packages() {
if command -v apt &>/dev/null; then
sudo apt install -y "$@"
elif command -v dnf &>/dev/null; then
sudo dnf install -y --skip-unavailable "$@"
elif command -v pacman &>/dev/null; then
sudo pacman -S --needed --noconfirm "$@"
else
echo "Error: No supported package manager found (apt, dnf, or pacman)" >&2
exit 1
fi
}
if $IS_STEAM_DECK; then
echo "Steam Deck detected — disabling read-only filesystem..."
sudo steamos-readonly disable
fi
echo "Installing binaries..."
if command -v pacman &>/dev/null; then
binaries=(
curl
unzip
fontconfig
zsh
git
zsh-autosuggestions
zsh-syntax-highlighting
)
else
binaries=(
curl
unzip
fontconfig
zsh
git-gui
zsh-autosuggestions
zsh-syntax-highlighting
)
fi
install_packages "${binaries[@]}"
echo "Symlinking dotfiles..."
for file in "$SCRIPT_DIR"/dotfiles/.*; do
name="$(basename "$file")"
[[ "$name" == "." || "$name" == ".." || "$name" == ".git" ]] && continue
if [[ "$name" == ".config" ]]; then
# Symlink each item under .config individually to avoid clobbering ~/.config
mkdir -p "$HOME/.config"
for item in "$file"/*; do
item_name="$(basename "$item")"
echo " .config/$item_name -> ~/.config/$item_name"
ln -sf "$item" "$HOME/.config/$item_name"
done
else
echo " $name -> ~/$name"
ln -sf "$file" ~/
fi
done
echo "Installing nvm (latest)..."
if [[ ! -d "$HOME/.nvm" ]]; then
NVM_LATEST="$(curl -fsSL https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')"
echo " version: $NVM_LATEST"
curl -fsSL "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_LATEST}/install.sh" | bash
else
echo " already installed, skipping"
fi
echo "Installing Node.js LTS..."
export NVM_DIR="$HOME/.nvm"
# shellcheck source=/dev/null
source "$NVM_DIR/nvm.sh"
if ! nvm ls default &>/dev/null || [[ "$(nvm alias default 2>/dev/null)" == *"N/A"* ]]; then
nvm install --lts
nvm alias default node
else
echo " already installed, skipping"
fi
echo "Installing Claude Code..."
if ! npm list -g @anthropic-ai/claude-code &>/dev/null; then
npm install -g @anthropic-ai/claude-code
else
echo " already installed, skipping"
fi
echo "Installing starship..."
if ! command -v starship &>/dev/null; then
curl -sS https://starship.rs/install.sh | sh -s -- --yes
else
echo " already installed, skipping"
fi
echo "Installing vim-plug..."
if [[ ! -f ~/.vim/autoload/plug.vim ]]; then
curl -fsSLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
else
echo " already installed, skipping"
fi
echo "Installing FiraCode Mono Nerd Font..."
FONT_DIR="${HOME}/.local/share/fonts"
if ! ls "$FONT_DIR"/FiraCodeNerdFontMono* &>/dev/null; then
mkdir -p "$FONT_DIR"
NERD_FONTS_LATEST="$(curl -fsSL https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')"
echo " version: $NERD_FONTS_LATEST"
curl -fsSL "https://github.com/ryanoasis/nerd-fonts/releases/download/${NERD_FONTS_LATEST}/FiraCode.zip" -o /tmp/FiraCode.zip
unzip -o /tmp/FiraCode.zip -d "$FONT_DIR" "FiraCodeNerdFontMono*"
rm -f /tmp/FiraCode.zip
fc-cache -f "$FONT_DIR"
else
echo " already installed, skipping"
fi
echo "Switching to zsh..."
if [[ "$SHELL" != "$(which zsh)" ]]; then
sudo usermod --shell "$(which zsh)" "$USER"
else
echo " already using zsh, skipping"
fi
echo ""
echo "Done! Restart your terminal to apply all changes."
echo ""
echo "PowerShell: add this to your profile (\$PROFILE):"
echo " Invoke-Expression (&starship init powershell)"