bootstrap: link topic parent dotfiles
This commit is contained in:
parent
8369bbe9a2
commit
02fa0a4576
34
bootstrap
34
bootstrap
|
@ -69,6 +69,20 @@ _link() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_linkall() {
|
||||||
|
local file="$1"
|
||||||
|
if [[ -d "$file" && "${file##*/}" == .@(config|local) ]]; then
|
||||||
|
for subfile in "$file"/*; do
|
||||||
|
base="$HOME/${file##*/}/"
|
||||||
|
[[ -d $base ]] || _run mkdir -p "$base"
|
||||||
|
_link "$subfile" "$base"
|
||||||
|
done
|
||||||
|
elif [[ -e $file ]]; then
|
||||||
|
_link "$file" "$HOME/"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
install=1
|
install=1
|
||||||
link=1
|
link=1
|
||||||
|
@ -119,25 +133,23 @@ for topic in ${@:-$(find "$ENABLED_DIR" -maxdepth 1 -type l)}; do
|
||||||
[[ -d $topic ]] || continue
|
[[ -d $topic ]] || continue
|
||||||
|
|
||||||
tpath="$CWD/$topic"
|
tpath="$CWD/$topic"
|
||||||
tname="$(basename $(dirname $tpath))_${tpath##*/}"
|
tparentpath="$(dirname $tpath)"
|
||||||
|
tname="${tparentpath##*/}_${tpath##*/}"
|
||||||
echo -e "${green}${tname//_//}${nc}"
|
echo -e "${green}${tname//_//}${nc}"
|
||||||
# Link binaries
|
# Link binaries
|
||||||
for bin in $tpath/bin/*; do
|
for bin in $tpath/bin/*; do
|
||||||
[[ "$link" && -x "$bin" ]] && _link "$bin" "$HOME/.bin/"
|
[[ "$link" && -x "$bin" ]] && _link "$bin" "$HOME/.bin/"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Symlink dotfiles from topic directories (2 levels deep)
|
|
||||||
if [[ $link ]]; then
|
if [[ $link ]]; then
|
||||||
for file in "$tpath"/.[a-zA-Z]*; do
|
# Symlink dotfiles from topic parent directory
|
||||||
if [[ -d $file && "${file##*/}" == .config ]]; then
|
for file in "$tparentpath"/.[a-zA-Z]*; do
|
||||||
for subfile in "$file"/*; do
|
_linkall "$file"
|
||||||
base="$HOME/${file##*/}/"
|
|
||||||
[[ -d $base ]] || _run mkdir -p "$base"
|
|
||||||
_link "$subfile" "$base"
|
|
||||||
done
|
done
|
||||||
elif [[ -e $file ]]; then
|
|
||||||
_link "$file" "$HOME/"
|
# Symlink dotfiles from topic directories (2 levels deep)
|
||||||
fi
|
for file in "$tpath"/.[a-zA-Z]*; do
|
||||||
|
_linkall "$file"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue