configs  Artifact [1580fcd6c9]

Artifact 1580fcd6c9c6773ebbc0d2a85d0a9dd0d96b9f09e6c60a32c2496e7836a0c226:

  • Executable file create_symlinks.sh — part of check-in [24d2eb82f0] at 2020-02-20 22:07:34 on branch trunk — Remove useless config subdirectory (user: js size: 1242)

#!/bin/sh
rel_dir="${PWD#$HOME/}"
echo "Configs relative to home in $rel_dir."

link_file() {
	if [ ! -e "$HOME/$2" ]; then
		echo "Symlinking $HOME/$2 -> $3$rel_dir/$1…"
		ln -s "$3$rel_dir/$1" "$HOME/$2"
	else
		echo "$HOME/$2 already exists, skipping…"
	fi
}

mkdir -p $HOME/.config
which git >/dev/null 2>&1 && link_file gitconfig .gitconfig
if which gpg >/dev/null 2>&1 || which gpg2 >/dev/null 2>&1; then
	mkdir -p $HOME/.gnupg
	link_file gpg.conf .gnupg/gpg.conf ../
fi
which tmux >/dev/null 2>&1 && link_file tmux.conf .tmux.conf
if which vim >/dev/null 2>&1; then
	link_file vim .vim
	link_file vimrc .vimrc
fi
which fish >/dev/null 2>&1 && link_file fish .config/fish ../
which youtube-dl >/dev/null 2>&1 && link_file youtube-dl .config/youtube-dl ../
which zsh >/dev/null 2>&1 && link_file zshrc .zshrc

if test x"$(uname -s)" = x"Darwin"; then
	dest="$HOME/Library/Keyboard Layouts/eu_US.keylayout"
	# This does not like being symlinked…
	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 Xmodmap .Xmodmap
	link_file xinitrc .xinitrc
fi