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
|
|
|
clone_dir() {
|
|
|
|
local dir=${1:-home}
|
|
|
|
local to=${2:-$HOME}
|
2020-09-08 15:25:32 -04:00
|
|
|
|
2021-08-22 18:02:00 -04:00
|
|
|
[ "$dir" != "home" ] && mkdir -p "$to/.${dir#home/}"
|
2021-08-20 13:40:35 -04:00
|
|
|
for f in $dir/*; do
|
|
|
|
if [ -d "$f" ]; then
|
|
|
|
clone_dir "$f" "$to"
|
|
|
|
elif [ -f "$f" ]; then
|
2021-08-20 13:45:35 -04:00
|
|
|
ln -sf "$PWD/$f" "$to/.${f#home/}"
|
2021-08-20 13:40:35 -04:00
|
|
|
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
|