From 7ede5245f664d9d1a4edf127fb2ffec9fc9d37c1 Mon Sep 17 00:00:00 2001
From: Max Melchert <maximilian.melchert@stud.hs-bochum.de>
Date: Tue, 11 Mar 2025 20:21:01 +0100
Subject: [PATCH] feat: add config option to handle symlinks in rsync

---
 src/makefile/README.md | 29 +++++++++++++++--------------
 src/makefile/makefile  |  5 ++++-
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/src/makefile/README.md b/src/makefile/README.md
index 6547cd4..ded7a56 100644
--- a/src/makefile/README.md
+++ b/src/makefile/README.md
@@ -121,20 +121,21 @@ Sie werden durch den Aufruf von `make download` im zuvor definierten Ordner `LOC
 
 ## Konfiguration
 
-| Variable              | Verwendung                        | Beispiel                             |
-| :-------------------- | :-------------------------------- | :----------------------------------- |
-| `SERVER_USER`         | Server: User Name                 | `mmustermann`                        |
-| `SERVER_HOST`         | Server: Host Name                 | `hyrican-1-extern`                   |
-| `CONDA_PATH`          | Server: Conda-Installations-Pfad  | `/home/mmustermann/.local/opt/conda` |
-| `CONDA_ENV`           | Server: Conda-Environment-Name    | `ml`                                 |
-| `PYTHON_VERSION`      | Python: Gewünschte Version        | `3.10`                               |
-| `PYTHON_PACKAGES`     | Python: Benötigte Pakete          | `tensorflow-cpu matplotlib optuna`   |
-| `MAIN_SCRIPT`         | Auszuführendes Python-Script [^1] | `main.py`                            |
-| `LOG_FILE`            | Log-Datei (optional) [^1]         | `progress.log`                       |
-| `LOCAL_PROJECT_DIR`   | Client: Projektordner [^1]        | `.`                                  |
-| `LOCAL_OUTPUT_DIR`    | Client: Output-Ordner [^1]        | `output`                             |
-| `REMOTE_PROJECT_DIR`  | Server: Projektordner [^2]        | `/home/mmustermann/akis/my_project`  |
-| `REMOTE_OUTPUT_FILES` | Server: Output-Dateien [^1]       | `output/*.svg output/*pkl`           |
+| Variable              | Verwendung                         | Beispiel                             |
+| :-------------------- | :--------------------------------- | :----------------------------------- |
+| `SERVER_USER`         | Server: User Name                  | `mmustermann`                        |
+| `SERVER_HOST`         | Server: Host Name                  | `hyrican-1-extern`                   |
+| `CONDA_PATH`          | Server: Conda-Installations-Pfad   | `/home/mmustermann/.local/opt/conda` |
+| `CONDA_ENV`           | Server: Conda-Environment-Name     | `ml`                                 |
+| `PYTHON_VERSION`      | Python: Gewünschte Version         | `3.10`                               |
+| `PYTHON_PACKAGES`     | Python: Benötigte Pakete           | `tensorflow-cpu matplotlib optuna`   |
+| `MAIN_SCRIPT`         | Auszuführendes Python-Script [^1]  | `main.py`                            |
+| `LOG_FILE`            | Log-Datei (optional) [^1]          | `progress.log`                       |
+| `LOCAL_PROJECT_DIR`   | Client: Projektordner [^1]         | `.`                                  |
+| `LOCAL_OUTPUT_DIR`    | Client: Output-Ordner [^1]         | `output`                             |
+| `REMOTE_PROJECT_DIR`  | Server: Projektordner [^2]         | `/home/mmustermann/akis/my_project`  |
+| `REMOTE_OUTPUT_FILES` | Server: Output-Dateien [^1]        | `output/*.svg output/*pkl`           |
+| `COPY_LINKS_AS_FILES` | Server: Kopiert Datei des Symlinks | `false`                              |
 
 [^1]: Relativer Pfad zum Projektordner
 [^2]: Absoluter Pfad
diff --git a/src/makefile/makefile b/src/makefile/makefile
index 4a904ae..8abe373 100644
--- a/src/makefile/makefile
+++ b/src/makefile/makefile
@@ -27,11 +27,14 @@ LOCAL_OUTPUT_DIR := output
 REMOTE_PROJECT_DIR := ~/my_project
 REMOTE_OUTPUT_FILES := output/*
 
+## Misc
+COPY_LINKS_AS_FILES ?= false
+
 # ---
 
 LOGIN := $(SERVER_USER)@$(SERVER_HOST)
 SSH := ssh $(LOGIN)
-RSYNC := rsync --archive --compress --progress
+RSYNC := rsync --archive --compress --progress $(if $(filter true,$(COPY_LINKS_AS_FILES)),--copy-links)
 CONDA := source $(CONDA_PATH)/etc/profile.d/conda.sh && conda
 
 .PHONY: install upload run kill log download delete
-- 
GitLab