Recursive install script

This commit is contained in:
Augusto Gunsch 2021-08-20 14:40:35 -03:00
parent fb86f77ff8
commit 20325870e2
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
1 changed files with 16 additions and 18 deletions

View File

@ -1,25 +1,23 @@
#!/bin/sh #!/bin/sh
set -e
cd "$(dirname "$0")" cd "$(dirname "$0")"
PWD="$(pwd)" PWD="$(pwd)"
#dotfiles from #dir to
#~/.config clone_dir() {
for f in config/*; do local dir=${1:-home}
mkdir -p "$HOME/.$f" local to=${2:-$HOME}
for d in $f/*; do
ln -sf "$PWD/$d" "$HOME/.$d"
done
done
#dotfiles from mkdir -p "$to/.${dir#home}"
#~ for f in $dir/*; do
for f in home/*; do if [ -d "$f" ]; then
ln -sf "$PWD/$f" "$HOME/.$(basename $f)" clone_dir "$f" "$to"
elif [ -f "$f" ]; then
ln -sf '$PWD/$f' -> '$to/.${f#home/}'
fi
done done
}
#scripts for d in */; do
#~/.local/bin clone_dir "${d%/}"
mkdir -p "$HOME/.local/bin"
for f in local/bin/*; do
ln -sf "$PWD/$f" "$HOME/.$f"
done done