Merge pull request #177 from rasa/rasa/make-symlinks-relative
This commit is contained in:
commit
8d2373b5c5
1 changed files with 19 additions and 5 deletions
24
yadm
24
yadm
|
@ -447,11 +447,11 @@ function remove_stale_links() {
|
||||||
if [ -L "$stale_candidate" ]; then
|
if [ -L "$stale_candidate" ]; then
|
||||||
link_target=$(readlink "$stale_candidate" 2>/dev/null)
|
link_target=$(readlink "$stale_candidate" 2>/dev/null)
|
||||||
if [ -n "$link_target" ]; then
|
if [ -n "$link_target" ]; then
|
||||||
removal=yes
|
|
||||||
for review_link in "${alt_linked[@]}"; do
|
for review_link in "${alt_linked[@]}"; do
|
||||||
[ "$link_target" = "$review_link" ] && removal=no
|
[ "$link_target" = "$review_link" ] && continue 2
|
||||||
|
[ "$link_target" = "$(basename "$review_link")" ] && continue 2
|
||||||
done
|
done
|
||||||
[ "$removal" = "yes" ] && rm -f "$stale_candidate"
|
rm -f "$stale_candidate"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -526,7 +526,7 @@ function alt_future_linking() {
|
||||||
[ -L "$filename" ] && rm -f "$filename"
|
[ -L "$filename" ] && rm -f "$filename"
|
||||||
cp -f "$target" "$filename"
|
cp -f "$target" "$filename"
|
||||||
else
|
else
|
||||||
ln -nfs "$target" "$filename"
|
alt_ln "$target" "$filename"
|
||||||
alt_linked+=("$target")
|
alt_linked+=("$target")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -570,7 +570,7 @@ function alt_past_linking() {
|
||||||
fi
|
fi
|
||||||
cp -f "$alt_path" "$new_link"
|
cp -f "$alt_path" "$new_link"
|
||||||
else
|
else
|
||||||
ln -nfs "$alt_path" "$new_link"
|
alt_ln "$alt_path" "$new_link"
|
||||||
alt_linked+=("$alt_path")
|
alt_linked+=("$alt_path")
|
||||||
fi
|
fi
|
||||||
last_linked="$alt_path"
|
last_linked="$alt_path"
|
||||||
|
@ -607,6 +607,20 @@ function alt_past_linking() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function alt_ln() {
|
||||||
|
local alt_dir alt_base new_base
|
||||||
|
|
||||||
|
alt_dir="$(dirname "$1")"
|
||||||
|
alt_base="$(basename "$1")"
|
||||||
|
new_base="$(basename "$2")"
|
||||||
|
if pushd "$alt_dir" >/dev/null ; then
|
||||||
|
ln -nfs "$alt_base" "$new_base"
|
||||||
|
popd &>/dev/null
|
||||||
|
else
|
||||||
|
ln -nfs "$1" "$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function bootstrap() {
|
function bootstrap() {
|
||||||
|
|
||||||
bootstrap_available || error_out "Cannot execute bootstrap\n'$YADM_BOOTSTRAP' is not an executable program."
|
bootstrap_available || error_out "Cannot execute bootstrap\n'$YADM_BOOTSTRAP' is not an executable program."
|
||||||
|
|
Loading…
Reference in a new issue