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
|
||||||
|
# Symlink dotfiles from topic parent directory
|
||||||
|
for file in "$tparentpath"/.[a-zA-Z]*; do
|
||||||
|
_linkall "$file"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Symlink dotfiles from topic directories (2 levels deep)
|
||||||
for file in "$tpath"/.[a-zA-Z]*; do
|
for file in "$tpath"/.[a-zA-Z]*; do
|
||||||
if [[ -d $file && "${file##*/}" == .config ]]; then
|
_linkall "$file"
|
||||||
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
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue