dotfiles/install.sh

26 lines
392 B
Bash
Executable File

#!/bin/sh
set -e
cd "$(dirname "$0")"
PWD="$(pwd)"
git submodule init
git submodule update
clone_dir() {
local dir=${1:-home}
local to=${2:-$HOME}
[ "$dir" != "home" ] && mkdir -p "$to/.${dir#home/}"
for f in $dir/*; do
if [ -d "$f" ]; then
clone_dir "$f" "$to"
elif [ -f "$f" ]; then
ln -sf "$PWD/$f" "$to/.${f#home/}"
fi
done
}
for d in */; do
clone_dir "${d%/}"
done