-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·62 lines (51 loc) · 1.64 KB
/
install.sh
File metadata and controls
executable file
·62 lines (51 loc) · 1.64 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
#!/bin/bash
set -euo pipefail
link() {
mkdir -p "$(dirname "$2")"
if [ -L "$2" ] && [ "$(readlink "$2")" = "$1" ]; then
echo "Already linked: $2 -> $1"
else
[ -e "$2" ] && rm -rf "$2"
ln -sf "$1" "$2"
echo "Linked $1 -> $2"
fi
}
# shell
link "$PWD"/zsh/.zshrc ~/.config/zsh/.zshrc
link "$PWD"/zsh/.zshenv ~/.config/zsh/.zshenv
link "$PWD"/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh ~/.config/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
link "$PWD"/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ~/.config/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
link "$PWD"/zsh/pure ~/.config/zsh/pure
# terms
link "$PWD"/ghostty ~/.config/ghostty
# ssh
link "$PWD"/ssh/allowed_signers ~/.ssh/allowed_signers
# editor
link "$PWD"/nvim ~/.config/nvim
link "$PWD"/zed/settings.json ~/.config/zed/settings.json
link "$PWD"/zed/keymap.json ~/.config/zed/keymap.json
# other
link "$PWD"/git/config ~/.config/git/config
link "$PWD"/git/gitignore ~/.config/git/ignore
link "$PWD"/bat/config ~/.config/bat/config
# set var according to os
if [[ $OSTYPE == 'darwin'* ]]; then
ZSHENV_FILE="/etc/zshenv"
else
ZSHENV_FILE="/etc/zsh/zshenv"
fi
# create zshenv file if not exists
if [ ! -f "$ZSHENV_FILE" ]; then
echo "Creating $ZSHENV_FILE..."
sudo touch "$ZSHENV_FILE"
else
echo "$ZSHENV_FILE already exists"
fi
# add export ... if not already in file
if ! grep -q "^export ZDOTDIR=" "$ZSHENV_FILE"; then
echo "Adding ZDOTDIR to $ZSHENV_FILE"
echo "export ZDOTDIR=\"$HOME/.config/zsh\"" | sudo tee -a "$ZSHENV_FILE" >/dev/null
else
echo "ZDOTDIR already set"
fi
echo "[✔] Bootstrap complete. Restart your shell!"