create_symlinks.sh: Only symlink as needed
This commit is contained in:
parent
9fb5a44b9c
commit
ce52fc5aff
1 changed files with 26 additions and 15 deletions
|
@ -3,28 +3,39 @@ rel_dir="${PWD#$HOME/}"
|
||||||
echo "Configs relative to home in $rel_dir."
|
echo "Configs relative to home in $rel_dir."
|
||||||
|
|
||||||
link_file() {
|
link_file() {
|
||||||
if [ ! -f "$HOME/$2" ]; then
|
if [ ! -e "$HOME/$2" ]; then
|
||||||
|
echo "Symlinking $HOME/$2 -> $3$rel_dir/$1…"
|
||||||
ln -s "$3$rel_dir/$1" "$HOME/$2"
|
ln -s "$3$rel_dir/$1" "$HOME/$2"
|
||||||
else
|
else
|
||||||
echo "$HOME/$2 already exists, skipping..."
|
echo "$HOME/$2 already exists, skipping…"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
link_file gitconfig .gitconfig
|
mkdir -p $HOME/.config
|
||||||
mkdir -p $HOME/.gnupg
|
which git >/dev/null 2>&1 && link_file gitconfig .gitconfig
|
||||||
link_file gpg.conf .gnupg/gpg.conf ../
|
if which gpg >/dev/null 2>&1 || which gpg2 >/dev/null 2>&1; then
|
||||||
link_file tmux.conf .tmux.conf
|
mkdir -p $HOME/.gnupg
|
||||||
link_file vim .vim
|
link_file gpg.conf .gnupg/gpg.conf ../
|
||||||
link_file vimrc .vimrc
|
fi
|
||||||
link_file config/fish .config/fish ../
|
which tmux >/dev/null 2>&1 && link_file tmux.conf .tmux.conf
|
||||||
mkdir -p $HOME/.config/youtube-dl
|
if which vim >/dev/null 2>&1; then
|
||||||
link_file config/youtube-dl/config .config/youtube-dl/config ../../
|
link_file vim .vim
|
||||||
link_file zshrc .zshrc
|
link_file vimrc .vimrc
|
||||||
|
fi
|
||||||
|
which fish >/dev/null 2>&1 && link_file config/fish .config/fish ../
|
||||||
|
which youtube-dl >/dev/null 2>&1 && link_file config/youtube-dl .config/youtube-dl ../
|
||||||
|
which zsh >/dev/null 2>&1 && link_file zshrc .zshrc
|
||||||
|
|
||||||
if test x"$(uname -s)" = x"Darwin"; then
|
if test x"$(uname -s)" = x"Darwin"; then
|
||||||
link_file eu_US.keylayout \
|
dest="$HOME/Library/Keyboard Layouts/eu_US.keylayout"
|
||||||
"Library/Keyboard Layouts/eu_US.keylayout" ../../
|
# This does not like being symlinked…
|
||||||
else
|
if [ ! -e "$dest" ]; then
|
||||||
|
echo "Hardlinking eu_US.keylayout -> $dest"
|
||||||
|
ln eu_US.keylayout "$dest"
|
||||||
|
else
|
||||||
|
echo "$dest already exists, skipping…"
|
||||||
|
fi
|
||||||
|
elif which startx >/dev/null 2>&1; then
|
||||||
link_file Xdefaults .Xdefaults
|
link_file Xdefaults .Xdefaults
|
||||||
link_file Xmodmap .Xmodmap
|
link_file Xmodmap .Xmodmap
|
||||||
link_file xinitrc .xinitrc
|
link_file xinitrc .xinitrc
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue