-
Notifications
You must be signed in to change notification settings - Fork 0
/
symlinks.sh
executable file
·40 lines (35 loc) · 1.14 KB
/
symlinks.sh
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
#!/bin/bash
IFS=$'\n\t'
set -xeou pipefail
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# suppress shell login message
[[ ! -f ~/.hushlogin ]] && touch ~/.hushlogin
for f in .zshrc \
.Brewfile \
.vimrc \
.editorconfig \
.gitconfig \
.gitignore_global \
.kubectl_aliases; do
if [ -f "$HOME/$f" ]; then rm "$HOME/$f"; fi
ln -sf "$SCRIPT_DIR/$f" "$HOME/$f"
done
# gnupg
if [ -f "$HOME/.gnupg" ] && [ ! -L "$HOME/.gnupg" ];then
echo "$HOME/.gnupg is not a symlink. Delete it manually."
exit 1
else
[ -L "$HOME/.gnupg" ] && unlink "$HOME/.gnupg"
ln -sf "$SCRIPT_DIR/.gnupg" "$HOME/.gnupg"
# make directory unreadable by others
chmod -R o-rx "$SCRIPT_DIR/.gnupg"
# make symlink available only to current user
chmod 700 "$HOME/.gnupg"
fi
# install zsh-completions
ZSH_COMPLETIONS=~/.oh-my-zsh/custom/plugins/zsh-completions
[[ -d "$ZSH_COMPLETIONS" ]] || git clone \
https://github.com/zsh-users/zsh-completions "$ZSH_COMPLETIONS"
# install iterm2 shell integration (for touchbar support etc)
# see: https://github.com/caskroom/homebrew-cask/issues/39439
curl -L https://iterm2.com/misc/install_shell_integration.sh | bash