dotfiles/install.sh

24 lines
337 B
Bash
Raw Normal View History

2020-09-08 15:25:32 -04:00
#!/bin/sh
2021-08-20 13:40:35 -04:00
set -e
2021-08-11 13:45:00 -04:00
cd "$(dirname "$0")"
PWD="$(pwd)"
2020-09-08 15:25:32 -04:00
2021-08-20 13:40:35 -04:00
#dir to
clone_dir() {
local dir=${1:-home}
local to=${2:-$HOME}
2020-09-08 15:25:32 -04:00
2021-08-20 13:40:35 -04:00
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
}
2020-09-08 15:25:32 -04:00
2021-08-20 13:40:35 -04:00
for d in */; do
clone_dir "${d%/}"
2021-08-11 13:45:00 -04:00
done