-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·97 lines (80 loc) · 2.13 KB
/
setup.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
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
#!/bin/zsh -eux
THDIR=$PWD/settingfiles
TARGET=$HOME
if_darwin() {
[[ $(uname -s) = "Darwin" ]]
}
if_linux() {
[[ $(uname -s) = "Linux" ]]
}
# install oh-my-zsh unless installed
() {
local omz; omz="${TARGET}/.oh-my-zsh"
if [[ ! -a "${omz}" ]]; then
git clone https://github.com/robbyrussell/oh-my-zsh "${omz}"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "${omz}/custom/plugins/zsh-syntax-highlighting"
fi
local dst; dst="${TARGET}/.oh-my-zsh/custom/"
local src; src="${THDIR}/dots/.oh-my-zsh/custom/"
for tgt in themes plugins; () {
for f in "${src}${tgt}"/*; () {
[[ ! -a "${dst}${tgt}/$(basename "${f}")" ]] && ln -s "${f}" "${dst}${tgt}/"
}
}
} || :
# gtk keybind
() {
if_linux && {
local dst; dst="${TARGET}/.themes/Vi"
[[ ! -a "${dst}" ]] && mkdir -p "${TARGET}/.themes/" && ln -s "${THDIR}/Vi/" "${dst}"
}
} || :
# bin
(){
local dst; dst="${TARGET}/bin/"
mkdir -p "${TARGET}/.local/bin"
if [[ ! -a "${dst}" ]]; then
mkdir -p "${dst}"
fi
ln -s "${THDIR}/bin/"* "${dst}"
} || :
() {
if_darwin && {
curl -LO https://invisible-island.net/datafiles/current/terminfo.src.gz && gunzip terminfo.src.gz
/usr/bin/tic -xe tmux-256color terminfo.src
}
} || :
# .config
## fontconfig
THCONFIG="${THDIR}/.config"
mkdir -p "${TARGET}/.config/karabiner/assets/complex_modifications/"
migrate() {
local content; content=$1
local dstdir; dstdir="${TARGET}/.config/${content}/"
mkdir -p "${dstdir}"
local THDIR2; THDIR2="${THCONFIG}/${content}"
for file in "${THDIR2}"; (){
basefile="$(basename ${file})"
local dst; dst="${dstdir}${basefile}"
[[ ! -a "${dst}" ]] && ln -s "${file}" "${dst}"
}
}
() {
for target in $(ls "${THDIR}"); do
migrate $target
done
# karabiner
# rm -rf "${TARGET}/.config/karabiner/karabiner.json"
cp "${THCONFIG}/karabiner/karabiner.json" "${TARGET}/.config/karabiner/karabiner.json"
} || :
# set dotfiles
for f in ${THDIR}/dots/.*; () {
local dst; dst="${TARGET}/$(basename "${f}")"
[[ ! -a "${dst}" ]] && ln -s "${f}" "${dst}"
} || :
# .xinitrc
## it is COPIED
() {
local dst; dst="${TARGET}/.xinitrc"
[[ ! -a "${dst}" ]] && cp "${THDIR}/.xinitrc" "${dst}"
} || :