Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·154 lines (140 loc) · 4.48 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·154 lines (140 loc) · 4.48 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
#!/bin/bash
set -euo pipefail
function create-link {
local -r SRC=$1
local -r DEST=$2
mkdir -p "$(dirname "$DEST")"
if ! [ -L "$DEST" ]; then
ln -ivs "$SRC" "$DEST"
else
echo "Skipping, link already exists: $DEST"
fi
}
function install-from-git-repo {
local -r name="$1"
local -r repo="$2"
local -r dest="$3"
echo "Installing $name..."
if [ -d "$dest" ]; then
(cd "$dest" && git pull --progress)
else
rm -rf "$dest"
git clone --progress "$repo" "$dest"
fi
}
function create-links {
echo "Creating links..."
# directories
create-link "$PWD/bin" "$HOME/bin"
create-link "$PWD/zsh" "$HOME/.zsh"
# files
create-link "$PWD/bashrc" "$HOME/.bashrc"
create-link "$PWD/ghostty-config" "$HOME/.config/ghostty/config"
create-link "$PWD/gitconfig" "$HOME/.gitconfig"
create-link "$PWD/gitignore" "$HOME/.gitignore"
create-link "$PWD/k9s-skin.yaml" "$HOME/.config/k9s/skins/tomsquest.yaml"
create-link "$PWD/nvim" "$HOME/.config/nvim"
create-link "$PWD/npmrc" "$HOME/.npmrc"
create-link "$PWD/profile" "$HOME/.profile"
create-link "$PWD/safe-rm" "$HOME/.safe-rm"
create-link "$PWD/zshenv" "$HOME/.zshenv"
create-link "$PWD/zshrc" "$HOME/.zshrc"
for file in $PWD/desktop-shortcuts/*
do
create-link "$file" "$HOME/.local/share/applications/$(basename "$file")"
done
}
function install-asdf-plugins {
asdf plugin add golang || true
asdf plugin add nodejs || true
asdf plugin add ruby || true
}
function install-apt-packages {
echo "Installing apt packages..."
# safe-rm: safer rm, for not crying in despair after `rm -rf /home/tom /something` (notice the space)
# libnotify-bin: `notify-send`, used by `alert`
# ffmpeg: `ffplay` used by `beep`, and `compress-videos`
# build-essential, curl, git: required by Home Brew
sudo apt update
sudo apt install --yes \
zsh \
git \
curl \
build-essential \
safe-rm \
jq \
wl-clipboard \
htop \
tree \
libnotify-bin \
ffmpeg \
git-lfs
}
function install-homebrew {
if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then
echo "Skipping, Home Brew already installed"
else
echo "Installing Home Brew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# Add brew (and the apps it installs, eg. asdf) to the PATH of this script
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
}
function install-homebrew-apps {
echo "Installing Home Brew apps..."
brew install asdf
brew install bat
brew install btop
brew install caesiumclt # for compress-images
brew install direnv
brew install dust
brew install eza # exa is unmaintained
brew install fd
brew install fzf
brew install gh
brew install httpie
brew install jump
brew install just
brew install k9s
brew install kubectx
brew install kubernetes-cli
brew install lefthook
brew install neovim
brew install opencode
brew install pnpm
brew install ripgrep
brew install starship
brew install tree-sitter-cli # for nvim-treesitter
brew install uv
}
function install-font {
local -r dest="$HOME/.local/share/fonts/JetBrainsMono"
if [ -d "$dest" ]; then
echo "Skipping, JetBrainsMono Nerd Font already installed"
return
fi
echo "Installing JetBrainsMono Nerd Font..."
mkdir -p "$dest"
curl -fsSL "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.tar.xz" | tar -xJ -C "$dest"
fc-cache -f "$dest"
}
function set-zsh-as-default-shell {
if [ "$(getent passwd "$USER" | cut -d: -f7)" = "/usr/bin/zsh" ]; then
echo "Skipping, zsh is already the default shell"
else
echo "Setting zsh as default shell..."
chsh -s /usr/bin/zsh
fi
}
function install-all {
install-apt-packages
create-links
install-from-git-repo "Zgenom" "https://github.com/jandamm/zgenom" "$HOME/.zgenom"
install-from-git-repo "Bash-Sensible" "https://github.com/mrzool/bash-sensible" "$HOME/.bash-sensible"
install-homebrew
install-homebrew-apps
install-asdf-plugins
install-font
set-zsh-as-default-shell
}
install-all