mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 08:46:39 +00:00
fix(install.sh): create parent directory of symlink target if needed
This commit is contained in:
@@ -161,12 +161,18 @@ log() {
|
||||
symlink() {
|
||||
local source="$1"
|
||||
local target="$2"
|
||||
local target_dir
|
||||
local linksource
|
||||
|
||||
if [ "$target" == "$source" ]; then
|
||||
log ok symlink "$target"
|
||||
elif [ ! -e "$target" ] && [ ! -L "$target" ]; then
|
||||
log link symlink "$target ${S_RARROW} $source"
|
||||
|
||||
target_dir="$(dirname "$target")"
|
||||
if [ ! -d "$target_dir" ]; then
|
||||
mkdir -p "$target_dir"
|
||||
fi
|
||||
ln -s "$source" "$target"
|
||||
elif [ -L "$target" ]; then
|
||||
linksource="$(readlink "$target")"
|
||||
|
||||
Reference in New Issue
Block a user