-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall
executable file
·90 lines (81 loc) · 2.4 KB
/
install
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
#!/bin/zsh
set -e
DOTFILES="$HOME/.config/dotfiles"
movesuffix="moved-by-dotfiles-install"
function doit {
printf "%s\n" "$*"
"$@"
}
function link {
readonly origin=$DOTFILES/${1:?"The origin must be specified."}
target=${2:?"The target must be specified."}
if [[ "${target##/home/}" == $target ]]; then
target=$HOME/$target
fi
if [[ -L $target ]]; then
linktarget=$(readlink -f $target)
if [[ $linktarget == $origin ]]; then
echo "# already linked: $origin to $target"
else
doit mv $target $target.$movesuffix
doit ln -s $origin $target
fi
elif [[ -f $target || -d $target ]]; then
doit mv $target $target.$movesuffix
doit ln -s $origin $target
else
parent=$(dirname "$target")
if [[ ! -d $parent ]]; then
doit mkdir -p $parent;
fi
doit ln -s $origin $target
fi
}
function conflink {
link $1 .config/$1
}
# Straightforward links
conflink autorandr
conflink dunst
conflink gtk-3.0
conflink i3
conflink kitty
conflink lsd
conflink mimeapps.list
conflink mutt/muttrc
conflink ranger/rc.conf
conflink rofi/config
conflink rofi/themes
conflink rofi/bin
conflink tmux/tmux.conf
conflink vim/vimrc
conflink vim/colors
# Nonstandard links
link git/gitconfig .config/git/config
link git/gitignore .gitignore
link mimeapps.list .local/share/applications/mimeapps.list
link ./user-dirs.dirs .config/user-dirs.dirs
link mutt/notmuch-mutt .local/bin/notmuch-mutt
link mutt/offlineimaprc .config/offlineimap/config
link mutt/offlineimap.service .config/systemd/user/offlineimap.service
link notmuch/notmuch-config .notmuch-config
link picom/picom.conf .config/picom.conf
link rofi/rofi-pass.conf .config/rofi-pass/config
link rofi/rofimoji.rc .config/rofimoji.rc
link tig/tigrc .tigrc
link virtualenvs/postactivate .local/share/virtualenvs/postactivate
link virtualenvs/postdeactivate .local/share/virtualenvs/postdeactivate
link vim/vimrc .config/nvim/init.vim
link vim/coc-settings.json .config/nvim/coc-settings.json
link X/XCompose .XCompose
link X/xintitrc .xinitrc
link zsh/zshrc .zshrc
# Oh firefox. Why.
# First, check if there is a .mozilla directory.
if [[ -d $HOME/.mozilla ]]; then
for profile in $HOME/.mozilla/firefox/*default*; do
link firefox/userChrome.css $profile/chrome/userChrome.css;
done
fi
# Some directories need to exist
mkdir -p ~/.local/share/zsh