#!/bin/sh set -e if ! which lr >/dev/null 2>&1; then >&2 echo "install leah2's lr(1) first" exit 1 fi if test ! -d './files'; then >&2 echo "This script has to be executed from the dotfiles root" exit 1 fi cd files lr -U -t 'path~~".*"' | while read -r path; do if test -d "$path"; then if test -d "$HOME/$path"; then >&2 echo "[-] $path already set up" continue fi mkdir -p "$HOME/$path" echo "[x] created dir $HOME/$path" continue else if test -L "$HOME/$path"; then >&2 echo "[-] $path already set up" continue fi ln -fs "$(realpath "$HOME/$path")" "$HOME/$path" echo "[x] created symlink $path -> $HOME/$path" fi done echo "done"