install: refactor deploy() to be more readable
This commit is contained in:
parent
25a0fd2437
commit
ab7d7241d4
1 changed files with 6 additions and 9 deletions
15
install.sh
15
install.sh
|
@ -162,16 +162,13 @@ equal_content() {
|
||||||
dry_run || cp -f "$2" "$1"
|
dry_run || cp -f "$2" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Deploy package by creating subdirs and symlinks to dotfiles.
|
||||||
deploy() {
|
deploy() {
|
||||||
find "$1" -type f | while read src; do
|
package="$1"
|
||||||
src_dir="$(dirname "$src")"
|
find "$package" -type f | while read dotfile; do
|
||||||
dest_dir="$HOME${src_dir##"$1"}"
|
link="$HOME/${dotfile##"$package"/}"
|
||||||
ensure_directory "$dest_dir"
|
ensure_directory "$(dirname "$link")"
|
||||||
|
[ "$(basename "$dotfile")" = '.keep' ] || link "$link" "$dotfile"
|
||||||
filename="$(basename "$src")"
|
|
||||||
[ "$filename" = '.keep' ] && continue
|
|
||||||
|
|
||||||
link "$dest_dir/$filename" "$src"
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue