mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
Improve install.sh script
This commit is contained in:
22
install.sh
22
install.sh
@@ -64,7 +64,7 @@ install_symlinks() {
|
||||
|
||||
# Symlink each path
|
||||
for i in "${SYMLINKS[@]}"; do
|
||||
symlink "$SYMLINK_PATH/$i" "$TARGET/.$i"
|
||||
dot_symlink "$i" "$SYMLINK_PATH" "$TARGET"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -124,6 +124,26 @@ symlink() {
|
||||
fi
|
||||
}
|
||||
|
||||
dot_symlink() {
|
||||
local name="$1"
|
||||
local source="$2/${name}"
|
||||
local target="$3/.${name}"
|
||||
local cur_name
|
||||
|
||||
if [ ! -e "$target" ]; then
|
||||
cur_name="$(dirname "$name")"
|
||||
while [ "$cur_name" != "." ] && [ "$cur_name" != "/" ]; do
|
||||
source="../${source}"
|
||||
cur_name="$(dirname "$cur_name")"
|
||||
done
|
||||
mkdir -p "$(dirname "$target")"
|
||||
ok "symlink: $target --> $source"
|
||||
ln -s "$source" "$target"
|
||||
else
|
||||
info "symlink: $target exists"
|
||||
fi
|
||||
}
|
||||
|
||||
git_clone() {
|
||||
local clone_url="$1"
|
||||
local target="$2"
|
||||
|
||||
Reference in New Issue
Block a user