blob: c89e7aae19117f020c0a3eda8bc5465701d71d6b (
plain)
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
|
#!/bin/bash
set -euo pipefail
mkdir -p dotfiles-backup
# XDG layout
xcache="${XDG_CACHE_HOME:-${HOME}/.cache}"
xdata="${XDG_DATA_HOME:-${HOME}/.local/share}"
xconfig="${XDG_CONFIG_HOME:-${HOME}/.config}"
userbin="$HOME/.local/bin"
mkdir -p "$xcache" "$xdata" "$xconfig" "$userbin"
function link {
src="$1"
dest="$2"
if [ -e "$dest" ] && [ ! -L "$dest" ]; then
mv "$dest" "../dotfiles-backup/."
fi
if [ ! -e "$dest" ]; then
ln -sf "$src" "$dest"
fi
}
# deploy to XDG dirs
mkdir -p "${xcache}/zsh"
mkdir -p "${xdata}/zsh"
cd config
for d in *
do
link "$(pwd)/$d" "${xconfig}/$d"
done
cd ..
# deploy to home
cd home
for f in *
do
link "$(pwd)/${f}" "$HOME/.${f}"
done
cd ..
# deploy to user binaries
mkdir -p "$userbin"
cd bin
for f in *
do
link "$(pwd)/${f}" "$userbin/${f}"
done
cd ..
# install vim-plug
if [ ! -e "$HOME/.vim/autoload/plug.vim" ]; then
mkdir -p "$HOME/.vim/autoload"
curl -o "$HOME/.vim/autoload/plug.vim" \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vim +PlugInstall +qall
fi
# create local files
if [ ! -e "$HOME/.config/zsh/00-local.zsh" ]; then
cp local/local.zsh config/zsh/00-local.zsh
fi
if [ ! -e "$HOME/.config/git/config-local" ]; then
cp local/gitconfig-local config/git/config-local
fi
dconfig="$xconfig/duplicity"
mkdir -p "$dconfig"
if [ ! -e "$dconfig/config" ]; then
cp local/duplicity-config "$dconfig/config"
fi
if [ ! -e "$dconfig/excludes" ]; then
cp local/duplicity-excludes "$dconfig/excludes"
fi
# download nerdfonts
new_font=0
function get_font {
local font_name="$1"
local font_url="$2"
shift 2
local font_dir="$HOME/.local/share/fonts/$font_name"
mkdir -p "$font_dir"
if [ ! -d "$font_dir" ] || [ -z "$(ls -A "$font_dir" 2> /dev/null)" ]; then
curl -o "$font_dir/font.zip" "$font_url"
unzip "$font_dir/font.zip" "$@" -d "$font_dir"
rm "$font_dir/font.zip"
new_font=1
fi
}
get_font sourcecodepro-nerd \
https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/SourceCodePro.zip \
"Sauce Code Pro Medium Nerd Font Complete.ttf" \
"Sauce Code Pro Bold Nerd Font Complete.ttf" \
"Sauce Code Pro Medium Italic Nerd Font Complete.ttf" \
"Sauce Code Pro Bold Italic Nerd Font Complete.ttf"
get_font jetbrainsmono-nerd \
https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/JetBrainsMono.zip \
"JetBrains Mono Regular Nerd Font Complete Mono.ttf" \
"JetBrains Mono Italic Nerd Font Complete Mono.ttf" \
"JetBrains Mono Bold Nerd Font Complete Mono.ttf" \
"JetBrains Mono Bold Italic Nerd Font Complete Mono.ttf"
if [ "$new_font" = "1" ]; then
echo "Hint: Run 'fc-cache -v' to rebuild your font cache"
fi
|