Skip to content

Commit

Permalink
Merge pull request #34 from containers/dont-replace-if-link-is-the-same
Browse files Browse the repository at this point in the history
If symlink is already correct, don't replace it
  • Loading branch information
rhatdan authored Aug 9, 2024
2 parents 5500c98 + 4e84f77 commit 68389f9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ramalama
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ def pull_huggingface(model, ramalama_store):
symlink_path = f"{directory}/{filename}"
relative_target_path = os.path.relpath(
gguf_path.rstrip(), start=os.path.dirname(symlink_path))
if os.path.exists(symlink_path) and os.readlink(symlink_path) == relative_target_path:
# Symlink is already correct, no need to update it
return symlink_path

try:
run_cmd(["ln", "-sf", relative_target_path, symlink_path])
except subprocess.CalledProcessError as e:
Expand Down

0 comments on commit 68389f9

Please sign in to comment.